Skip to content

Commit 7731df4

Browse files
committed
Review fixes: remove cast() calls, add debug_report to FakePlatform, remove dead code, fix stale doc paths
1 parent 7a5e457 commit 7731df4

8 files changed

Lines changed: 18 additions & 22 deletions

File tree

lib/iris/TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ types even in startup-polling loops.
118118
`@pytest.mark.e2e`.
119119
- Docker-dependent tests must also be marked `@pytest.mark.docker`.
120120
- E2E tests live in `tests/e2e/`.
121-
- Shared fakes live in `tests/cluster/platform/fakes.py` or
121+
- Shared fakes live in `tests/providers/fakes.py` or
122122
`src/iris/test_util.py`. Do not duplicate fakes across files.
123123

124124
## Protocols

lib/iris/docs/autoscaler-fix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ elif availability.status == GroupAvailability.AT_MAX_SLICES:
712712
```bash
713713
cd lib/iris
714714
uv run pytest tests/cluster/controller/test_autoscaler.py -x -v
715-
uv run pytest tests/cluster/platform/test_scaling_group.py -x -v
715+
uv run pytest tests/providers/test_scaling_group.py -x -v
716716
uv run pytest -m 'not slow' -x
717717
```
718718

lib/iris/docs/coreweave.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ The platform detects fatal errors before the full timeout expires:
362362
### Cluster startup (`iris cluster start`)
363363

364364
`CoreweavePlatform.start_controller()` orchestrates the full startup sequence.
365-
See `lib/iris/src/iris/cluster/platform/coreweave.py`.
365+
See `lib/iris/src/iris/providers/k8s/coreweave.py`.
366366

367367
1. Apply RBAC prerequisites (Namespace, ServiceAccount, ClusterRole `iris-controller-{ns}`, ClusterRoleBinding `iris-controller-{ns}`)
368368
2. Create S3 credentials Secret (if S3 storage configured)
@@ -579,8 +579,8 @@ instantly. Fix in config and redeploy.
579579

580580
| File | Description |
581581
|------|-------------|
582-
| `lib/iris/src/iris/cluster/platform/coreweave.py` | CoreWeave platform implementation (includes `ensure_rbac()`) |
582+
| `lib/iris/src/iris/providers/k8s/coreweave.py` | CoreWeave platform implementation (includes `ensure_rbac()`) |
583583
| `lib/iris/src/iris/cluster/runtime/kubernetes.py` | KubernetesRuntime (Pod-per-task) |
584-
| `lib/iris/src/iris/cluster/k8s/kubectl.py` | Kubectl CLI wrapper |
584+
| `lib/iris/src/iris/providers/k8s/service.py` | Kubectl CLI wrapper |
585585
| `lib/iris/examples/coreweave.yaml` | Example cluster config |
586586
| `lib/iris/AGENTS.md` | CoreWeave integration notes for agents |

lib/iris/docs/image-push.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ docker pull us-docker.pkg.dev/hai-gcp-models/ghcr-mirror/marin-community/iris-wo
124124

125125
## Code
126126

127-
- **Rewrite logic**: `lib/iris/src/iris/cluster/platform/bootstrap.py`
127+
- **Rewrite logic**: `lib/iris/src/iris/providers/bootstrap.py`
128128
- `zone_to_multi_region()`: maps GCP zone → continent (`us`, `europe`, `asia`)
129129
- `rewrite_ghcr_to_ar_remote()`: rewrites `ghcr.io/...``{continent}-docker.pkg.dev/.../ghcr-mirror/...`
130130
- **Autoscaler**: `_per_group_bootstrap_config()` rewrites the worker image per scale group

lib/iris/src/iris/providers/base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,6 @@ def default_stop_all(
527527
for s in all_slices:
528528
targets.append((f"slice:{s.slice_id}", s.terminate))
529529

530-
if not targets:
531-
logger.info("No resources to terminate")
532-
return target_names
533-
534530
logger.info("Terminating %d resource(s) in parallel", len(targets))
535531

536532
errors: list[str] = []

lib/iris/src/iris/providers/factory.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""Factory for creating Platform and ControllerLifecycle instances from cluster configuration."""
1919

2020
from dataclasses import dataclass
21-
from typing import cast
2221

2322
from iris.providers.base import ControllerLifecycle, Platform
2423
from iris.providers.k8s.coreweave import CoreweaveControllerLifecycle, CoreweavePlatform
@@ -79,8 +78,8 @@ def create_platform_bundle(
7978
ssh_config=ssh_config,
8079
)
8180
return PlatformBundle(
82-
platform=cast(Platform, gcp_platform),
83-
lifecycle=cast(ControllerLifecycle, GcpControllerLifecycle(platform=gcp_platform)),
81+
platform=gcp_platform,
82+
lifecycle=GcpControllerLifecycle(platform=gcp_platform),
8483
)
8584

8685
if which == "manual":
@@ -89,8 +88,8 @@ def create_platform_bundle(
8988
ssh_config=ssh_config,
9089
)
9190
return PlatformBundle(
92-
platform=cast(Platform, manual_platform),
93-
lifecycle=cast(ControllerLifecycle, ManualControllerLifecycle(platform=manual_platform)),
91+
platform=manual_platform,
92+
lifecycle=ManualControllerLifecycle(platform=manual_platform),
9493
)
9594

9695
if which == "local":
@@ -102,8 +101,8 @@ def create_platform_bundle(
102101
gcp_service=gcp_service,
103102
)
104103
return PlatformBundle(
105-
platform=cast(Platform, local_platform),
106-
lifecycle=cast(ControllerLifecycle, GcpControllerLifecycle(platform=local_platform)),
104+
platform=local_platform,
105+
lifecycle=GcpControllerLifecycle(platform=local_platform),
107106
)
108107

109108
if which == "coreweave":
@@ -112,8 +111,8 @@ def create_platform_bundle(
112111
label_prefix=label_prefix,
113112
)
114113
return PlatformBundle(
115-
platform=cast(Platform, cw_platform),
116-
lifecycle=cast(ControllerLifecycle, CoreweaveControllerLifecycle(platform=cw_platform)),
114+
platform=cw_platform,
115+
lifecycle=CoreweaveControllerLifecycle(platform=cw_platform),
117116
)
118117

119118
raise ValueError(f"Unknown platform: {which}")

lib/iris/tests/providers/fakes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,11 @@ def list_vms(self, zones: list[str], labels: dict[str, str] | None = None) -> li
325325
def tunnel(self, address: str, local_port: int | None = None):
326326
return nullcontext(address)
327327

328+
def debug_report(self) -> None:
329+
pass
330+
328331
def shutdown(self) -> None:
329-
"""No-op: FakePlatform has no background threads to stop."""
332+
pass
330333

331334
def tick(self, ts: int | None = None) -> None:
332335
"""Advance all slice state transitions.

lib/iris/tests/providers/manual/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)