feat: Add auto-termination of stuck PENDING container executions after configured timeout#292
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
…r configured timeout
1d41e6b to
77345d3
Compare
|
🤖 This is a clean, well-scoped fix — really nice work. The teardown path is self-contained and easy to follow (terminate → SYSTEM_ERROR → record message → skip downstream → commit), the guards read clearly, and I like that it's opt-in per deployment with On the 12h default — it's a reasonable starting point, and I think it's worth grounding in what we've actually seen rather than picking it by feel. The status-change history is already recorded in each execution's One suggestion for this first version: the termination message is generic ("stuck in PENDING for X"), so from the SYSTEM_ERROR alone an operator can't tell a gcsfuse mount wedge ( |

Summary
Closes https://github.com/Shopify/oasis-backend/issues/422
pending_execution_timeoutto the orchestrator that auto-terminates container executions stuck in PENDING state beyond the threshold (default: disabled, oasis-backend sets 12h)Changes
orchestrator_sql.py: New_terminate_timed_out_pending_executionmethod +_format_durationhelperorchestrator_main_oasis.py: Explicitly passespending_execution_timeout=timedelta(hours=12)tests/test_orchestrator_sql.py: New test file covering timeout termination, no-op when not expired, disabled mode, and RUNNING not affectedContext
Closes https://github.com/Shopify/oasis-backend/issues/422
When a K8s pod fails to schedule (e.g., resource exhaustion, node pool issues), the container execution remains PENDING forever. The orchestrator polls it every sweep cycle but never takes action, wasting batch budget and delaying real executions behind it in the queue.
Test plan
_format_durationat boundary values (seconds/minutes/hours)