fix(spurctld): reject unusable --nodelist/--exclude at submission (follow-up to #679) - #722
fix(spurctld): reject unusable --nodelist/--exclude at submission (follow-up to #679)#722SumonAMD wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #722 +/- ##
=======================================
Coverage 79.36% 79.36%
=======================================
Files 180 180
Lines 82240 82264 +24
=======================================
+ Hits 65266 65287 +21
- Misses 16974 16977 +3 🚀 New features to boost your workflow:
|
9d01dc9 to
eedec26
Compare
Follow-up to ROCm#679, addressing both review items. The in-loop expansion backstop ran after the push, so `results` could hold one name past MAX_HOSTLIST_SIZE before erroring, contradicting the pre-loop guard. Move the check before the push and compare with `>=`, so the vector never grows past the cap it reports. Applying `>=` in the old position instead would have rejected a list of exactly MAX_HOSTLIST_SIZE, which the pre-loop guard allows and expand_allows_cap_boundary asserts. An over-cap or malformed --nodelist/--exclude fell back to a comma-split, so the pattern became a literal node name that matches nothing and the job waited in the queue with nothing to explain why. Validate both at the submit boundary and return InvalidArgument with the pattern and reason, as Slurm does.
eedec26 to
d5cf455
Compare
Review — recall passStrengths / verification: The core fix is correct. Moving the in-loop size guard before the push and switching to Three items below. 1. (question) Is the stricter rejection of an unexpandable / over-cap
|
Summary
Follow-up to #679, addressing both review items @sajmera-pensando raised:
total would exceed
MAX_HOSTLIST_SIZE, but the in-loop backstop ran afterthe push and used
>, soresultscould transiently holdMAX_HOSTLIST_SIZE + 1before erroring. The two guards disagreed.
--nodelist/--excludesilently hung the job. Anunexpandable pattern fell back to a literal name (via
node_match::expand_hostlist_or_split) that matches no node, so the job sat inthe queue forever with no error. Slurm rejects this at submission.
Changes
hostlist.rs— move the in-loop size check before the push and compare with>=, soresultsnever grows past the cap. Also drop thecountfield fromTooLarge: the in-loop path can't know the true request size without expanding(the OOM we're preventing), so it reported a misleading
MAX + 1. Both guards nowreport the limit only —
hostlist too large: exceeds maximum {max} hosts.server.rs— validate--nodelistand--excludeinproto_to_job_spec,returning
InvalidArgumentwith the offending pattern and reason before the specreaches the scheduler.
Test plan
expand_allows_cap_boundary— a list of exactly 1,000,000 hosts still expandsexpand_rejects_nested_product_over_cap,expand_rejects_recursive_overshoot_past_cap— nested patterns that multiply past the cap are rejectedproto_to_job_spec_rejects_unexpandable_node_patterns— over-cap nodelist and malformed exclude are rejected, a valid pattern still passescargo fmt --checkclean,cargo clippy -D warningscleanspur-core+spurctldsuites pass single-threaded (1,536 tests, 0 failures)