Skip to content

Groups on the local runner, control and Kubernetes, through one provider contract (groups.md PR 5) - #613

Merged
winding-lines merged 3 commits into
mainfrom
groups-providers
Nov 28, 2026
Merged

winding-lines merged 3 commits into
mainfrom
groups-providers

Conversation

@winding-lines

Copy link
Copy Markdown
Contributor

PR 5 of docs/groups.md, its last: the provider contract by name, and worker groups on the placements that aren't pools.

  • One environment builder (morca._internal.provider), selected by the provider's name (pool, local, control, kubernetes): cluster_env for a dista head or worker (DISTA_ROLE/HEAD/ADVERTISE/TOKEN/PORT/GROUP, DISTA_WORKER_SLOTS, DISTA_CONNECT_TIMEOUT, and the GPUs), driver_env, local_env (MORCA_WORKERS, MORCA_GROUPS) and gpu_env (MORCA_GRANT_GPUS, CUDA_VISIBLE_DEVICES, which Grant.env now uses). The pool's head and members (worker_cluster), the Kubernetes head, worker and driver pods, and the control host's run all build through it. The variables and their order are unchanged for each existing case (unit tests compare them with the strings the old code wrote).
  • Local runner and control. The run's process forks each group's MAX beside its workers with no group: Tasks.start passes MORCA_GROUPS (gpu=2,io=1) to dista's Runtime(groups=...). The run is admitted as one: its groups' gpus × MAX are part of its request, counted from the scheduler's host (MORCA_HOST_GPUS, else nvidia-smi -L, the first time a run asks for GPUs), held while the process lives, recorded in runs.grant_gpus, and given in MORCA_GRANT_GPUS/CUDA_VISIBLE_DEVICES to the run's process, which all its forked workers share. A run asking for more GPUs than the host has waits: "waiting: needs 2 GPUs, more than the 1 this host grants at most". A group's cpus/memory_gb aren't used there.
  • Kubernetes. Each group's MAX of worker pods, morca-<run>-<start>-worker-<group>-<i> (_ → -), labelled orca.group, with DISTA_GROUP, sized from the group's cpus/memory_gb (the pipeline's where unset) and with nvidia.com/gpu: N in its limits; inside the pod MORCA_GRANT_GPUS/CUDA_VISIBLE_DEVICES are 0..N-1 (empty for a group without GPUs). The groups' pods count towards cpu_millis, the vCPU budget and the fill estimate. The head is made when any group has workers.
  • No scaling off pools: every group gets its MAX for the run's life (the MIN of a range is only used where demand is reported).
  • Warnings. register and config check say for ec2 that its tasks of a group fail and to use a pool instead, and warn about a group's cpus/memory_gb on control. MORCA_GROUPS is reserved in env.
  • Registered.has_tasks (from describe): groups only start workers for a pipeline with dista tasks.
  • No migration: runs.grant_gpus exists since 71.

Behaviour changes:

  • None for a pipeline without groups on any placement: the same variables, pods and admission (pool and Kubernetes env compared in unit tests; test-grants, test-placement, test-run-cluster and kind exercise the ungrouped paths). The scheduler doesn't run nvidia-smi unless a run asks for GPUs.
  • A pipeline with groups on the local runner, control or Kubernetes now gets its groups' workers (before: groups ignored, so tasks of a group failed). On local/control with GPU groups it now waits for the host's GPUs; on a Mac or a host without NVIDIA GPUs that means MORCA_HOST_GPUS must be set.
  • A pipeline's env can no longer set MORCA_GROUPS.
  • An older pipeline binary ignores MORCA_GROUPS (forks no group workers), as before.

Not built after this (as docs/groups.md says): scaling on local and Kubernetes, labels other than GPUs, fractional GPUs, groups from another pool, retiring ec2, the per-placement key table (#369).

Tests: test-grants gains gpufan on the local runner and on control with groups gpu (1..2, a GPU each) and io: held for GPUs on a host with one, then run with three, model tasks only in group gpu workers, plain ones only in the no-group worker, every worker seeing 0,1. Unit tests of the builder per provider, the Kubernetes group pods' env, GPU limits, names and requests, local_groups/local_gpus, the warnings and control's run_env. The grouped Kubernetes pods themselves (with kind) are covered only by unit tests: kind has no GPUs and its image has no grouped pipeline.

🤖 Generated with Claude Code

https://claude.ai/code/session_017TycsyUqdnuDeZrYc3z6wV

winding-lines and others added 3 commits November 28, 2026 08:16
…der contract (groups.md PR 5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycsyUqdnuDeZrYc3z6wV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycsyUqdnuDeZrYc3z6wV
@winding-lines
winding-lines merged commit dd03bb1 into main Nov 28, 2026
36 checks passed
@winding-lines
winding-lines deleted the groups-providers branch November 28, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant