Skip to content

Commit

Permalink
local imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jieru-hu committed Jan 20, 2021
1 parent 550f39d commit dc6db48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
8 changes: 8 additions & 0 deletions hydra/core/singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ def instance(cls: Any, *args: Any, **kwargs: Any) -> Any:

@staticmethod
def get_state() -> Any:
try:
from hydra.core.plugins import Plugins

del Singleton._instances[Plugins]
except KeyError:
pass
return {
"instances": Singleton._instances,
"omegaconf_resolvers": deepcopy(BaseContainer._resolvers),
Expand All @@ -26,4 +32,6 @@ def get_state() -> Any:
@staticmethod
def set_state(state: Any) -> None:
Singleton._instances = state["instances"]
from hydra.core.plugins import Plugins
Plugins.instance()
BaseContainer._resolvers = deepcopy(state["omegaconf_resolvers"])
17 changes: 1 addition & 16 deletions plugins/hydra_ray_launcher/tests/test_ray_aws_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,7 @@
chdir_plugin_root()


def build_ray_launcher_wheel(tmpdir: str) -> str:
"""
This only works on ray launcher plugin wheels for now, reasons being in our base AMI
we do not necessarily have the dependency for other plugins.
"""
command = "python -m pip --disable-pip-version-check list | grep hydra | grep -v hydra-core "
output = subprocess.getoutput(command).split("\n")
plugins_path = [x.split()[0].replace("-", "_") for x in output]
assert (
len(plugins_path) == 1 and "hydra_ray_launcher" == plugins_path[0]
), "Ray test AMI doesn't have dependency installed for other plugins."

return build_plugin_wheel(tmpdir)


def build_plugin_wheel(tmp_wheel_dir: str) -> str:
def build_ray_launcher_wheel(tmp_wheel_dir: str) -> str:
chdir_hydra_root()
plugin = "hydra_ray_launcher"
os.chdir(Path("plugins") / plugin)
Expand Down

0 comments on commit dc6db48

Please sign in to comment.