feat(libxce-alloc-preason-equality): recorded dispatch fixtures carry the session-start from (task 4.2)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6110d12e5a
commit
69112c2d22
7 changed files with 137 additions and 60 deletions
|
|
@ -675,11 +675,24 @@ static void append_end_of_stream_marker(FILE* f)
|
|||
capn_free(&c);
|
||||
}
|
||||
|
||||
/* SESSION_FROM - the `from` an allocation decided in a session that began at
|
||||
* `begin_ns` (epoch nanoseconds) carries: the session start in whole
|
||||
* seconds, floor division (libxce-alloc-preason-equality Decision 8;
|
||||
* scheduler.c's sched_make_primary_alloc_() stamps it, and in simulation
|
||||
* mode the session starts at the recorded beginRound). Hand-built recorded
|
||||
* DISPATCH fixtures derive their `from` from the begin_round they are
|
||||
* recorded under, so a live replay of the same round reproduces it. */
|
||||
#define SESSION_FROM(begin_ns) ((uint64_t)(begin_ns) / 1000000000ULL)
|
||||
|
||||
/* The recorded round-1 beginRound the hand-built DISPATCH fixtures below
|
||||
* are appended under (logical nanoseconds). */
|
||||
#define ROUND1_BEGIN_NS 2000ULL
|
||||
|
||||
/* Builds the wire-shaped xce_job_alloc_t a DISPATCH decision carries --
|
||||
* same field shape test_sim_verify.c's own make_test_alloc()/
|
||||
* make_test_host_alloc()/make_test_job_alloc() establish. */
|
||||
static xce_job_alloc_t* make_dispatch_alloc(uint64_t jobid, const char* host,
|
||||
float value)
|
||||
float value, uint64_t from)
|
||||
{
|
||||
xce_alloc_t* res = (xce_alloc_t*)calloc(1, sizeof(*res));
|
||||
xce_host_alloc_t* h = (xce_host_alloc_t*)calloc(1, sizeof(*h));
|
||||
|
|
@ -697,7 +710,7 @@ static xce_job_alloc_t* make_dispatch_alloc(uint64_t jobid, const char* host,
|
|||
res->reserve = strdup("run");
|
||||
res->instid = 1;
|
||||
res->value = value;
|
||||
res->from = 0;
|
||||
res->from = from;
|
||||
res->duration = 0;
|
||||
|
||||
allocs[0] = res;
|
||||
|
|
@ -843,9 +856,10 @@ test_reconciled_job_charges_resinuse_before_live_capacity_check(void)
|
|||
append_job_state_change_event(f, 1800ULL, JOBA_ID, JOB_STAT_PEND,
|
||||
JOB_STAT_RUN);
|
||||
|
||||
alloc = make_dispatch_alloc(JOBA_ID, WORKER_NAME, JOBA_WANT);
|
||||
append_replay_session_with_dispatch_and_pend(f, 2000ULL, alloc, JOBB_ID,
|
||||
0);
|
||||
alloc = make_dispatch_alloc(JOBA_ID, WORKER_NAME, JOBA_WANT,
|
||||
SESSION_FROM(ROUND1_BEGIN_NS));
|
||||
append_replay_session_with_dispatch_and_pend(f, ROUND1_BEGIN_NS, alloc,
|
||||
JOBB_ID, 0);
|
||||
append_end_of_stream_marker(f);
|
||||
fclose(f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue