Skip to content

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

Merged
merged 8 commits into from
May 31, 2025

Conversation

iamsergio
Copy link
Contributor

@iamsergio iamsergio commented May 9, 2025

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.

@iamsergio iamsergio marked this pull request as draft May 9, 2025 16:45
@iamsergio iamsergio force-pushed the sergio/graph_messages branch 5 times, most recently from 6bd9801 to 815fae2 Compare May 14, 2025 14:58
@iamsergio iamsergio changed the title Move graph topology changing messages to Scheduler Move topology changing messages to Scheduler and introduce Zombie list May 14, 2025
@iamsergio iamsergio force-pushed the sergio/graph_messages branch 2 times, most recently from 7e7dfe6 to 8a17ad2 Compare May 14, 2025 15:30
@iamsergio iamsergio marked this pull request as ready for review May 14, 2025 15:42
@iamsergio iamsergio force-pushed the sergio/graph_messages branch from 8a17ad2 to 09ff0db Compare May 14, 2025 21:17
@iamsergio iamsergio force-pushed the sergio/graph_messages branch from 09ff0db to 559ac97 Compare May 20, 2025 21:18
iamsergio added 4 commits May 27, 2025 11:29
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]>
@iamsergio iamsergio force-pushed the sergio/graph_messages branch 3 times, most recently from bd30775 to ad530b9 Compare May 29, 2025 17:11
iamsergio added 3 commits May 29, 2025 22:34
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]>
@iamsergio iamsergio force-pushed the sergio/graph_messages branch from ad530b9 to 5d06c75 Compare May 29, 2025 21:34
As that's where all message based scheduler tests are

Signed-off-by: Sergio Martins <[email protected]>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
44.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@ivan-cukic ivan-cukic left a 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>

Copy link
Contributor

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() {
Copy link
Contributor

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.

@RalphSteinhagen RalphSteinhagen merged commit 09f0ffa into main May 31, 2025
15 of 17 checks passed
@RalphSteinhagen RalphSteinhagen deleted the sergio/graph_messages branch May 31, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants