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

[autoscaler] Fix ray.autoscaler.sdk import issue #21795

Merged
merged 10 commits into from Jan 25, 2022

Conversation

wuisawesome
Copy link
Contributor

@wuisawesome wuisawesome commented Jan 22, 2022

Why are these changes needed?

This PR moves the sdk to its own folder, then includes everything in import ray.autoscaler.sdk in ray's import path.

Note: that there were circular dependencies in naively doing this because the ray core now uses constants that were defined in the autoscaler for internal kv operations (and the autoscaler similarly calls into the ray core). The solution was to move those internal kv keys into ray core constants so the imports flow (more) one way.

Related issue number

closes #19840

Checks

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

@@ -26,6 +26,14 @@ def env_bool(key, default):
return default


# Whether event logging to driver is enabled. Set to 0 to disable.
AUTOSCALER_EVENTS = env_integer("RAY_SCHEDULER_EVENTS", 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixed the giant circular dependency.

@@ -79,7 +73,9 @@ def validate_config(config: Dict[str, Any]) -> None:
if not isinstance(config, dict):
raise ValueError("Config {} is not a dictionary".format(config))

with open(RAY_SCHEMA_PATH) as f:
schema_path = os.path.join(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixed a small circular dependency.

@@ -52,7 +52,7 @@
from ray.worker import global_worker # type: ignore
from ray.util.debug import log_once

import ray.autoscaler._private.subprocess_output_util as cmd_output_util
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this fixed a minor circular dependency.

@wuisawesome
Copy link
Contributor Author

@AmeerHajAli this was the issue you thought was "trivial"?

@AmeerHajAli
Copy link
Contributor

@AmeerHajAli this was the issue you thought was "trivial"?

Perhaps.

Alex Wu added 2 commits January 23, 2022 19:43
@wuisawesome
Copy link
Contributor Author

@DmitriGekhtman @ckw017 do either of you happen to know how to fix this lint error? It seems to want to lint a non-existent file :(.

@DmitriGekhtman
Copy link
Contributor

@DmitriGekhtman @ckw017 do either of you happen to know how to fix this lint error? It seems to want to lint a non-existent file :(.

hah, that's from my abortive start at adding type checking to the autoscaler code, circa October 2020
update the file name here, lmk if you run into further issues

@wuisawesome wuisawesome added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Jan 25, 2022
@wuisawesome
Copy link
Contributor Author

Rllib failure looks unrelated and broken in master. Merging.

@wuisawesome wuisawesome merged commit 7a45f60 into ray-project:master Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug][Autoscaler] AttributeError: module 'ray.autoscaler' has no attribute 'sdk'
5 participants