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] Update version if import_path or runtime_env in config is changed #27498

Merged
merged 4 commits into from
Aug 5, 2022

Conversation

zcin
Copy link
Contributor

@zcin zcin commented Aug 4, 2022

Signed-off-by: Cindy Zhang [email protected]

Why are these changes needed?

Previous PR that adds in lightweight config updates: #27000. It only tracks the config options for deployments (bumps version if certain deployment options are changed, but otherwise keeps versions the same). However we should bump the versions of all deployments if import_path or runtime_env is changed.

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 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 zcin added serve Ray Serve Related Issue v2.0.0-pick labels Aug 4, 2022
Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Nice change! I had a couple comments.

updated_version_dict = _generate_new_version_config(
config_dict, last_config_dict, last_version_dict
)
if last_config_dict.get("import_path") == config_dict.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a comment somewhere here explaining that if the graph import_path or runtime_env are changed, Serve considers that a code change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Checking this pr, it makes me feel the _generate_new_version_config function name is confusing. @shrekris-anyscale @zcin I thought it is always generate a new version of config... can we try to rename the function? And I feel we can hide these logics into the function _generate_new_version_config directly. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point– _generate_new_version_config makes it sound like we're creating a new version for the whole config. In reality, it generates new versions for each of the deployments.

I think we should rename the function to something like _generate_deployment_config_versions and keep the functionality as is, or we should rename it to _version_config and take in two configs. Since the next release is soon, we should probably pick whichever one gives us more confidence in being well-tested. @sihanwang41 @zcin what do you think?

Copy link
Contributor

@sihanwang41 sihanwang41 Aug 4, 2022

Choose a reason for hiding this comment

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

yeah, let use _generate_deployment_config_versions first.

I feel it worth refactoring remove the logics inside the deploy_app level, it is a little burden in deploy_app level to "know" when should i pass config_dict, last_config_dict, last_version_dict when should I pass config_dict, {}, {} since the _generate_new_version_config is to determines whether each deployment's version should be changed based on the updated options (from the function description). deploy_app doesn't need to know the trick here :)

But if too much for 2.0 release, we can figure out later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current functionality also takes in two configs, right?
Perhaps we can rename to _update_deployment_config_versions?

@sihanwang41 Do you mean to hide all the logic, including the loading from kv_store, or just the new logic that checks import_path and runtime_env?

Copy link
Contributor

Choose a reason for hiding this comment

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

_generate_new_version_config's current functionality takes in two dictionaries containing only the deployment configs. It doesn't take in two full configs that match the ServeApplicationSchema format (including the top-level import_path and runtime_env).

I think @sihanwang41 was saying we could pass in entire configs and do the top-level import_path and runtime_env handling in _generate_new_version_config. That way, we wouldn't have to pass in just the deployment options into the helper function.

Copy link
Contributor

Choose a reason for hiding this comment

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

the goal is to hide burden for deploy_app to know whether i should pass last_config_dict or {}. we can keep the interface, but the logic in this pr can be hidden.

When checkpoint is None, we can directly pass _generate_new_version_config(config_dict) and set last_deployed_config and last_deployed_versions default value.

Copy link
Contributor Author

@zcin zcin Aug 4, 2022

Choose a reason for hiding this comment

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

Actually, I think currently _generate_new_version_config takes in full configs that match the ServeApplicationSchema format (albeit in dictionary form). Hiding the logic into the function _generate_new_version_config makes a lot of sense, though! I think I can make that change easily.

python/ray/serve/tests/test_standalone2.py Outdated Show resolved Hide resolved
@zcin zcin marked this pull request as ready for review August 4, 2022 18:34
@zcin zcin requested review from simon-mo and edoakes August 4, 2022 18:35
Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Nice work on the updates! This change looks good.

@edoakes edoakes merged commit b5927ca into ray-project:master Aug 5, 2022
zcin added a commit to zcin/ray that referenced this pull request Aug 5, 2022
…nged (ray-project#27498)

Previous PR that adds in lightweight config updates: ray-project#27000. It only tracks the config options for `deployments` (bumps version if certain deployment options are changed, but otherwise keeps versions the same). However we should bump the versions of all deployments if `import_path` or `runtime_env` is changed.

Signed-off-by: Cindy Zhang <[email protected]>
Stefan-1313 pushed a commit to Stefan-1313/ray_mod that referenced this pull request Aug 18, 2022
…nged (ray-project#27498)

Previous PR that adds in lightweight config updates: ray-project#27000. It only tracks the config options for `deployments` (bumps version if certain deployment options are changed, but otherwise keeps versions the same). However we should bump the versions of all deployments if `import_path` or `runtime_env` is changed.

Signed-off-by: Stefan van der Kleij <[email protected]>
@zcin zcin deleted the config_update_version branch January 13, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
serve Ray Serve Related Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants