[feature] add functional scheduler to separate critical and functional modules processing#631
Merged
ldmonster merged 7 commits intofeature/system-areafrom Jul 15, 2025
Merged
Conversation
1135aa5 to
af77e67
Compare
af77e67 to
426ec8b
Compare
8fc010b to
6f04418
Compare
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
8d74240 to
7d28946
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR separates critical and functional modules by introducing a Critical flag, implementing a functional scheduler, and updating task handling and queues to route non-critical modules through the new scheduler.
- Add
Criticalmetadata to tasks and pass it through parallel and converge workflows. - Implement and integrate a
functional.Schedulerfor non-critical module execution. - Expose queue length, adjust parallel queue count, and wire up scheduler dependencies in service and module manager.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/task/tasks/parallel-module-run/task.go | Pass Critical flag to parallel module run tasks |
| pkg/task/tasks/converge-modules/task.go | Integrate functional scheduler and mark critical tasks |
| pkg/task/service/service.go | Initialize functional scheduler and handle non-critical tasks |
| pkg/task/service/converge.go | Lower log level for first converge completion |
| pkg/task/queue/queue.go | Add method to retrieve queue length |
| pkg/task/hook_metadata.go | Extend HookMetadata with Critical field |
| pkg/task/functional/scheduler.go | Implement functional task scheduler |
| pkg/task/functional/scheduler_test.go | Add tests for functional scheduler |
| pkg/module_manager/scheduler/scheduler.go | Expose functional dependencies and critical checks |
| pkg/module_manager/module_manager.go | Add module criticality getters |
| pkg/app/app.go | Increase number of parallel queues |
Comments suppressed due to low confidence (3)
pkg/task/tasks/converge-modules/task.go:383
- [nitpick] The comment here is misleading: this branch actually collects functional modules for later scheduling. Consider updating it to something like
// collect functional modulesto reflect intent.
// skip functional modules
pkg/task/functional/scheduler.go:19
- [nitpick] Defining
Rootas an empty string can be confusing. Consider using a more explicit sentinel or documenting its semantics to avoid ambiguity in calls likeDone(Root).
Root = ""
pkg/task/tasks/converge-modules/task.go:185
- The new functional scheduling logic in
Handle(trigger/delay loop) andCreateConvergeModulesTasksis not covered by existing tests. Consider adding unit or integration tests to verify that functional modules are correctly scheduled and completed in theWaitDeleteAndRunModulesphase.
// trigger functional converge
ldmonster
reviewed
Jul 11, 2025
ldmonster
reviewed
Jul 11, 2025
ldmonster
reviewed
Jul 11, 2025
ldmonster
reviewed
Jul 11, 2025
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
…separate-critical
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
…separate-critical
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
It adds functional scheduler to separate critical and functional modules processing.
It continues it
What this PR does / why we need it
The scheduler is designed to process functional modules, ensuring they are only run after their dependencies have been processed, and executes their ModuleRun tasks in parallel queues.
During converge functional modules loaded into the scheduler. And the converge task waits until the scheduler finished processing. While waiting the converge task can skip ahead other tasks in the queue if they are waiting it means the functional processing DOES NOT BLOCK the main queue.
How the Scheduler Works
Dependency Management:
The scheduler tracks dependencies between functional modules. Each module can declare a list of dependencies, and the scheduler ensures that a module is only scheduled for processing after all its dependencies done(after ModuleRun done it sends signal to the scheduler).
Parallel Execution:
Functional modules whose dependencies are satisfied are scheduled to run in parallel queues. The number of parallel queues is configurable (increased to 20 in this PR), and the scheduler distributes tasks across them.
Critical vs Functional Modules:
Critical modules are processed separately and are not managed by the functional scheduler. The scheduler only handles functional modules.
Checklist