I'm attempting to use Hydra's compose API to launch runs programmatically instead of via CLI. This works for the most part. However, overriding hydra.run.dir to change the base directory doesn't seem to have the effect when using the compose API. I.e.:
with hydra.experimental.initialize_config_module(config_module=config_module):
cfg = hydra.experimental.compose(
config_name=config_name,
overrides=["hydra.run.dir=/tmp/workdir", ...],
return_hydra_config=True
)
hydra.core.hydra_config.HydraConfig.instance().set_config(cfg)
with omegaconf.open_dict(cfg):
del cfg["hydra"]
generates a DictConfig with the appropriate entry for hydra.run.dir, but the working directory is not changed.
The compose API documentation states that not using @hydra.main entails forfeiting Hydra's working directory management. Is there a workaround for this?