feat(scheduler-allocator-runner): runner result assembly (task 3.3)

sched_finalize_job_alloc_() turns a satisfied plan's claims into the job
allocation exactly as parjob's commit tail does (host records from the
claim-time snapshots in claim order, shared records, jobid 0, no
duration) and publishes ctx->alloc only on success. Every out-of-memory
step frees what it built and releases the debits of claims not yet
turned into host allocations; each claim snapshot is freed exactly once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-30 09:27:32 +00:00
parent 0c011f784e
commit 0e68ed991a
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
5 changed files with 666 additions and 49 deletions

View file

@ -1768,6 +1768,20 @@ sched_alloc_runner_search_test = executable(
link_args: ['-Wl,--wrap=xvec_dup'],
install: false)
# scheduler-allocator-runner task 3.3 (Req 4.1-4.4, 5.4-5.7, 7.2): the
# runner's result assembly and its out-of-memory paths, same white-box
# stack as above. make_host_alloc/make_job_alloc are wrapped to fail on
# call N; the host-array calloc is replaced inside the test file
# (alloc_runner.c only).
sched_alloc_runner_result_test = executable(
'sched_alloc_runner_result_test',
['test_alloc_runner_result.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
link_args: ['-Wl,--wrap=make_host_alloc',
'-Wl,--wrap=make_job_alloc'],
install: false)
# Task 3.2 (scheduler-allocation spec, Req 9.1): the dedicated pre/post-
# rewrap host-selection EQUIVALENCE proof for seqjob_allocator.c's
# my_alloc() -- fixture states task 3.1's own smoke test does not cover
@ -2046,6 +2060,9 @@ test('scheduler alloc runner test',
# Leak detection stays on: every fixture tears down its ctx and core.
test('scheduler alloc runner search test',
sched_alloc_runner_search_test, suite: 'scheduler')
# Leak detection stays on: every fixture tears down its ctx and core.
test('scheduler alloc runner result test',
sched_alloc_runner_result_test, suite: 'scheduler')
test('scheduler seqjob rewrap equivalence test',
sched_seqjob_rewrap_equivalence_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])