Skip to content

[Core] (Resource Isolation 1/n) Unify resource isolation config construction into a single step#59372

Merged
edoakes merged 13 commits intoray-project:masterfrom
Kunchd:unify_ri_config
Feb 5, 2026
Merged

[Core] (Resource Isolation 1/n) Unify resource isolation config construction into a single step#59372
edoakes merged 13 commits intoray-project:masterfrom
Kunchd:unify_ri_config

Conversation

@Kunchd
Copy link
Copy Markdown
Contributor

@Kunchd Kunchd commented Dec 11, 2025

Description

The existing resource_isolation_config is constructed in two steps.

  1. The class is first instantiated using the constructor.
  2. The construction is complete when add_object_store_memory is called.
    This is undesirable, as forgetting to complete the second step in creating the resource_isolation_config can result in critical system misbehavior.

This PR addresses the TODO to unify the construction of resource isolation config.

Related issues

#57653

Additional information

N/A

@Kunchd Kunchd requested a review from a team as a code owner December 11, 2025 02:51
Copy link
Copy Markdown
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 successfully unifies the construction of ResourceIsolationConfig into a single, more robust step. The refactoring of object store memory calculation into a utility function is a good improvement. The changes are well-implemented and the tests are updated accordingly. I have a couple of minor suggestions to improve the code further.

@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Dec 11, 2025
@Kunchd Kunchd added the go add ONLY when ready to merge, run all tests label Dec 11, 2025
@Kunchd Kunchd changed the title Unify resource isolation config construction into a single step [Core] Unify resource isolation config construction into a single step Dec 11, 2025
Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

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

Changes look good. A few comments around code organization. Let's clean up the get_configured_object_store_memory method in a follow up.

davik and others added 7 commits December 17, 2025 00:40
Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
…s to make sure it is only called once

Signed-off-by: davik <davik@anyscale.com>
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Dec 31, 2025
@Kunchd Kunchd added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Jan 2, 2026
Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for cleaning this up.

We've still got work to do here so can you convert your JIRA into an issue and link the issue to relevant parts of the codebase with TODOs so we don't lose context?

@Kunchd
Copy link
Copy Markdown
Contributor Author

Kunchd commented Feb 2, 2026

Issue to track follow up tech debts exposed by this PR: #60683

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: davik <davik@anyscale.com>
Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

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

🚢

davik and others added 2 commits February 3, 2026 01:08
Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 and found 1 potential issue.


resource_isolation_config = ResourceIsolationConfig(
enable_resource_isolation=enable_resource_isolation,
cgroup_path=_cgroup_path,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Undefined variable _cgroup_path causes NameError

High Severity

The code references _cgroup_path but this variable is never defined. The function parameter is cgroup_path (without underscore, defined at line 1435), but the refactored code incorrectly uses _cgroup_path. This will cause a NameError at runtime when ray.init() is called on the code path that starts a new local cluster.

Fix in Cursor Fix in Web

@Kunchd Kunchd changed the title [Core] Unify resource isolation config construction into a single step [Core] (Resource Isolation 1/n) Unify resource isolation config construction into a single step Feb 4, 2026
Signed-off-by: davik <davik@anyscale.com>
@Kunchd
Copy link
Copy Markdown
Contributor Author

Kunchd commented Feb 4, 2026

@edoakes Could you help me merge this when you get the chance? Thanks!

@edoakes edoakes merged commit 7bf368c into ray-project:master Feb 5, 2026
6 checks passed
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps.
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: tiennguyentony <46289799+tiennguyentony@users.noreply.github.com>
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…ruction into a single step (ray-project#59372)


## Description
The existing `resource_isolation_config` is constructed in two steps.
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: tiennguyentony <46289799+tiennguyentony@users.noreply.github.com>
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…ruction into a single step (ray-project#59372)


## Description
The existing `resource_isolation_config` is constructed in two steps. 
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
…ruction into a single step (#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps. 
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
…ruction into a single step (#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps. 
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Kunchd added a commit to Kunchd/ray that referenced this pull request Feb 17, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps. 
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps.
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
Aydin-ab pushed a commit to kunling-anyscale/ray that referenced this pull request Feb 20, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps. 
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps.
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…ruction into a single step (ray-project#59372)

## Description
The existing `resource_isolation_config` is constructed in two steps.
1. The class is first instantiated using the constructor.
2. The construction is complete when `add_object_store_memory` is
called.
This is undesirable, as forgetting to complete the second step in
creating the `resource_isolation_config` can result in critical system
misbehavior.

This PR addresses the
[TODO](https://github.com/ray-project/ray/blob/b13361a8045632a7c2308ce606b0487f096fd927/python/ray/_private/resource_isolation_config.py#L54-L56)
to unify the construction of resource isolation config.

## Related issues
ray-project#57653

## Additional information
N/A

---------

Signed-off-by: davik <davik@anyscale.com>
Signed-off-by: Kunchen (David) Dai <54918178+Kunchd@users.noreply.github.com>
Co-authored-by: davik <davik@anyscale.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants