-
Notifications
You must be signed in to change notification settings - Fork 27
Move topology changing messages to Scheduler and introduce Zombie list #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6bd9801
to
815fae2
Compare
7e7dfe6
to
8a17ad2
Compare
8a17ad2
to
09ff0db
Compare
09ff0db
to
559ac97
Compare
For fair-acc/opendigitizer#246. OD will need to be adapted to send messages to scheduler instead of graph. Adapted tests. Introduced qa_SchedulerMessages.cpp for topology changing messages. Signed-off-by: Sergio Martins <[email protected]>
This allows to remove blocks without having to stop the scheduler. Running blocks can't transition directly to stopped state, so we move them into a "zombie list". There's a maintenance period where we delete blocks that have stopped. Furthermore, deleted blocks are now removed from each thread's local block list. Signed-off-by: Sergio Martins <[email protected]>
This was never used. It was set but never read and the job list was never updated. With the "zombie list" there's no need for it anymore. Signed-off-by: Sergio Martins <[email protected]>
Signed-off-by: Sergio Martins <[email protected]>
bd30775
to
ad530b9
Compare
During the maintenance period, when we cleanup zombies, we also check if a thread should adopt blocks that were added meanwhile Signed-off-by: Sergio Martins <[email protected]>
Lifecycle doesn't support it, so besides being a no-op it also spammed the logs with errors. The only permitted transition is the user resuming the scheduler, which should put it in initialized state Signed-off-by: Sergio Martins <[email protected]>
We move all the existing blocks to the zombie list. They'll get deleted when stopped. The scheduler needs to be restarted, so its init() method runs again to construct the job list and threads. The message is being processed by a worker thread, therefore we can't restart the scheduler here as that would crash. Scheduler is restarted automatically by OD when it receives the message reply. Also, the scheduler didn't support being restarted at all, the reset() method implementation was missing. Signed-off-by: Sergio Martins <[email protected]>
ad530b9
to
5d06c75
Compare
As that's where all message based scheduler tests are Signed-off-by: Sergio Martins <[email protected]>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd advise merging without squashing.
@@ -6,7 +6,7 @@ | |||
#include <mutex> | |||
#include <queue> | |||
#include <set> | |||
#include <source_location> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick - remove empty line
@@ -667,18 +667,84 @@ class SchedulerBase : public Block<Derived> { | |||
_zombieBlocks.push_back(std::move(block)); | |||
} | |||
|
|||
// Moves all blocks into the zombie list | |||
// Useful for bulk operations such as "set grc yaml" message | |||
void makeAllZombies() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be overly accustomed to make
being used to make new values make_shared/make_optional/make_pair. Maybe moveAllBlocksToZombieList
would be more fitting.
Move topology changing messages to Scheduler
For fair-acc/opendigitizer#246.
OD will need to be adapted to send messages to scheduler instead of graph.
Adapted tests.
Introduced qa_SchedulerMessages.cpp for topology changing messages.
Introduce zombie list for stopping blocks
This allows to remove blocks without having to stop the scheduler.
Running blocks can't transition directly to stopped state, so we
move them into a "zombie list". There's a maintenance period where
we delete blocks that have stopped.
Furthermore, deleted blocks are now removed from each thread's
local block list.