fix: honor live scheduling revisions at dispatch
This commit is contained in:
@@ -13,8 +13,8 @@ from tests.scheduling.controlled import (
|
||||
)
|
||||
from wf_artifacts.runs.models import StoredRunStatus
|
||||
from wf_artifacts.runs.store import FileRunStore
|
||||
from wf_scheduling.calendar import OneShotSource
|
||||
from wf_scheduling.models import Schedule
|
||||
from wf_scheduling.calendar import CronSource, OneShotSource
|
||||
from wf_scheduling.models import CronTrigger, Schedule
|
||||
from wf_scheduling.ownership import SchedulerOwnership
|
||||
from wf_scheduling.poll import SCAN_CAP, Scheduler
|
||||
from wf_scheduling.prepare import SchedulePreparer
|
||||
@@ -249,6 +249,34 @@ def test_schedule_edit_between_poll_snapshot_and_admission_cannot_overwrite_term
|
||||
sched.ownership.release()
|
||||
|
||||
|
||||
def test_trigger_edit_refreshes_managed_calendar_before_polling(tmp_path: Path) -> None:
|
||||
"""A trigger edit cannot be paired with the previous tick's source."""
|
||||
sched, store, runs, sources = _harness(tmp_path, script={"*": "complete"})
|
||||
start = ts(2026, 9, 8, 11, 0)
|
||||
now = ts(2026, 9, 8, 12, 0)
|
||||
_add(
|
||||
sched,
|
||||
store,
|
||||
sources,
|
||||
"a",
|
||||
CronSource("0 * * * *", "UTC"),
|
||||
start,
|
||||
)
|
||||
old_trigger = store.get_schedule("a").trigger
|
||||
sched.set_source_definitions({"a": old_trigger})
|
||||
edited = store.get_schedule("a")
|
||||
edited.revision = 2
|
||||
edited.trigger = CronTrigger(
|
||||
expression="0 13 * * *",
|
||||
timezone="UTC",
|
||||
)
|
||||
store.update_schedule(edited, expected_revision=1)
|
||||
|
||||
assert sched.poll(now) == {"a": "idle"}
|
||||
assert runs.list_admissions() == []
|
||||
sched.ownership.release()
|
||||
|
||||
|
||||
def test_parallel_limits_and_interrupted_slots() -> None:
|
||||
import tempfile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user