generated from eclipse-score/module_template
-
Notifications
You must be signed in to change notification settings - Fork 2
worker: Expose safety worker queue size config #50
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
PiotrKorkus
merged 1 commit into
eclipse-score:main
from
qorix-group:prabakaran_expose_safety_queue_size_cfg
Jan 14, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,7 @@ pub struct ExecutionEngineBuilder { | |
|
|
||
| dedicated_workers_ids: GrowableVec<(UniqueWorkerId, ThreadParameters)>, | ||
| with_safe_worker: (bool, ThreadParameters), //enabled, params | ||
| safety_worker_queue_size: u32, | ||
| } | ||
|
|
||
| impl Default for ExecutionEngineBuilder { | ||
|
|
@@ -242,6 +243,7 @@ impl ExecutionEngineBuilder { | |
| queue_size: 256, | ||
| dedicated_workers_ids: GrowableVec::new(2), | ||
| with_safe_worker: (false, ThreadParameters::default()), | ||
| safety_worker_queue_size: 64, | ||
| thread_params: ThreadParameters::default(), | ||
| } | ||
| } | ||
|
|
@@ -311,6 +313,17 @@ impl ExecutionEngineBuilder { | |
| self | ||
| } | ||
|
|
||
| /// | ||
| /// Configure safety worker task queue size with `size`. | ||
| /// >ATTENTION: `size` has to be power of two and safety worker shall be enabled prior to queue size configuration. | ||
| /// | ||
| pub fn safety_worker_task_queue_size(mut self, size: u32) -> Self { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this shall fail if enable_safety_worker was not called before or ? Otherwise user may thing it works.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| assert!(size.is_power_of_two(), "Safety worker task queue size ({}) must be power of two", size); | ||
| assert!(self.with_safe_worker.0, "Enable safety worker prior to configuring its queue size."); | ||
| self.safety_worker_queue_size = size; | ||
| self | ||
| } | ||
|
|
||
| /// | ||
| /// Adds new dedicated worker identified by `id` to the engine with given thread parameters `params`. | ||
| /// If priority or scheduler type is `None`, then both attributes will be inherited from parent thread. | ||
|
|
@@ -341,7 +354,11 @@ impl ExecutionEngineBuilder { | |
| let safety_worker_queue; | ||
| let safety_worker = { | ||
| if self.with_safe_worker.0 { | ||
| let w = SafetyWorker::new(WorkerId::new("SafetyWorker".into(), 0, 0, WorkerType::Dedicated), self.with_safe_worker.1); | ||
| let w = SafetyWorker::new( | ||
| WorkerId::new("SafetyWorker".into(), 0, 0, WorkerType::Dedicated), | ||
| self.with_safe_worker.1, | ||
| self.safety_worker_queue_size, | ||
| ); | ||
| safety_worker_queue = Some(w.get_queue()); | ||
| Some(w) | ||
| } else { | ||
|
|
||
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
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
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
Oops, something went wrong.
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.
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.
this 64 is sued here and in other places. We shall use single source const value in all cases for default to keep it consistent.
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.
as before SAFETY_QUEUE_SIZE
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.
Not fixed to avoid circular dependency because
kyronhas dependency onkyron-macros.Note:
If SAFETY_QUEUE_SIZE is defined in
kyronand if this dependency is added inkyron-macros, it results in circular dependency.