sched: sibling-distinct lock identity; reject shared-store overlaps (R4 wave 4)

This commit is contained in:
lda
2026-09-09 10:20:03 +07:00 Verified
parent d2c0867f76
commit c0d36d6b61
4 changed files with 168 additions and 32 deletions
+11 -5
View File
@@ -31,7 +31,11 @@ from wf_scheduling.history import (
HistoryRecorder,
)
from wf_scheduling.models import PendingCandidate
from wf_scheduling.ownership import SchedulerOwnership, SecondOwnerError
from wf_scheduling.ownership import (
SchedulerOwnership,
SecondOwnerError,
describe_unsupported_layout,
)
from wf_scheduling.prepare import InvocationPreparer, PreparationRejected
UTC = timezone.utc
@@ -146,10 +150,12 @@ class Scheduler:
or administering schedules would risk double admission.
"""
ownership = self.ownership
if ownership is None or not ownership.covers(
getattr(self.schedule_store, "root", None),
getattr(self.run_store, "root", None),
):
sched_root = getattr(self.schedule_store, "root", None)
runs_root = getattr(self.run_store, "root", None)
unsupported = describe_unsupported_layout(sched_root, runs_root)
if unsupported is not None:
raise SecondOwnerError(unsupported)
if ownership is None or not ownership.covers(sched_root, runs_root):
raise SecondOwnerError(
"scheduler ownership must cover the schedule and run stores "
"before polling or mutating schedules"