feat(scheduler-dispatch-commit): scheduler transitions job to RUN at dispatch commit (task 2.1)

sched_commit_decision()'s DISPATCH branch now sets job->state = JOB_STAT_RUN
in the same operation that already commits job->allocs/job->accounts, per
Requirement 1.1/1.2/1.3. sched_account_jobs()'s existing JOB_IS_RUN gate is
unmodified -- this closes bug-1624 by giving it the input it was missing: a
dispatched job now survives a round boundary in resource-in-use totals
regardless of how many rounds pass before worker confirmation arrives.

Regression test drives the real, unmodified sched_account_jobs() across a
simulated round boundary (resInUse reset, no confirmation event) and
independently reverting the one-line change reproduces bug-1624 exactly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-23 08:25:35 +00:00
parent 0649050ae8
commit 8607348c9b
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 289 additions and 1 deletions

View file

@ -1102,6 +1102,27 @@ sched_scheduler_decision_redelivery_test = executable(
link_args: ['-Wl,--wrap=xcecli_jobdispatch'],
install: false)
# scheduler-dispatch-commit spec, task 2.1 (Req 1.1/1.2/1.3): proves
# sched_commit_decision()'s DISPATCH branch transitions job->state to
# JOB_STAT_RUN in the same operation that already commits job->allocs/
# job->accounts. Same real-scheduler_srcs link technique as
# sched_scheduler_connect_test above, but no `-Wl,--wrap=` is needed: this
# file never calls sched_init()/sched_fini(), so none of the xcecli_* calls
# those make are ever reached.
scheduler_dispatch_commit_test_srcs = ['test_scheduler_dispatch_commit.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
scheduler_dispatch_commit_test_srcs += ['../' + f]
endif
endforeach
sched_scheduler_dispatch_commit_test = executable(
'sched_scheduler_dispatch_commit_test',
scheduler_dispatch_commit_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
install: false)
# Register as meson tests so `meson test --suite scheduler` runs them all.
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
test('scheduler test', scheduler_test, suite: 'scheduler',
@ -1246,3 +1267,6 @@ test('scheduler backpressure test',
test('scheduler decision redelivery test',
sched_scheduler_decision_redelivery_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler dispatch commit test',
sched_scheduler_dispatch_commit_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])