[V2] The executor ignores TaskMetadata.timeouts.queued_timeout
Summary
The executor never reads TaskMetadata.timeouts.queued_timeout. A task that sets flyte.Timeout(max_queued_time=...) can wait in QUEUED or WAITING_FOR_RESOURCES indefinitely.
#7307 planned three separate bounds: run time, queue wait, and a total deadline. #7308 added them to the API as a definition, with the backend to follow. flyte-sdk#1019 added them to the SDK, and merging it closed #7307. #7910 then made the executor enforce max_runtime. Nothing enforces queued_timeout yet.
Current behavior
On main (15dc7d4), maxRuntimeFromTaskTemplate reads TaskMetadata.timeout and falls back to timeouts.deadline. No code outside the generated files reads queued_timeout. The field passes validation and then has no effect.
The only related control is the plugin-wide pod-pending-timeout (#4590). It applies to every task in the cluster, and it fails the pod as a retryable system error instead of timing out the attempt.
Expected behavior
The TimeoutStrategy comment defines queued_timeout as the time an attempt spends in QUEUED and WAITING_FOR_RESOURCES before it enters INITIALIZING, reset on each retry. An attempt that exceeds it should end as TIMED_OUT.
The same comment says a "leasor" and a "lease worker" enforce it, but neither exists on main. Should the TaskAction controller enforce it instead, the way #7910 enforces max_runtime?
Motivation
We run GPU tasks through Kueue on autoscaled node pools. When capacity is short, a task can wait hours for a node. Users need to bound two things separately: how long a task may run, and how long it may wait to start. #7910 bounds the first, and nothing bounds the second.
You are correct: as of the latest main, Flyte's executor enforces max_runtime but does not enforce max_queued_time (queued_timeout). The field is present in the API and SDK, but no code in the executor reads or acts on TaskMetadata.timeouts.queued_timeout. As a result, tasks with flyte.Timeout(max_queued_time=...) can remain in QUEUED or WAITING_FOR_RESOURCES indefinitely, and only the global pod-pending-timeout applies, which is not per-task and results in a retryable system error, not a terminal timeout for the attempt. This is consistent with the current code and documentation (source, Flyte Timeout docs, SDK Timeout).
The expected behavior, as described in the TimeoutStrategy comment and user docs, is that max_queued_time should bound the time an attempt spends waiting to start, and exceeding it should end the attempt as TIMED_OUT. However, this enforcement is not implemented yet. The suggestion to have the TaskAction controller enforce max_queued_time (similar to how it enforces max_runtime) is reasonable and aligns with the intended design, but would require new code in the executor. Would you like a step-by-step breakdown of how this could be implemented or more detail on the current enforcement logic?
Sources:
This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.
Mention @herald to ask follow-up questions. See runllm.com for more!
Seems like the queued_timeout isn't being enforced by the executor, leading to tasks potentially waiting indefinitely. Maybe the TaskAction controller should handle this, similar to how it manages max_runtime.