Repository navigation
[data][actor-only][8/n] Constraint-scheduling release tests - #67704
iamjustinhsu wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces nightly release tests for constraint-aware scheduling (including label-based and placement-group scheduling) under the actor-only backend's operator sizer, along with their cluster compute configurations and test definitions. It also updates the release runner to forward build-level RAY_DATA_ environment variables to the test cluster, backed by new unit tests. The review feedback suggests adding defensive checks to prevent potential AttributeError or KeyError exceptions when handling BYOD runtime environments and querying node information from ray.nodes().
| @@ -296,6 +296,17 @@ def _running_test_script( | |||
| command = test["run"]["script"] | |||
| command_env = test.get_byod_runtime_env() | |||
There was a problem hiding this comment.
If test.get_byod_runtime_env() returns None (e.g., when byod or runtime_env is not defined in the test configuration), calling .setdefault() on command_env will raise an AttributeError. We should defensively initialize command_env to an empty dictionary if it is None.
| command_env = test.get_byod_runtime_env() | |
| command_env = test.get_byod_runtime_env() | |
| if command_env is None: | |
| command_env = {} |
| return sum( | ||
| 1 | ||
| for n in ray.nodes() | ||
| if n["Alive"] and n["Resources"].get("CPU", 0) >= HOG_NUM_CPUS | ||
| ) |
There was a problem hiding this comment.
To prevent potential KeyError or AttributeError if a node dictionary returned by ray.nodes() is missing the "Alive" or "Resources" keys, we should use .get() defensively.
| return sum( | |
| 1 | |
| for n in ray.nodes() | |
| if n["Alive"] and n["Resources"].get("CPU", 0) >= HOG_NUM_CPUS | |
| ) | |
| return sum( | |
| 1 | |
| for n in ray.nodes() | |
| if n.get("Alive", False) and (n.get("Resources") or {}).get("CPU", 0) >= HOG_NUM_CPUS | |
| ) |
| def _gpu_node_ids() -> Dict[str, bool]: | ||
| return { | ||
| n["NodeID"]: n["Resources"].get("GPU", 0) > 0 for n in ray.nodes() if n["Alive"] | ||
| } |
There was a problem hiding this comment.
To prevent potential KeyError or AttributeError if a node dictionary returned by ray.nodes() is missing the "Alive", "NodeID", or "Resources" keys, we should use .get() defensively.
| def _gpu_node_ids() -> Dict[str, bool]: | |
| return { | |
| n["NodeID"]: n["Resources"].get("GPU", 0) > 0 for n in ray.nodes() if n["Alive"] | |
| } | |
| def _gpu_node_ids() -> Dict[str, bool]: | |
| return { | |
| n["NodeID"]: (n.get("Resources") or {}).get("GPU", 0) > 0 | |
| for n in ray.nodes() | |
| if n.get("Alive", False) and "NodeID" in n | |
| } |
04239fd to
a6f531a
Compare
79bf0c8 to
e816c1e
Compare
e816c1e to
44b8804
Compare
44b8804 to
1963d73
Compare
1963d73 to
05f9277
Compare
fa16e51 to
e48a87a
Compare
rayhhome
left a comment
There was a problem hiding this comment.
Just one comment! Should be ready to merge after this gets addressed.
| selector={POOL_LABEL_KEY: "pool_a"}, | ||
| num_cpus=4, | ||
| concurrency=(1, 4), | ||
| expected_max_alive=4, |
There was a problem hiding this comment.
This line seems to lead to the "autoscale_contention" of this test flaky. Each LabeledStage needs 4 CPUs (num_cpus=4 above) and GenStage 1 CPU (map tasks default to 1 CPU). Meanwhile, GenStage's minimum actor pool size is 1 actor (from GEN_CONCURRENCY = (1, 32)).
This means, when the GenStage actor pool needs to shrink, and the last actor ends up on "pool_a", that actor will take up 1 CPU, leaving 15 CPUs left for the LabeledStages. In this case, the maximum number of LabeledStage actors alive is 3 (15/4 = 3.75).
The last GenStage actor also doesn't go away until GenStage has finished all its input and the operator has completed. By then, it's possible that most work has gone through and the labeled stage no longer needs a 4th actor. This would fail the later labeled_max_alive != case["expected_max_alive"] check.
A potential fix would be setting num_cpus above to 3, so that each node can dedicate 6 CPUs to LabeledStage and still have 2 left for GenStage's last actor to fit in.
e48a87a to
4e84751
Compare
4e84751 to
7476a88
Compare
58d7411 to
9c956d4
Compare
## Overview Add new release tests for constraint based scheduling (node labels and placement groups). These are not supported in the task based backend and are a new addition supported in the actor only backend Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]> Co-authored-by: sampan <[email protected]> Co-authored-by: Prasad Palkar <[email protected]>
Signed-off-by: iamjustinhsu <[email protected]>
9c956d4 to
7c6830b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7c6830b. Configure here.
Signed-off-by: iamjustinhsu <[email protected]>
…raint-release-tests Signed-off-by: iamjustinhsu <[email protected]>
…raint-release-tests Signed-off-by: iamjustinhsu <[email protected]>

Summary
Add nightly release tests for constraint-aware scheduling under the actor-only sizer (label-selector pools, a single node, negation, autoscaling contention, and placement groups). Also forward
RAY_DATA_*build environment variables to release test clusters.Part 8 of 12 of the Ray Data actor-only backend stack. Stacked on #67703; review only the top commit. Everything here is gated behind
RAY_DATA_ACTOR_ONLY_BACKEND(off by default) unless noted under After.Before
No release coverage for constraint scheduling under the actor-only backend, and build-level
RAY_DATA_*flags never reach the test cluster.After
RAY_DATA_ACTOR_ONLY_BACKEND=1.glue.pyforwards everyRAY_DATA_*environment variable from the runner into each release test's runtime env. This applies to all release tests; a test's own runtime env value still wins.flowchart TD subgraph Before subgraph BS[Subsystem: release infra] B1[runner env] -.not forwarded.-> B2[test cluster runtime_env] end end subgraph After subgraph AS[Subsystem: release infra] A1[runner env] -->|"RAY_DATA_* (setdefault)"| A2[test cluster runtime_env] A3["dataset_constraint_label_scheduling_{case}, dataset_constraint_pg_scheduling"] end end class A3 added class A1 changed classDef removed fill:#ffcdd2,stroke:#c62828,color:#000 classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 classDef changed fill:#fff9c4,stroke:#f9a825,color:#000Subsystems
release tests / release infra (
ray_release/glue.py); no library codeTesting
pytest release/ray_release/tests/test_config.py release/ray_release/tests/test_glue.py(release requirements venv): 35 passed. This includestest_load_and_validate_test_collection_file, which validates the new release test entries.RAY_DATA_ACTOR_ONLY_BACKEND=1 pytest python/ray/data/tests/actor_only: 348 passed.python -m py_compile release/nightly_tests/dataset/constraint_*.py: OK. The release tests themselves need the release test infrastructure and were not run here.pre-commit runon changed files: clean.Notes
gh pr list --repo ray-project/ray --state open --search "actor-only").🤖 Generated with Claude Code