Skip to content

call reconfigure on rank changes#57091

Merged
zcin merged 5 commits intomasterfrom
57048-abrar-rank
Oct 9, 2025
Merged

call reconfigure on rank changes#57091
zcin merged 5 commits intomasterfrom
57048-abrar-rank

Conversation

@abrarsheikh
Copy link
Copy Markdown
Contributor

@abrarsheikh abrarsheikh commented Oct 1, 2025

This change ensures that reconfigure is invoked with both user_config and rank under the following conditions:

  1. The user has implemented reconfigure, and redeploys with an updated user_config.
  2. The user has implemented reconfigure, the replica rank changes, user has rank as param in the reconfigure method signature, and deployment_config contains a user_config.

Reconfigure is also invoked at replica startup if, user has implemented reconfigure and has provided some user_config

fixes #57048

Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh requested a review from a team as a code owner October 1, 2025 15:44
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Oct 1, 2025
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 introduces a useful feature to trigger reconfigure on replica rank changes, controlled by a new environment variable. The implementation is mostly solid, and the new tests cover the functionality well. However, I've identified a potential backward compatibility issue where the change to the reconfigure method's signature could break existing user deployments. I've suggested a fix to inspect the method signature to avoid this. I also found a minor inaccuracy in a test comment that I've proposed correcting for clarity.

# NOTE(edoakes): there is the possibility of a race condition in user code if
# they don't have any form of concurrency control between `reconfigure` and
# other methods. See https://github.com/ray-project/ray/pull/42159.

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.

👍

@kouroshHakha
Copy link
Copy Markdown
Contributor

Logic and flag makes sense. I'll let @zcin and others more familiar with the codebase to review the actual implementation.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
cursor[bot]

This comment was marked as outdated.

@ray-gardener ray-gardener bot added the serve Ray Serve Related Issue label Oct 1, 2025
Copy link
Copy Markdown
Contributor

@landscapepainter landscapepainter left a comment

Choose a reason for hiding this comment

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

lgtm


# NOTE(abrar): The only way to subscribe to rank changes is to provide some user config.
# We can relax this in the future as more usecases arise for rank. I am reluctant to
# introduce behavior change for a feature we might not need.
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.

Suggested change
# introduce behavior change for a feature we might not need.
# introduce behavior change for a feature we might not need.

Are we explicitly mentioning this as we might remove the rank feature if not needed in the future? If so, maybe should be more explicit about how it potentially can be removed?

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.

might remove the rank feature if not needed in the future?

Not really, i am saying that we can call reconfigure even if user_config is not provided in future.

@zcin zcin merged commit 6182349 into master Oct 9, 2025
5 of 6 checks passed
@zcin zcin deleted the 57048-abrar-rank branch October 9, 2025 23:33
pavitrabhalla pushed a commit to superserve-ai/ray that referenced this pull request Oct 10, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`

fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Pavitra Bhalla <pavitra@rayai.com>
joshkodi pushed a commit to joshkodi/ray that referenced this pull request Oct 13, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`

fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Josh Kodi <joshkodi@gmail.com>
ArturNiederfahrenhorst pushed a commit to ArturNiederfahrenhorst/ray that referenced this pull request Oct 13, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`


fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
harshit-anyscale pushed a commit that referenced this pull request Oct 15, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`


fixes #57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
justinyeh1995 pushed a commit to justinyeh1995/ray that referenced this pull request Oct 20, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`


fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
xinyuangui2 pushed a commit to xinyuangui2/ray that referenced this pull request Oct 22, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`

fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: xgui <xgui@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Oct 23, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`


fixes #57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`


fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`

fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
This change ensures that `reconfigure` is invoked with both
`user_config` and `rank` under the following conditions:

1. The user has implemented `reconfigure`, and redeploys with an updated
`user_config`.
2. The user has implemented `reconfigure`, the replica rank changes,
user has rank as param in the `reconfigure` method signature, and
`deployment_config` contains a `user_config`.

Reconfigure is also invoked at replica startup if, user has implemented
`reconfigure` and has provided some `user_config`

fixes ray-project#57048

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Serve] Replica ranks not reset on redeployment without shutdown

5 participants