in dora/hydra.py [0:0]
def __init__(self, main: MainFun, config_name: str, config_path: str):
self.config_name = config_name
self.config_path = config_path
module = main.__module__
if module == "__main__":
spec = sys.modules[module].__spec__
if spec is None:
module_path = sys.argv[0]
self._job_name = module_path.rsplit(".", 2)[1]
else:
assert spec.origin is not None
module_path = spec.origin
module = spec.name
self._job_name = module.rsplit(".", 1)[1]
else:
spec = find_spec(module)
assert spec is not None and spec.origin is not None
module_path = spec.origin
self._job_name = module.rsplit(".", 1)[1]
self.full_config_path = Path(module_path).parent.resolve()
if config_path is not None:
self.full_config_path = self.full_config_path / config_path
self._initialized = False
self._base_cfg = self._get_config()
dora = self._get_dora()
super().__init__(main, dora)
# this is a really dirty hack to make Hydra believe that this is
# coming from the __main__ module, as it would usually be.
# This allows to use relative paths for config_path.
main.__module__ = "__main__"