-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
remove Plugins from Singleton get_state #1312
Conversation
What I had in mind is that we:
|
@@ -45,6 +46,7 @@ def launch_jobs(temp_dir: str) -> None: | |||
) | |||
setup_globals() | |||
Singleton.set_state(singleton_state) | |||
Plugins.instance() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this inside set_state()?
plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py
Outdated
Show resolved
Hide resolved
I see. This does seem better. I've fixed the PR to be along the same line of thoughts. I'm not sure if you meant to actually change more details below,
|
dc6db48
to
2ebfea7
Compare
per offline discussion - move imports to local :) |
I see. Thanks! updated the PR per your comment, also added a unit test. |
rebase... |
hydra/core/singleton.py
Outdated
try: | ||
from hydra.core.plugins import Plugins | ||
|
||
del instances[Plugins] | ||
except KeyError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try:
instances.pop(Plugins, None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!
chdir_hydra_root() | ||
plugin = "hydra_ray_launcher" | ||
os.chdir(Path("plugins") / plugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably use monkeypatch to change the directory and restore automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know monkeypatch
could do that, I thought we usually do fixture
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge once CI passes.
Motivation
We do not need to pickle all of Singleton. change this to only pickle what is needed (
JobRuntime
andOmegaConf
resolvers.)This will also fix that the plugin integration tests fails if other hydra tools/plugins is isntalled locally as well.
Have you read the Contributing Guidelines on pull requests?
Yes/No
Test Plan
CI
locally
Related Issues and PRs
(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)