Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ async def execute(
result.outcomes[checkpoint.node_id] = outcome
if checkpoint.status == CheckpointStatus.COMPLETED:
completed.add(checkpoint.node_id)
elif checkpoint.status == CheckpointStatus.FAILED:
failed.add(checkpoint.node_id)
# FAILED/RUNNING/CANCELLED checkpoints are not terminal on resume;
# handlers are re-executed so operators can recover failed jobs.

base_payload = dict(initial_payload or {})
while True:
Expand Down
14 changes: 9 additions & 5 deletions tests/modules/core/test_scheduler_checkpoint_resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ async def node_b(payload: dict) -> dict:
assert calls == {"a": 1, "b": 1}


def test_scheduler_resume_marks_failed_checkpoint_nodes() -> None:
async def node_ok(_: dict) -> dict:
def test_scheduler_resume_retries_failed_checkpoint_nodes() -> None:
calls = {"fragile": 0}

async def node_recoverable(_: dict) -> dict:
calls["fragile"] += 1
return {"ok": True}

async def _scenario() -> None:
graph = TaskGraph([TaskNode(node_id="fragile", handler=node_ok)])
graph = TaskGraph([TaskNode(node_id="fragile", handler=node_recoverable)])
checkpoints = InMemoryCheckpointStore()
scheduler = TaskScheduler(worker_pool=WorkerPool(max_concurrency=1), checkpoint_store=checkpoints)
await checkpoints.save_checkpoint(
Expand All @@ -75,8 +78,9 @@ async def _scenario() -> None:
)
result = await scheduler.execute(job_id="job_failed_ckpt", graph=graph, resume=True)
assert "fragile" in result.outcomes
assert result.outcomes["fragile"].status == TaskStatus.FAILED
assert result.failed is True
assert result.outcomes["fragile"].status == TaskStatus.COMPLETED
assert calls["fragile"] == 1
assert result.failed is False

asyncio.run(_scenario())

Expand Down