Commit 77f12c5
fix(iris): keep tasks in BUILDING until container reaches Running phase (#3106)
## Summary
- Tasks now stay in `BUILDING` until the container runtime reports
`ContainerPhase.RUNNING`, instead of transitioning immediately when
`run()` is called
- For process/docker runtimes this is instant (no behavioral change).
For K8s, tasks wait in BUILDING while pods are in
`Pending`/`ContainerCreating` phase.
- This makes `max_building_tasks_per_worker` actually effective — it now
gates concurrent pod creation instead of just counting tasks that
instantly flip to RUNNING
<details>
<summary>Context</summary>
Stacked on #3105 (ContainerPhase enum). Extracted from the [BUILDING
semantics investigation](#3090).
Without this fix, submitting 20+ tasks to a K8s worker creates all pods
simultaneously. The pod creation storm overwhelmed the controller (4 GiB
memory limit), causing it to crash ~15s after job submission. With
backpressure, only `max_building_tasks_per_worker` (default 4) pods are
created concurrently.
Validated on CW: [workflow run
22498485767](https://github.com/marin-community/marin/actions/runs/22498485767)
— 70+ task transitions observed with 5.2–10.4s BUILDING durations,
controller survived the entire run. See #3090 comment for full findings.
Related: #3102 (controller RBAC/scheduling), #3103 (worker kubectl
saturation)
</details>
## Test plan
- [x] `uv run pytest lib/iris/tests/cluster/worker/
lib/iris/tests/cluster/runtime/test_kubernetes_runtime.py` — 77 passed
- [x] Pre-commit clean
- [ ] CI
- [x] `test_building_backpressure.py` e2e test — passed (20 tasks, peak
building within limit)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 801fac0 commit 77f12c5
File tree
2 files changed
+128
-7
lines changed- lib/iris
- src/iris/cluster/worker
- tests/e2e
2 files changed
+128
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| |||
562 | 563 | | |
563 | 564 | | |
564 | 565 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
| 566 | + | |
569 | 567 | | |
570 | 568 | | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | 569 | | |
575 | 570 | | |
576 | 571 | | |
| |||
625 | 620 | | |
626 | 621 | | |
627 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
628 | 630 | | |
629 | 631 | | |
630 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments