Skip to content

Commit

Permalink
Update singleton.py
Browse files Browse the repository at this point in the history
  • Loading branch information
omry authored and jieru-hu committed Jan 27, 2021
1 parent 0fd2719 commit b0a5b2a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hydra/core/singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def instance(cls: Any, *args: Any, **kwargs: Any) -> Any:
@staticmethod
def get_state() -> Any:
instances = deepcopy(Singleton._instances)
# Plugins can cause issues for pickling the singleton state
# Plugins can cause issues when unpickling the singleton state
# if not all plugins are available on the the side doing the unpickling.
# Exclude them and re-initialize them on set_state()
from hydra.core.plugins import Plugins

Expand All @@ -32,7 +33,7 @@ def get_state() -> Any:
@staticmethod
def set_state(state: Any) -> None:
Singleton._instances = state["instances"]
# Reinitialize the the Plugin singleton (discover all plugins etc).
# Reinitialize the the Plugin singleton (re-discover plugins).
from hydra.core.plugins import Plugins

Plugins.instance()
Expand Down

0 comments on commit b0a5b2a

Please sign in to comment.