Skip to content

[data][actor-only][8/n] Constraint-scheduling release tests - #67704

Open
iamjustinhsu wants to merge 5 commits into
iamjustinhsu/ao/07-operator-sizerfrom
iamjustinhsu/ao/08-constraint-release-tests
Open

iamjustinhsu wants to merge 5 commits into
iamjustinhsu/ao/07-operator-sizerfrom
iamjustinhsu/ao/08-constraint-release-tests

Conversation

@iamjustinhsu

Copy link
Copy Markdown
Contributor

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

  • Two new nightly tests (one with five matrix cases) run with RAY_DATA_ACTOR_ONLY_BACKEND=1.
  • glue.py forwards every RAY_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:#000
Loading

Subsystems

release tests / release infra (ray_release/glue.py); no library code

Testing

  • pytest release/ray_release/tests/test_config.py release/ray_release/tests/test_glue.py (release requirements venv): 35 passed. This includes test_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 run on changed files: clean.

Notes

  • Not a duplicate: no open ray-project/ray PR covers the actor-only backend (checked with gh pr list --repo ray-project/ray --state open --search "actor-only").
  • AI assistance (Claude Code) was used for this change. I have reviewed every changed line.

🤖 Generated with Claude Code

@iamjustinhsu
iamjustinhsu added this pull request to stack #67709 November 2, 2026 21:02
@iamjustinhsu
iamjustinhsu removed this pull request from stack #67709 November 2, 2026 21:05
@iamjustinhsu
iamjustinhsu added this pull request to stack #67710 November 2, 2026 21:05
@iamjustinhsu iamjustinhsu added the go add ONLY when ready to merge, run all tests label Nov 2, 2026
@iamjustinhsu
iamjustinhsu marked this pull request as ready for review November 2, 2026 21:15
@iamjustinhsu
iamjustinhsu requested a review from a team as a code owner November 2, 2026 21:15

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
command_env = test.get_byod_runtime_env()
command_env = test.get_byod_runtime_env()
if command_env is None:
command_env = {}

Comment on lines +107 to +111
return sum(
1
for n in ray.nodes()
if n["Alive"] and n["Resources"].get("CPU", 0) >= HOG_NUM_CPUS
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
)

Comment on lines +176 to +179
def _gpu_node_ids() -> Dict[str, bool]:
return {
n["NodeID"]: n["Resources"].get("GPU", 0) > 0 for n in ray.nodes() if n["Alive"]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
}

@ray-gardener ray-gardener Bot added data Ray Data-related issues release-test release test labels Nov 3, 2026
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch 3 times, most recently from 04239fd to a6f531a Compare November 6, 2026 00:56
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch 3 times, most recently from 79bf0c8 to e816c1e Compare November 6, 2026 20:34
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from e816c1e to 44b8804 Compare November 10, 2026 19:01
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from 44b8804 to 1963d73 Compare November 10, 2026 21:09
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from 1963d73 to 05f9277 Compare November 12, 2026 17:04

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch 2 times, most recently from fa16e51 to e48a87a Compare November 13, 2026 22:36
@rayhhome rayhhome self-assigned this Nov 16, 2026

@rayhhome rayhhome left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from e48a87a to 4e84751 Compare November 19, 2026 00:41
@richardliaw
richardliaw force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from 4e84751 to 7476a88 Compare November 19, 2026 19:52
@iamjustinhsu
iamjustinhsu force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch 3 times, most recently from 58d7411 to 9c956d4 Compare November 19, 2026 23:22
iamjustinhsu and others added 2 commits November 19, 2026 15:23
## 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]>
@richardliaw
richardliaw force-pushed the iamjustinhsu/ao/08-constraint-release-tests branch from 9c956d4 to 7c6830b Compare November 19, 2026 23:23

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants