fix: serialize scheduler transitions and coalesce misfires
This commit is contained in:
@@ -110,6 +110,47 @@ def test_recovery_fails_abandoned_admitted_without_replay(tmp_path: Path) -> Non
|
||||
assert run_store.get_run(admission.id).status.value == "failed"
|
||||
|
||||
|
||||
def test_recovery_fails_corrupt_view_without_admission(tmp_path: Path) -> None:
|
||||
"""A view with no admission is failed closed instead of left active."""
|
||||
from tests.artifacts.test_run_store import artifact as _artifact
|
||||
from tests.artifacts.test_run_store import deployment as _deployment
|
||||
from wf_artifacts import PinnedRunEnvironment, ResumeReadiness, WorkflowRunRecord
|
||||
from wf_artifacts.runs.models import StoredRunStatus
|
||||
|
||||
sched_store = FileScheduleStore(tmp_path / "sched")
|
||||
run_store = FileRunStore(tmp_path / "runs")
|
||||
sched_store.create_schedule(_sched_model("a"))
|
||||
now = ts(2026, 9, 8, 12, 0)
|
||||
run_id = run_store.allocate_run_id()
|
||||
run_store.save_run(
|
||||
WorkflowRunRecord(
|
||||
id=run_id,
|
||||
status=StoredRunStatus.ADMITTED,
|
||||
resume_readiness=ResumeReadiness.NOT_APPLICABLE,
|
||||
environment=PinnedRunEnvironment(
|
||||
deployment=_deployment(), root_artifact=_artifact(), child_artifacts=[]
|
||||
),
|
||||
latest_checkpoint_id=None,
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
)
|
||||
)
|
||||
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
diags = sched_recovery.recover(
|
||||
schedule_store=sched_store,
|
||||
run_store=run_store,
|
||||
now=now,
|
||||
ownership=ownership,
|
||||
)
|
||||
finally:
|
||||
ownership.release()
|
||||
|
||||
assert any(f"{run_id}:failed-closed" in item for item in diags)
|
||||
assert run_store.get_run(run_id).status.value == "failed"
|
||||
|
||||
|
||||
def test_recovery_never_executes_pending_until_poll(tmp_path: Path) -> None:
|
||||
|
||||
from tests.artifacts.test_run_store import artifact as _artifact
|
||||
|
||||
Reference in New Issue
Block a user