Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[serve] Add support for deploy refactor #34845

Merged
merged 14 commits into from
May 1, 2023

Conversation

zcin
Copy link
Contributor

@zcin zcin commented Apr 28, 2023

Why are these changes needed?

Some preparation for upcoming deploy refactor PRs.

  • Rename fields of ApplicationState as private fields
  • Add route prefix to deployment info (it will be used by application state to deploy deployments in a reconciler loop)
  • Stop setting num replicas from autoscaling in deployment_config.num_replicas, instead put it in a separate field of deployment info.
  • determine initial autoscaled num replicas in deployment state manager .deploy()

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

zcin added 6 commits April 27, 2023 17:12
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
@zcin zcin marked this pull request as ready for review April 28, 2023 14:27
Copy link
Contributor

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

LGTM just nits

python/ray/serve/_private/application_state.py Outdated Show resolved Hide resolved
Comment on lines 219 to 220
app_state_manager.deployment_state_manager.set_deployment_statuses_healthy(0)
app_state_manager._deployment_state_manager.set_deployment_statuses_healthy(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

ugly that we need to reach into a private field (but not a huge deal)

is there a better way to structure the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stored the mock deployment state manager into a variable before passing to app state manager and used that instead in the tests - lmk if that looks better

cls, info: DeploymentInfo, *, deleting: bool = False
cls,
info: DeploymentInfo,
autoscaled_num_replicas: int = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please add a docstring that describes what this field is and how it interacts with the deployment info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per Sihan's suggestion, removed it and placed into deployment info

def _set_target_state(self, target_info: DeploymentInfo) -> None:
def _set_target_state(
self, target_info: DeploymentInfo, autoscaled_num_replicas: int = None
) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you write comment what does it mean when autoscaled_num_replicas is None?

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: targeted_num_replicas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer having autoscale in the name to make it clear it's only used for autoscaling. Also moved the variable into deployment info and added comments.

zcin added 7 commits April 28, 2023 10:28
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
@zcin
Copy link
Contributor Author

zcin commented May 1, 2023

@edoakes Addressed comments, PTAL

@edoakes
Copy link
Contributor

edoakes commented May 1, 2023

serving doc test timed out repeatedly

@zcin
Copy link
Contributor Author

zcin commented May 1, 2023

@edoakes tests look good now. The current failures are failing on master and unrelated:

Screen Shot 2023-05-01 at 3 22 51 PM

@edoakes edoakes merged commit d87a251 into ray-project:master May 1, 2023
@zcin zcin deleted the improve-deploy-support branch May 1, 2023 22:30
architkulkarni pushed a commit to architkulkarni/ray that referenced this pull request May 16, 2023
Some preparation for upcoming deploy refactor PRs.
- Rename fields of `ApplicationState` as private fields
- Add route prefix to deployment info (it will be used by application state to deploy deployments in a reconciler loop)
- Stop setting num replicas from autoscaling in `deployment_config.num_replicas`, instead put it in a separate field of deployment info.
- determine initial autoscaled num replicas in deployment state manager .deploy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants