Repository navigation
Conversation
Signed-off-by: galleonli <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces support for the STRICT_SPREAD resource request strategy in the default autoscaling coordinator by annotating forwarded resource bundles with a unique implicit resource per requester, ensuring the autoscaler schedules them on distinct nodes. It also adds comprehensive unit tests to verify scheduling, resource preservation, and cleanup. The feedback suggests hashing the requester_id when generating the implicit resource name to prevent potential parsing or length issues in the raylet if the ID contains special characters.
| spread_resource = ( | ||
| f"{ray._raylet.IMPLICIT_RESOURCE_PREFIX}" | ||
| f"autoscaling_coordinator_spread_{requester_id}" | ||
| ) |
There was a problem hiding this comment.
If requester_id contains special characters (such as spaces, slashes, or other non-alphanumeric characters) or is excessively long, it could cause parsing issues or unexpected behavior in the autoscaler or raylet when used directly as part of a resource name. To ensure robustness, consider hashing the requester_id (e.g., using MD5) to guarantee a safe, alphanumeric, and fixed-length resource name.
import hashlib
hashed_id = hashlib.md5(requester_id.encode("utf-8")).hexdigest()
spread_resource = (
f"{ray._raylet.IMPLICIT_RESOURCE_PREFIX}"
f"autoscaling_coordinator_spread_{hashed_id}"
)Signed-off-by: Mark Towers <[email protected]>
|
This pull request has been automatically marked as stale because it has not had 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. |
|
Thanks for the fix, while it looks good, I've reverted #66002 for the time being. Therefore, I'll close this and might reopen in the future |
Description
Preserve
STRICT_SPREADwhen the AutoscalingCoordinator forwards resource requests to the autoscaler. Without the placement constraint, four one-GPU workers can be considered satisfied by one eight-GPU node, while Train's reservation still needs four distinct nodes and cannot become ready.Add a per-requester implicit resource to each forwarded bundle. Both autoscalers treat an implicit resource as having capacity one per node, so bundles from the same requester must use different nodes. Separate requesters can still share nodes when their CPU/GPU requirements fit.
Only the forwarded copies receive this resource. Reservations, worker resources, selectors, and Train's node pinning remain unchanged. Cancellation and expiration remove the constraint with the request.
Related issues
Fixes #66766.
Checked the neighboring Train changes in #66762 and #66763. Those address reservation snapshots and waiting for resources; this change addresses the topology missing from the autoscaling demand, without changing the Train startup path.
Additional information
The new regression cases fail on the unchanged implementation: 5 failed, 8 passed. With this change, the final related-module run passed all 101 tests, including the 13 new cases:
All applicable pre-commit hooks passed on the two changed files, as did
git diff --checkbefore staging. Coverage includes both autoscaler planners, other placement strategies, concurrent requesters, selector preservation, and request cleanup.A separate local CPU probe also passed the GCS request round trip, V2 planning, fixed/elastic policy readiness, and placement-group tasks on three distinct reserved nodes. Node provisioning and Train client communication were substituted in that probe. Cloud autoscaling, a complete
Trainer.fit(), GPU execution, and performance were not tested.Validation used macOS arm64, Python 3.12.3, and an isolated Ray 3.0.0.dev0 environment with local Python sources at
1a9ba71plus this patch. The official nightly native wheel is froma8e9860; this was not a source-matched native build.AI assistance was used for analysis, implementation, regression tests, and drafting this description.