Repository navigation
[train] Add end-to-end scheduling tests for Train V2 worker placement - #67421
Merged
pseudo-rnd-thoughts merged 3 commits intoOct 27, 2026
Conversation
…oordinator's view is wrong Train V2 sizes its worker group from the AutoscalingCoordinator's reservation, which is built from each node's total capacity, counts draining nodes as alive, and is recomputed from scratch when nodes join or leave. Pinning workers to that reservation (ray-project#66002, reverted in ray-project#67337) turned each of the following into a run that retried the same pins forever. These tests assert that the run starts and finishes instead: - Capacity held outside the coordinator: an actor holds node X's slot. The run must start on node Y. - Draining node: X is draining after a preemption notice and is still reported alive. The run must start on Y. - Node churn with two runs: a node joins and sorts first, then the node of the second run is removed. The second run must restart on the new node without disturbing the first, and both must finish. - STRICT_SPREAD on an autoscaling cluster (ray-project#66766): the autoscaler must launch one node per worker, and the run must start on two nodes. Each run's driver and controller stay on the head node, so the scenarios can drain and remove worker nodes. Against the code before the revert, the occupied and draining tests time out, the churn test's second run loops on WorkerGroupStartupTimeoutError while the new node sits free, and the STRICT_SPREAD run waits forever on a reservation that covers one node. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mark Towers <[email protected]>
pseudo-rnd-thoughts
force-pushed
the
train-autoscaler/scheduling-regression-tests
branch
from
October 27, 2026 10:08
e6704bc to
3eb6a6b
Compare
…eing, release and STRICT_PACK cases The tests check scheduling cases Train V2 must handle, so they belong with the existing placement tests rather than in a file of their own. - Merge the occupied-node and draining-node tests into one parametrized test, test_starts_when_a_node_is_unusable. - Add test_runs_queue_for_a_single_slot: a run waiting for a slot another run holds keeps retrying, then starts on that node once it frees up. - Add test_a_finished_run_releases_its_resources: a finished run gives back its placement group and its coordinator request, so a new request at the same priority gets the slot and a second run lands on the same node. - Add test_strict_pack_starts_on_an_autoscaling_cluster: the autoscaler launches a node with room for every STRICT_PACK worker. - The PACK/SPREAD and label-selector tests don't change their cluster, so they share one class-scoped cluster instead of starting five. - Remove the test_scheduling_regressions target and make test_scheduling large. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mark Towers <[email protected]>
pseudo-rnd-thoughts
marked this pull request as ready for review
October 27, 2026 14:25
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the test_scheduling target size to large and introduces a comprehensive set of new tests in test_scheduling.py to verify scheduling behavior under various cluster scenarios, including node churn, resource queuing, and autoscaling. A critical issue was identified in the _drain helper function, where GcsClient.drain_node is passed a hex string node_id instead of its binary representation, which will cause a TypeError.
Signed-off-by: Mark Towers <[email protected]>
This was referenced Oct 27, 2026
liulehui
approved these changes
Oct 27, 2026
justinyeh1995
pushed a commit
to justinyeh1995/ray
that referenced
this pull request
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds end-to-end scheduling tests to
python/ray/train/v2/tests/test_scheduling.py. They check that a Train V2 run still starts and finishes in cases the existing tests don't cover.Most existing Train scheduling tests stub the AutoscalingCoordinator. Its view of the cluster can be wrong in three ways:
ray.nodes()reports as alive, which includes draining nodes.The pinning in #66002, reverted in #67337, turned the first three cases below into runs that retried forever, and no test noticed.
test_starts_when_a_node_is_unusable[slot_held_outside_the_coordinator]slotis held by an actor that never registered with the coordinatortest_starts_when_a_node_is_unusable[draining]Alivetest_concurrent_runs_survive_node_churntest_runs_queue_for_a_single_slottest_a_finished_run_releases_its_resourcestest_strict_spread_starts_on_an_autoscaling_clusterAutoscalingCluster(autoscaler v2) with no worker nodestest_strict_pack_starts_on_an_autoscaling_clusterImplementation notes:
TestOnSharedCluster, instead of starting five. A module-scoped cluster would stay up while the other tests start their own.RAY_TRAIN_WORKER_GROUP_START_TIMEOUT_S=5, so failed attempts cycle quickly.ray.cloudpickle.register_pickle_by_value, so workers don't need to import it.GPU: 0on the head. Otherwise, on a host with a GPU, for example a Mac, Ray detects one on the head, and STRICT_SPREAD then needs one launched node fewer. That hides the bug.exclusive, whichAutoscalingClusterneeds because it runsray stop --force. Its size goes frommediumtolarge.Not covered here. These belong with the fixes in #67422 that make them pass:
The coordinator's priority ordering, Train at HIGH ahead of Ray Data, has no unit test yet either.
AI assistance (Claude Code) was used to write these tests, check them against broken code, and write this description.
🤖 Generated with Claude Code