Skip to content

[train] Wait for reserved resources in the fixed scaling policy decision - #66763

Closed
justinvyu wants to merge 1 commit into
justinvyu/train-reservation-pinsfrom
justinvyu/train-fixed-reservation-wait
Closed

justinvyu wants to merge 1 commit into
justinvyu/train-reservation-pinsfrom
justinvyu/train-fixed-reservation-wait

Conversation

@justinvyu

@justinvyu justinvyu commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Stacked on the ResizeDecision pinning PR. That PR has the elastic policy put node pins on its decision. This one moves the fixed policy to the same model, so every policy returns its pins with the decision and the controller no longer polls the coordinator.

  • Fixed waits in its decision. FixedScalingPolicy.make_decision_for_non_running_worker_group returns NoopDecision until the reservation covers every worker (and satisfies STRICT_PACK/STRICT_SPREAD), then returns a ResizeDecision with pins from a fresh snapshot. It skips the wait when pinning doesn't apply (TPU, zero-resource workers, user label_selector).
  • Removed: get_reserved_bundle_label_selectors, its 60s poll loop, the controller fallback and its WorkerGroupStartupTimeoutError raise. ResizeDecision.label_selectors=None now only means "don't pin".
  • Shared log: a rate-limited "Waiting for reserved resources: N/M workers are covered…" log for both policies. Before, elastic logged nothing while the reservation was empty.
  • The non-running control loop yields while waiting. In INITIALIZING/RESTARTING/RESCHEDULING, _step never awaited, so while the policy returned NoopDecision (elastic waiting for min_workers, and now fixed), run() spun without giving up the event loop and calls like abort() couldn't reach the controller actor. _step now sleeps RAY_TRAIN_HEALTH_CHECK_INTERVAL_S before asking again. The new test_waiting_for_a_scaling_decision_yields_the_event_loop hung without this change.

Behavior change: a fixed run waiting for capacity no longer fails and retries every 60s through the failure policy. It waits in the controller loop like elastic does, logging every 30s. With the default controller_failure_limit=-1, the only visible difference is the log messages. A run with a finite limit no longer uses it up while waiting for capacity.

Related issues

Part of a stack:

  1. Pins on ResizeDecision + elastic (base of this PR).
  2. This PR: fixed scaling policy waits for its reservation in the decision.

Testing

All passing locally (macOS, ray_dev_py311), on the top of the stack:

pytest python/ray/train/v2/tests/test_autoscaling_coordinator_client.py \
       python/ray/train/v2/tests/test_elastic_scaling_policy.py \
       python/ray/train/v2/tests/test_controller.py \
       python/ray/train/v2/tests/test_controller_callback_behaviour.py \
       python/ray/train/v2/tests/test_failure_policy.py      # 91 passed
pytest python/ray/train/tests/test_autoscaling_coordinator_client.py   # 12 passed
pytest python/ray/train/v2/tests/test_scheduling.py \
       python/ray/train/v2/tests/test_state.py \
       python/ray/train/v2/tests/test_elastic_e2e.py         # 34 passed
pre-commit run --files <changed files>                      # clean

AI assistance (Claude Code) was used to write this change.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Justin Yu <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 20, 2026
pseudo-rnd-thoughts pushed a commit to pseudo-rnd-thoughts/ray that referenced this pull request Oct 27, 2026
…ecision

In INITIALIZING, RESTARTING and RESCHEDULING, `TrainController._step` never
awaits. While the scaling policy keeps returning `NoopDecision` (an elastic
run waiting for `min_workers` to fit, or a failed coordinator query),
`run()` loops without giving up the event loop. The controller actor then
spins a full core, and calls like `abort()` can't reach it. This has been
the case for elastic runs since elastic training landed; it isn't caused
by the reservation pinning that was reverted.

`_step` now sleeps `RAY_TRAIN_HEALTH_CHECK_INTERVAL_S` before asking the
policy again, matching the running path's poll interval.

Once `abort()` can run during that sleep, the control loop must not
overwrite the `AbortedState` it sets with the state the iteration computed
before the abort, or `run()` would go back to waiting. The loop now leaves a
terminal state set concurrently by `abort()` in place.

The yield is the control-loop change from ray-project#66763, split out so it can land
on its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Mark Towers <[email protected]>
pseudo-rnd-thoughts pushed a commit to pseudo-rnd-thoughts/ray that referenced this pull request Oct 27, 2026
…ecision

In INITIALIZING, RESTARTING and RESCHEDULING, `TrainController._step` never
awaits. While the scaling policy keeps returning `NoopDecision` (an elastic
run waiting for `min_workers` to fit, or a failed coordinator query),
`run()` loops without giving up the event loop. The controller actor then
spins a full core, and calls like `abort()` can't reach it. This has been
the case for elastic runs since elastic training landed; it isn't caused
by the reservation pinning that was reverted.

`_step` now sleeps `RAY_TRAIN_HEALTH_CHECK_INTERVAL_S` before asking the
policy again, matching the running path's poll interval.

Once `abort()` can run during that sleep, the control loop must not
overwrite the `AbortedState` it sets with the state the iteration computed
before the abort, or `run()` would go back to waiting. The loop now leaves a
terminal state set concurrently by `abort()` in place.

The yield is the control-loop change from ray-project#66763, split out so it can land
on its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Mark Towers <[email protected]>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

Please feel free to reopen or open a new pull request if you'd still like this to be addressed.

Again, you can always ask for help on our discussion forum or Ray's public slack channel.

Thanks again for your contribution!

@github-actions github-actions Bot closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant