[iris] Split cluster/backends into backends/platforms/setup#6727
Conversation
Regroup cluster/backends by concern: the pure TaskBackend seams stay in backends/, runtime substrate drivers (GCP/k8s/manual workers, remote exec, worker bootstrap) move to platforms/, and admin bring-up/ops (controllers, factory, vm_lifecycle) move to setup/. This makes one invariant a compile-time fact: nothing in platforms/ or backends/ imports from setup/ (setup/ may import both). Splits gcp/bootstrap.py and manual/provider.py along the worker/controller boundary, relocates the k8s priority-class constants to platforms/k8s/types.py, and renames the pre-existing cluster/setup.py script-generator module to setup_scripts.py to free the setup/ package name. Imports and file locations only; no behavior change.
|
@claude any reason the "setup/controller" modules can't live in platform as well? then we'd cleanly have platform: GCP & K8s setup tooling & "backends": the task dispatch backends. No setup package needed. If this makes sense, please adjust the layout accordingly. |
|
Claude finished @rjpower's task in 1m 39s —— View job Can
|
|
@claude let's merge and keep the module-level controller/worker split. We don't really care so much if another backend can import controller code. The key invariants we want are: backends -> platforms, but never platform -> backend. Thus code that has things like "controller script to boot the cluster with no direct controller module references" is fine for now. |
|
Claude finished @rjpower's task in 9m 21s —— View job Merged
|
| From | To |
|---|---|
setup/factory.py |
platforms/factory.py |
setup/vm_lifecycle.py |
platforms/vm_lifecycle.py |
setup/gcp/controller.py |
platforms/gcp/controller.py |
setup/gcp/controller_bootstrap.py |
platforms/gcp/controller_bootstrap.py |
setup/k8s/controller.py |
platforms/k8s/controller.py |
setup/manual/controller.py |
platforms/manual/controller.py |
All git mv (rename history preserved). Each cloud now reads e.g. platforms/gcp/{workers,controller,worker_bootstrap,controller_bootstrap}.py.
Invariant kept vs dropped
Per your call, the only layering rule enforced is what already held: nothing in platforms/ (or backends/) imports a TaskBackend implementation from backends/ — only the shared backends.protocols / backends.types seam (which platforms/ already depended on). The previous package-level "a backend can't reach controller bring-up code" guarantee is intentionally gone, so a controller bootstrap script with no direct controller-module references is fine. The platforms/__init__.py docstring now states this.
Reference updates
iris.cluster.setup.* → iris.cluster.platforms.* across src (cli/main.py, composer.py, worker/main.py, local_cluster.py, the moved modules' internal imports) and tests (test_config.py, test_platform.py incl. mock.patch targets, test_coreweave.py, test_vm_lifecycle.py, gpu_gang_smoke.py). setup_scripts (the renamed worker setup-script generator) is untouched. Also corrected a stale iris.cluster.setup.cuda_toolchain_setup_script → iris.cluster.setup_scripts.cuda_toolchain_setup_script reference in docs/coreweave.md.
Testing
./infra/pre-commit.py --all-files --fix — all hooks ok. uv run pytest tests/cluster/backends/test_config.py tests/cluster/backends/gcp/test_platform.py tests/cluster/backends/k8s/test_coreweave.py tests/cluster/controller/test_vm_lifecycle.py — 186 passed. Module imports of all moved files verified.
Note: the PR description still describes the old three-tree (
backends/platforms/setup) layout and its package-level invariant — worth a quick edit to match this two-tree result, but I left the description to you since it's your prose.
• branchiris-mb-1-platforms-setup
…ule split Fold the admin/controller bring-up modules from cluster/setup/ into cluster/platforms/, grouped by cloud, instead of a separate sibling package. Worker-side (workers.py) and controller-side (controller.py) modules stay distinct within each cloud, but no longer in separate top-level packages. The only layering invariant kept is: nothing in platforms/ or backends/ imports a TaskBackend implementation from backends/ (only the shared backends.protocols/backends.types seam). We no longer enforce that a backend cannot reach controller bring-up code. Moves: setup/factory.py, setup/vm_lifecycle.py, setup/gcp/controller*.py, setup/k8s/controller.py, setup/manual/controller.py -> platforms/. Also fixes a stale doc reference (setup -> setup_scripts) in coreweave.md. Co-authored-by: Russell Power <rjpower@users.noreply.github.com>
…forms/ (#6920) The ControllerProvider/WorkerInfraProvider protocols and the machine-lifecycle types (handles, status enums, the InfraError hierarchy, network helpers) lived in cluster/backends/ while all their implementations moved to cluster/platforms/ in #6727. Move backends/protocols.py and backends/types.py to platforms/ and rewire every importer (47 files, mechanical path rewrites); backends/ now holds only the TaskBackend implementations (rpc/, k8s/). The backends package re-exports are gone — importers use the defining modules directly, with no compatibility shim. Also refresh the stale protocols.py docstring (it still pointed at providers/gcp/), document platforms/ in architecture.md — which still drew machine lifecycle under backends/ — and correct its claim that the decision kernels do no live I/O: the autoscaler actuates through WorkerInfraProvider. The CLI-private-helper item from the issue was confirmed stale and is intentionally not addressed. Fixes #6914
Regroup
cluster/backends/by concern into sibling trees, with no behavior change:backends/— the pureTaskBackendimplementations (rpc/,k8s/tasks.py) plus the shared protocol seam (protocols.py,types.py).platforms/(new) — runtime substrate drivers:WorkerInfraProviderimpls (gcp/manual workers), cloud-API wrappers (GcpService,CloudK8sService), worker bootstrap, remote-exec health. admin bring-up/ops:ControllerProviderimpls,vm_lifecycle.py, controller bootstrap, the providerfactory.Part of the multi-backend design ([Design] Iris multi-backend: Model D (federation peers + local backend contract) #6718).