sched: truthful executing marks in capacity test shortcuts; format wave files

This commit is contained in:
lda
2026-09-09 17:33:03 +07:00 Verified
parent b094385077
commit 99c038a04f
7 changed files with 33 additions and 26 deletions
+7 -2
View File
@@ -193,7 +193,11 @@ def test_parallel_limits_and_interrupted_slots() -> None:
sched.poll(t0)
assert sched._task_load() == 1
first = runs.list_runs()[0]
# A waiting interruption holds no task slot: production dispatch
# clears the executing mark when persisting the stopped result, so
# the simulated interruption clears it too.
runs.save_run(first.model_copy(update={"status": StoredRunStatus.INTERRUPTED}))
runs.clear_executing(first.id)
assert sched._task_load() == 0
sched.poll(t0 + timedelta(minutes=5))
assert len(runs.list_runs()) == 2
@@ -205,6 +209,7 @@ def test_parallel_limits_and_interrupted_slots() -> None:
store.save_schedule(sched_model)
second = [r for r in runs.list_runs() if r.id != first.id][0]
runs.save_run(second.model_copy(update={"status": StoredRunStatus.INTERRUPTED}))
runs.clear_executing(second.id)
sched.poll(t0 + timedelta(minutes=15))
assert any(
r["kind"] == "skipped-overlap" and "12:15" in str(r["resolved_at"])
@@ -287,6 +292,7 @@ def test_fairness_slow_schedule_not_starved(tmp_path: Path) -> None:
)
for run in runs.list_runs():
runs.save_run(run.model_copy(update={"status": StoredRunStatus.COMPLETED}))
runs.clear_executing(run.id)
sched.poll(t0 + timedelta(seconds=30))
assert any(r["kind"] == "admitted" for r in _history(store, "slow"))
sched.ownership.release()
@@ -390,9 +396,8 @@ def test_record_resumed_stopped_result_is_idempotent_and_attributed(
tmp_path: Path,
) -> None:
"""Live resumed results record exactly once with schedule attribution (B3)."""
from wf_api.run_lifecycle import persist_admission
from tests.scheduling.controlled import fixture_environment
from wf_api.run_lifecycle import persist_admission
sched, store, runs, sources = _harness(tmp_path, script={"*": "interrupt"})
t0 = ts(2026, 9, 8, 12, 0)