feat(reservations): persist CRUD via raft WAL and enforce scheduling parity#385
Open
sgopinath1 wants to merge 4 commits into
Open
feat(reservations): persist CRUD via raft WAL and enforce scheduling parity#385sgopinath1 wants to merge 4 commits into
sgopinath1 wants to merge 4 commits into
Conversation
…parity Route reservation create/update/delete through WalOperation so changes survive log replay, not just periodic snapshots. Add MAINT, IGNORE_JOBS, and NO_HOLD_JOBS flags with overlap validation, prospective backfill blocking, lifecycle enforcement (purge, end-time cancel, hold on delete), and scontrol/sinfo display updates including maint-fenced pending reasons.
Add OVERLAP flag with reservation overlap validation, resv_overrun_minutes grace for end-of-window job cancel, reservation-first pending job ordering, PreemptMode-aware preemption with reservation immunity unless priority_tier is higher, JobInfo.reservation proto field, and squeue %v column.
Reject unknown reservation flags, fix backfill window for future starts, gate preemption on node overlap, hold pending jobs on purge_expired, add WAL apply and e2e coverage, and fix spurdbd JobInfo.reservation.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #385 +/- ##
==========================================
+ Coverage 68.22% 68.67% +0.44%
==========================================
Files 134 134
Lines 36087 37173 +1086
==========================================
+ Hits 24619 25525 +906
- Misses 11468 11648 +180 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds durable, Raft-persisted node reservations to Spur and enforces reservation semantics across scheduling, backfill, display surfaces, and preemption behavior.
Changes:
- Persist reservation CRUD via Raft WAL operations and apply-path replay.
- Enforce reservation eligibility in scheduling/backfill (including future overlap fencing) and introduce reservation-driven pending reasons / formatting.
- Integrate reservations into UX/API surfaces (proto fields, CLI display/format codes) and refine preemption logic around active reservations.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/native_host/e2e/test_reservations.py | Adds native-host E2E coverage for reservation create/list/delete and scheduling enforcement. |
| proto/slurm.proto | Extends public proto with reservation fields (job reservation, node maint flag, reservation flags/state). |
| crates/spurdbd/src/server.rs | Populates new JobInfo.reservation field for accounting responses. |
| crates/spurctld/src/server.rs | Validates/accepts reservation flags at API boundary; lists reservation flags/state; annotates nodes with reservation info. |
| crates/spurctld/src/scheduler_loop.rs | Runs reservation lifecycle hooks each scheduler tick; expands preemption logic to account for reservations and partition policy. |
| crates/spurctld/src/cluster.rs | Moves reservation CRUD onto propose→apply Raft path; adds validation, purge/expiry handling, and reservation-driven pending ordering/reasons. |
| crates/spur-tests/src/t55_format.rs | Adds formatting parity mappings for new pending reasons. |
| crates/spur-tests/src/t50_core.rs | Updates core tests for new reservation flags field. |
| crates/spur-tests/src/t07_sched.rs | Updates scheduler tests for new reservation flags field. |
| crates/spur-sched/src/backfill.rs | Adds prospective reservation overlap checks and reservation window fit constraints to backfill scheduling. |
| crates/spur-core/src/wal.rs | Introduces WAL variants for reservation create/update/delete plus serialization round-trip tests. |
| crates/spur-core/src/reservation.rs | Adds reservation flags, overlap helpers, node-list normalization, and prospective overlap logic. |
| crates/spur-core/src/job.rs | Introduces new PendingReason values for reservation maintenance/deletion. |
| crates/spur-core/src/config.rs | Adds resv_overrun_minutes scheduler config for reservation end grace period. |
| crates/spur-cli/src/squeue.rs | Adds %v job format spec for reservation name display. |
| crates/spur-cli/src/smd.rs | Displays maint vs resv for nodes with active maintenance reservations. |
| crates/spur-cli/src/sinfo.rs | Displays maint vs resv for idle nodes with active maintenance reservations. |
| crates/spur-cli/src/scontrol.rs | Adds --flags to reservation creation and shows reservation/node reservation-related fields. |
| crates/spur-cli/src/format_engine.rs | Adds header label for %v reservation column. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Block unauthorized jobs on active reservations in prospective_overlap, treat unknown running-job end times as occupied, split reservation RPC errors (internal vs not_found vs invalid_argument), OR maint flags across overlapping reservations, and wait on specific job states in e2e tests.
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.
Summary
Adds durable node reservations with scheduling enforcement, and preemption interaction.
WalOperation(Raft log replay), not snapshot-only state.MAINT,IGNORE_JOBS,NO_HOLD_JOBS, andOVERLAPwith validation (unknown flags rejected at API boundary).pending_jobs(), future-start window fit vianow.max(res.start_time), and lifecycle hooks (purge_expired, end-time cancel withresv_overrun_minutesgrace, hold pending jobs on delete/purge unlessNO_HOLD_JOBS).PreemptMode; skips jobs in active reservations unless the preemptor has a higherpriority_tier; only considers running jobs on nodes the pending job could use.scontrol/sinfo/smdreservation state;PendingReason::ReservedMaintenance/ReservationDeleted; protoJobInfo.reservation,reservation_maint,ReservationInfo.state;squeue %vcolumn.Design notes
hold_jobs_for_deleted_reservationsetsPendingReason::ReservationDeletedafterhold_job(not WAL-persisted; same pattern as other hold reasons).IGNORE_JOBSbypasses running-job overlap checks at create time;OVERLAP/MAINTallow storage overlap between reservations.Test plan
cargo fmt --checkcargo clippy --workspace --exclude spur-ffi --all-targets --locked(RUSTFLAGS=-D warnings)cargo test --locked(unit tests acrossspur-core,spur-sched,spurctld,spur-cli,spurdbd)resv_overrungrace, preemption immunity, node-overlap gating,purge_expiredhold behavior, WAL apply for reservation CRUDtests/native_host/e2e/test_reservations.pyon bare-metal lab (create/list/delete, unauthorized block, authorized schedule, busy-node rejection)