fix(cie): take 'nice' instead of 'priority' for CFS policies - #62
Merged
Merged
Conversation
Signed-off-by: atsushi421 <atsushi.yano.2@tier4.jp>
- Add SCHED_IDLE to the README policy list and CFS description - Document the new validation errors in the constructor's @throws clause - Compile thread_configurator_node.cpp once into a static library shared by the executable and the test, dropping the redundant include dirs Signed-off-by: atsushi421 <atsushi.yano.2@tier4.jp>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates cie_thread_configurator’s YAML scheduling configuration to use policy-appropriate keys (nice for CFS policies vs priority for RT policies), adds explicit range/type validation with clearer startup failures, and introduces a unit test that exercises this validation through the public ThreadConfiguratorNode API.
Changes:
- Split scheduling parameters into
nice(CFS) andpriority(RT) with strict validation and improved error reporting. - Update generated YAML templates and documentation examples to use
nicefor CFS policies. - Add a new unit test suite validating acceptance/ignore/rejection cases via
ThreadConfiguratorNodeconstruction, and refactor build targets to enable linking node logic into tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cie_thread_configurator/test/test_thread_configurator_node.cpp | New unit tests covering YAML validation behavior for nice/priority across policies. |
| cie_thread_configurator/src/thread_configurator_node.cpp | Implements policy-dependent parsing (nice vs priority) with type/range checks and applies nice via setpriority. |
| cie_thread_configurator/src/prerun_node.cpp | Updates generated template YAML to emit nice: 0 for SCHED_OTHER. |
| cie_thread_configurator/README.md | Updates YAML examples and scheduler documentation to reflect nice for CFS and documents validation ranges. |
| cie_thread_configurator/include/cie_thread_configurator/thread_configurator_node.hpp | Extends ThreadConfig with separate nice and priority fields; updates constructor documentation for new validation behavior. |
| cie_thread_configurator/CMakeLists.txt | Refactors build to introduce a core library for ThreadConfiguratorNode logic and adds the new test target. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
atsushi421
enabled auto-merge
August 17, 2026 08:29
atsushi421
added a commit
to autowarefoundation/callback_isolated_executor_doc
that referenced
this pull request
Aug 17, 2026
Reflect autowarefoundation/callback_isolated_executor#62: CFS entries (SCHED_OTHER / SCHED_BATCH / SCHED_IDLE) now use the 'nice' key validated against [-20, 19], while SCHED_FIFO / SCHED_RR keep 'priority' validated against [1, 99]. A missing required key is rejected at startup; a stray key of the other policy class is ignored. Signed-off-by: atsushi421 <atsushi.yano.2@tier4.jp>
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.
Description
For
SCHED_OTHER/SCHED_BATCH/SCHED_IDLEentries, the value configured under theprioritykey has always been applied as a nice value viasetpriority(2)(thesched_prioritypassed tosched_setscheduler(2)is fixed to 0 for these policies). Reusing theprioritykey for that was misleading and error-prone:SCHED_FIFO/SCHED_RR,prioritymeans rt_priority (1..99, higher is stronger), while nice runs the opposite way (-20..19, lower is stronger). The same key name flips its meaning depending on the policy.setpriority(2)silently clamps out-of-range values to [-20, 19], so writing an rt_priority-style value (e.g.priority: 50) on a CFS entry demoted the thread to the lowest priority without any error.sched_attr.sched_nicevssched_attr.sched_priority).This PR makes the scheduling-parameter key policy-dependent, porting autowarefoundation/agnocast#1529 to this repository:
SCHED_OTHER/SCHED_BATCH/SCHED_IDLEentries now takenice, validated against [-20, 19].SCHED_FIFO/SCHED_RRentries keeppriority, now validated against [1, 99] (previously unvalidated).SCHED_DEADLINEentries are unchanged (runtime/period/deadline).ThreadConfigmirrors the split: it now carries separateniceandpriorityfields instead of one field whose meaning depended on the policy.Breaking change: there is no compatibility alias. Existing YAMLs that set
priorityon aSCHED_OTHER/SCHED_BATCH/SCHED_IDLEentry are rejected at startup and must rename the key tonice(the value itself is unchanged; it was always a nice value).Other changes:
prerun_nodenow emitsnice: 0for theSCHED_OTHERentries in the generated template.nicekey, and both range validations are documented.test_thread_configurator_node.cpp) exercises the validation through the publicThreadConfiguratorNodeconstructor with theconfig_fileparameter: acceptance across the three CFS policies and both RT policies, stray other-class keys being ignored, and rejection of missing / null / non-integer / out-of-range values including the legacyprioritykey on a CFS entry.Related links
How was this PR tested?
colcon build --packages-select cie_thread_configurator --cmake-args -DBUILD_TESTING=ONtest_thread_configurator_node(12 new tests) andtest_util(9 existing tests) all pass.Notes for reviewers
Post-merge checklists