Repository navigation
feat(orchestrator): max pending, run and pipeline run duration annotations - #451
snehabankar-bit wants to merge 2 commits into
Conversation
| # new | ||
| CANCELLING = "CANCELLING" | ||
| CANCELLED = "CANCELLED" | ||
| TIMED_OUT = "TIMED_OUT" # Exceeded its max pending / run duration |
There was a problem hiding this comment.
This changes the DB schema and the DBs would need to be properly migrated. However, we would prefer not to add manual migrations right now as we're in process of adding alembic-based migartions.
Best to reuse the Failed status for now.
| class ExecutionOptionsSpec(_BaseModel): | ||
| retry_strategy: Optional[RetryStrategySpec] = None | ||
| caching_strategy: Optional[CachingStrategySpec] = None | ||
| # Durations like "PT30M" or "P1DT2H". Unset means no limit. |
There was a problem hiding this comment.
Interesting idea.
But let's first implement such experimental features as annotations (see Tangle annotations supported by the Kubernetes Launcher). The ComponentSpec schema has stability and compatibility guarantees. New features that are only supported by some engines are usually added via annotations where possible.
|
Thanks, reworked: the limits are now task annotations (no |
| should_terminate = should_terminate_execution or should_terminate_run | ||
| if should_terminate: | ||
| run_timed_out = _run_timed_out(pipeline_run, _get_current_time()) | ||
| if should_terminate or run_timed_out: |
There was a problem hiding this comment.
can we add run_timed_out to should_terminate
6f9d1a3 to
416c929
Compare
…tions Task annotations set a max pending, run or whole-run duration. A task over its limit is stopped like a cancel and ends as FAILED with the reason. Co-Authored-By: Claude Code <noreply@anthropic.com>
783424e to
4e48fe8
Compare
…nodes that ran Co-Authored-By: Claude Code <noreply@anthropic.com>
What
Task annotations, with durations like
PT30MorP1DT2H:tangleml.com/orchestration/max_pending_duration: from launch until the container starts.tangleml.com/orchestration/max_run_duration: from start until the container ends.tangleml.com/orchestration/max_pipeline_run_duration(root task): from run creation until the run ends.A task over its limit is stopped like a cancel and ends as
FAILED, with the reason inorchestration_error_message. Downstream tasks are skipped. No new status and noComponentSpecchange.How
After each status refresh, a node over its limit is flagged
desired_state: TIMED_OUTwith a reason. The existing cancel code stops the container on the next sweep. A queued task in a run over its limit is failed without launching.CANCELLED.3600, is ignored with one warning per value.Timing is approximate
A task stops at its limit, plus up to one status check, plus the launcher's stop grace period. In local tests a
PT30Slimit stopped tasks at 32-49s: status checks were 1-14s apart depending on load, and Docker waits 10s before killing.Known limit
On the Kubernetes Job launcher the run clock starts when the Job is accepted, not when the container starts, so
max_run_durationincludes waiting time there.Testing
Unit tests in
tests/test_orchestrator_sql.py. The suite passes excepttest_request_id_concurrency, which also fails onmaster.End to end on a local Tangle (
start_local.py) built from this branch:Local_Kubernetes_UsingHostPathStorage_KubernetesJobLauncher) on a kind cluster, for the pending case.SUCCEEDEDPT10M) on task and rootSUCCEEDED, nothing flaggedmax_run_duration: PT30Sonsleep 300(Docker, kind)FAILEDwith reason, downstreamSKIPPEDmax_pending_duration: PT45S, missing image tag (kind)ImagePullBackOff,FAILEDat ~46s, downstreamSKIPPEDPT1M, a → b → c at 40s eachSUCCEEDED, b stopped andFAILED, cSKIPPEDPT10S, orchestrator down for 20s after submitFAILEDat launch with no container, bSKIPPEDCANCELLED, no timeout reasonsoon,30m,PT0SFAILEDat launchPT1SlimitFound and fixed along the way: the Docker launcher returns a naive start time, which made the run check raise
TypeError(SYSTEM_ERROR). It is now treated as UTC, with a unit test.Related
Overlaps #292 (one global pending timeout, ending as
SYSTEM_ERROR). This one is per task and adds a run limit. Happy to rebase on #292 or the other way round.🤖 Generated with Claude Code