sched: extract typed preparer/dispatcher seams; test impl out of production (F6)

This commit is contained in:
lda
2026-09-08 11:19:48 +07:00 Verified
parent 7f6c832b0b
commit 15bd472bdc
8 changed files with 564 additions and 162 deletions
+12 -2
View File
@@ -6,10 +6,17 @@ from datetime import UTC, datetime
from pathlib import Path
from typing import Any
from tests.scheduling.controlled import (
DictDeployments,
ScriptedDispatcher,
fixture_environment,
)
from wf_artifacts.runs.store import FileRunStore
from wf_scheduling import recovery as sched_recovery
from wf_scheduling.calendar import OneShotSource
from wf_scheduling.models import Schedule
from wf_scheduling.poll import Scheduler
from wf_scheduling.prepare import SchedulePreparer
from wf_scheduling.store import FileScheduleStore
@@ -92,7 +99,6 @@ def test_recovery_never_executes_pending_until_poll(tmp_path: Path) -> None:
from tests.artifacts.test_run_store import artifact as _artifact
from tests.artifacts.test_run_store import deployment as _deployment
from tests.scheduling.test_poll import OneShotSource
from wf_api.run_lifecycle import persist_admission
from wf_artifacts import PinnedRunEnvironment
@@ -124,7 +130,11 @@ def test_recovery_never_executes_pending_until_poll(tmp_path: Path) -> None:
run_store=run_store,
sources=sources, # type: ignore[arg-type]
capacity=4,
outcomes={"*": "complete"},
preparer=SchedulePreparer(
DictDeployments({"dep-1": {"rev": 1, "required": []}}),
fixture_environment,
),
dispatcher=ScriptedDispatcher({"*": "complete"}),
)
sched_store.save_consumed("a", ts(2026, 9, 8, 12, 0))
sched.poll(ts(2026, 9, 8, 12, 1))