Repository navigation
[train] Add Elastic Training Capability for Ray Train - #60721
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a prototype for elastic training in Ray Train, which is a great addition. The core logic is implemented in the new ElasticScalingPolicy, which interacts with the AutoscalingCoordinator to dynamically adjust the number of workers based on available cluster resources. The changes to ScalingConfig to support a (min_workers, max_workers) tuple for num_workers are well-designed and include good validation logic. The accompanying tests are comprehensive and cover many important scenarios.
I've found a critical issue in the error handling logic that could suppress exceptions, and a validation gap that allows negative worker counts. My review includes suggestions to address these points. Overall, this is a solid foundation for the elastic training feature.
c6163ca to
8c3e611
Compare
justinvyu
left a comment
There was a problem hiding this comment.
Thanks, let's add the one ray.get() timeout in the code sending the resource request.
Also, let's file some tickets to also add a user guide and port over the release test.
SG! done adding the timeout, for ticket see this epic: https://anyscale1.atlassian.net/browse/TRAIN-874 |
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
0aa6ff2 to
2123ab4
Compare
Signed-off-by: Lehui Liu <[email protected]>
) This PR adds the Elastic Training capability in Ray Train. 1. we add a new `ElasticScalingPolicy` that can take `ScalingConfig(num_workers=(2,4))` 2. `ElasticScalingPolicy` talks with `AutoScalingCoordinator` to decide the number of possible workers in the cluster to launch with the worker group. 3. elastic training will be automatically enabled if user passed in num_workers=(2,4). 4. added corresponding unit test coverage --------- Signed-off-by: Lehui Liu <[email protected]> Signed-off-by: Adel Nour <[email protected]>
) This PR adds the Elastic Training capability in Ray Train. 1. we add a new `ElasticScalingPolicy` that can take `ScalingConfig(num_workers=(2,4))` 2. `ElasticScalingPolicy` talks with `AutoScalingCoordinator` to decide the number of possible workers in the cluster to launch with the worker group. 3. elastic training will be automatically enabled if user passed in num_workers=(2,4). 4. added corresponding unit test coverage --------- Signed-off-by: Lehui Liu <[email protected]>
…d fix the elastic node-killing release test (#67478) ## Description This PR fixes two issues with the controller. 1. **Controller busy-wait:** In `INITIALIZING`, `RESTARTING` and `RESCHEDULING`, `TrainController._step` never awaits, yielding the event loop. While the scaling policy keeps returning `NoopDecision` (an elastic run waiting for `min_workers` to fit, or a failed coordinator query), `run()` loops without yielding the event loop meaning that the controller actor spins a full core and that an `abort()` can't reach it, so Ctrl-C on the driver doesn't stop the run. This has been true for elastic runs since #60721. This PR updates `_step` to 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 set with the state computed before the abort, so a terminal state set concurrently is left in place. 2. **Elastic node-killing release test:** `terminate_node` in `elastic_util.py` runs its killer task on the node it terminates, with hard affinity and default retries. When the task dies with the node, Ray retries it, and the retry can never be scheduled, so `ray.get` raises `TaskUnschedulableError` and `train_elastic_e2e_with_node_killing` fails after training already succeeded (failure mode A). The killer task is no longer retried, and `NodeDiedError`, `WorkerCrashedError` and `TaskUnschedulableError` count as the node having gone down. New test: `test_abort_while_waiting_for_a_scaling_decision` in `test_controller.py`. It raises `TimeoutError` without the fix. The end-to-end version, `test_ctrl_c_aborts_a_run_waiting_for_workers` (a real driver process receiving SIGINT), is in #67481. AI assistance (Claude Code) was used to write these changes and tests, run the suites, and write this description. --------- Signed-off-by: Mark Towers <[email protected]> Co-authored-by: Mark Towers <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Description
This PR adds the Elastic Training capability in Ray Train.
ElasticScalingPolicythat can takeScalingConfig(num_workers=(2,4))ElasticScalingPolicytalks withAutoScalingCoordinatorto decide the number of possible workers in the cluster to launch with the worker group.Related issues
Additional information
Tested on Anyscale platform:
https://console.anyscale-staging.com/cld_kvedZWag2qA8i5BjxUevf5i7/prj_92c7b71w55flm6gv6imv4m6vqg/workspaces/expwrk_ab5kfa4v9ci15t56dbr8rhmks3/train/train/f5fa9fc5f8d94dc0bd7b545876d660ab?workspace-tab=ray-turbo-dashboard&command-history-section=application_logs