Skip to content

[Data] Add max_task_concurrency, min_scheduling_resources, and per_task_resource_allocation#56381

Merged
bveeramani merged 3 commits intomasterfrom
po-methods
Sep 9, 2025
Merged

[Data] Add max_task_concurrency, min_scheduling_resources, and per_task_resource_allocation#56381
bveeramani merged 3 commits intomasterfrom
po-methods

Conversation

@bveeramani
Copy link
Member

@bveeramani bveeramani commented Sep 9, 2025

Why are these changes needed?

Adds three new methods to the PhysicalOperator interface to clarify resource usage and scheduling semantics:

  • per_task_resource_allocation – logical resources required per task (task-level granularity).
  • max_task_concurrency – maximum number of tasks allowed to run concurrently, if the operator enforces one.
  • min_scheduling_resources – minimum resource bundle required to schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare resource requirements, making scheduling behavior easier to reason about and extend.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@bveeramani bveeramani requested a review from a team as a code owner September 9, 2025 17:24
Copy link
Contributor

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

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 three new methods to the PhysicalOperator interface: per_task_resource_allocation, max_task_concurrency, and min_scheduling_resources. These methods aim to clarify resource usage and scheduling semantics. The changes are well-implemented in the base class and in ActorPoolMapOperator and TaskPoolMapOperator. My review includes a suggestion to refactor a small portion of the code in ActorPoolMapOperator for better conciseness and maintainability by leveraging an existing helper method.

res[logical_op_id] = logical_op._get_args()
return res

# TODO(@balaji): Disambiguate this with `incremental_resource_usage`.
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for this TODO

Copy link
Contributor

@iamjustinhsu iamjustinhsu left a comment

Choose a reason for hiding this comment

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

looks fine, remember to do the TODO pls. Also, for scaling down by max_concurrency, idk if this would be clearer, but maybe you could do something like this?

res = ExecutionResources(
            cpu=per_actor_resource_usage.cpu,
            gpu=per_actor_resource_usage.gpu,
            memory=per_actor_resource_usage.memory,
            object_store_memory=per_actor_resource_usage.object_store_memory,
        )
        return res.scale(1 / max_concurrency)

@ray-gardener ray-gardener bot added docs An issue or change related to documentation performance data Ray Data-related issues labels Sep 9, 2025
@bveeramani bveeramani enabled auto-merge (squash) September 9, 2025 19:14
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Sep 9, 2025
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@github-actions github-actions bot disabled auto-merge September 9, 2025 19:17
@bveeramani bveeramani enabled auto-merge (squash) September 9, 2025 19:29
@github-actions github-actions bot disabled auto-merge September 9, 2025 19:29
@bveeramani bveeramani merged commit cd767bd into master Sep 9, 2025
6 checks passed
@bveeramani bveeramani deleted the po-methods branch September 9, 2025 20:51
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Sep 10, 2025
…er_task_resource_allocation` (ray-project#56381)

<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Adds three new methods to the PhysicalOperator interface to clarify
resource usage and scheduling semantics:
* `per_task_resource_allocation` – logical resources required per task
(task-level granularity).
* `max_task_concurrency` – maximum number of tasks allowed to run
concurrently, if the operator enforces one.
* `min_scheduling_resources` – minimum resource bundle required to
schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare
resource requirements, making scheduling behavior easier to reason about
and extend.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
ZacAttack pushed a commit to ZacAttack/ray that referenced this pull request Sep 24, 2025
…er_task_resource_allocation` (ray-project#56381)

<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Adds three new methods to the PhysicalOperator interface to clarify
resource usage and scheduling semantics:
* `per_task_resource_allocation` – logical resources required per task
(task-level granularity).
* `max_task_concurrency` – maximum number of tasks allowed to run
concurrently, if the operator enforces one.
* `min_scheduling_resources` – minimum resource bundle required to
schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare
resource requirements, making scheduling behavior easier to reason about
and extend.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
Signed-off-by: zac <zac@anyscale.com>
dstrodtman pushed a commit to dstrodtman/ray that referenced this pull request Oct 6, 2025
…er_task_resource_allocation` (ray-project#56381)

<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Adds three new methods to the PhysicalOperator interface to clarify
resource usage and scheduling semantics:
* `per_task_resource_allocation` – logical resources required per task
(task-level granularity).
* `max_task_concurrency` – maximum number of tasks allowed to run
concurrently, if the operator enforces one.
* `min_scheduling_resources` – minimum resource bundle required to
schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare
resource requirements, making scheduling behavior easier to reason about
and extend.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
justinyeh1995 pushed a commit to justinyeh1995/ray that referenced this pull request Oct 20, 2025
…er_task_resource_allocation` (ray-project#56381)

<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Adds three new methods to the PhysicalOperator interface to clarify
resource usage and scheduling semantics:
* `per_task_resource_allocation` – logical resources required per task
(task-level granularity).
* `max_task_concurrency` – maximum number of tasks allowed to run
concurrently, if the operator enforces one.
* `min_scheduling_resources` – minimum resource bundle required to
schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare
resource requirements, making scheduling behavior easier to reason about
and extend.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
…er_task_resource_allocation` (ray-project#56381)

<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Adds three new methods to the PhysicalOperator interface to clarify
resource usage and scheduling semantics:
* `per_task_resource_allocation` – logical resources required per task
(task-level granularity).
* `max_task_concurrency` – maximum number of tasks allowed to run
concurrently, if the operator enforces one.
* `min_scheduling_resources` – minimum resource bundle required to
schedule a worker (e.g., task vs. actor).

These methods provide a clearer contract for how operators declare
resource requirements, making scheduling behavior easier to reason about
and extend.

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues docs An issue or change related to documentation go add ONLY when ready to merge, run all tests performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants