Repository navigation
[serve] Avoid rolling replicas for no-op config overrides - #63034
Merged
abrarsheikh merged 7 commits intoMay 12, 2026
Merged
abrarsheikh merged 7 commits into
abrarsheikh merged 7 commits into
Conversation
Signed-off-by: harshit <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request prevents unnecessary rolling updates in Ray Serve by avoiding the materialization of empty runtime_env dictionaries in actor options, which ensures the configuration hash remains unchanged when no environment overrides are present. It also introduces integration and unit tests to verify that explicitly setting the default number of replicas does not trigger a restart. Feedback was provided to improve the robustness of temporary file cleanup within the test suite.
Signed-off-by: harshit <[email protected]>
Signed-off-by: harshit <[email protected]>
This reverts commit 8772bc8. Signed-off-by: harshit <[email protected]>
harshit-anyscale
marked this pull request as ready for review
April 30, 2026 13:28
Signed-off-by: harshit <[email protected]>
abrarsheikh
approved these changes
May 12, 2026
Lucas61000
pushed a commit
to Lucas61000/ray
that referenced
this pull request
May 15, 2026
…t#63034) ## Summary - Avoid materializing an empty `runtime_env` while applying declarative deployment overrides. - Preserve replica actor options when a YAML config lists a deployment without changing actor runtime options. - Add unit and CLI regression coverage to ensure no-op YAML deployment overrides do not roll replicas. ## Root Cause Before this change, the declarative config override path ran the runtime env merge for every deployment listed in the YAML `deployments` section. Even a deployment entry that only named the deployment, with no runtime env changes, could cause `override_runtime_envs_except_env_vars({}, {})` to produce `runtime_env: {"env_vars": {}}`. That extra empty runtime env was written into `ray_actor_options`, changing the deployment version actor-options hash and causing Serve to roll replicas even though the effective actor configuration did not change. ## Testing Tested locally: - `python -m py_compile python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.py` - `git diff --check -- python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.py` - Commit hooks also ran successfully, including ruff, black, pydoclint, import-order checks, and related linters. --------- Signed-off-by: harshit <[email protected]>
alexandrplashchinsky
pushed a commit
to alexandrplashchinsky/ray-alex
that referenced
this pull request
May 29, 2026
…t#63034) ## Summary - Avoid materializing an empty `runtime_env` while applying declarative deployment overrides. - Preserve replica actor options when a YAML config lists a deployment without changing actor runtime options. - Add unit and CLI regression coverage to ensure no-op YAML deployment overrides do not roll replicas. ## Root Cause Before this change, the declarative config override path ran the runtime env merge for every deployment listed in the YAML `deployments` section. Even a deployment entry that only named the deployment, with no runtime env changes, could cause `override_runtime_envs_except_env_vars({}, {})` to produce `runtime_env: {"env_vars": {}}`. That extra empty runtime env was written into `ray_actor_options`, changing the deployment version actor-options hash and causing Serve to roll replicas even though the effective actor configuration did not change. ## Testing Tested locally: - `python -m py_compile python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.py` - `git diff --check -- python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.py` - Commit hooks also ran successfully, including ruff, black, pydoclint, import-order checks, and related linters. --------- Signed-off-by: harshit <[email protected]> Signed-off-by: Alexandr Plashchinsky <[email protected]>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runtime_envwhile applying declarative deployment overrides.Root Cause
Before this change, the declarative config override path ran the runtime env merge for every deployment listed in the YAML
deploymentssection. Even a deployment entry that only named the deployment, with no runtime env changes, could causeoverride_runtime_envs_except_env_vars({}, {})to produceruntime_env: {"env_vars": {}}.That extra empty runtime env was written into
ray_actor_options, changing the deployment version actor-options hash and causing Serve to roll replicas even though the effective actor configuration did not change.Testing
Tested locally:
python -m py_compile python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.pygit diff --check -- python/ray/serve/_private/application_state.py python/ray/serve/tests/unit/test_application_state.py python/ray/serve/tests/test_cli.py