I have a .yaml configuration file which looks like:
key: value
hydra:
run:
dir: ./data_fetcher/hydra_outputs/${now:%Y-%m-%d}/${now:%H-%M-%S}
with a python file main.py
:
import hydra
@hydra.main(config_path="data_fetcher/config", config_name="config")
def main(cfg: DictConfig):
pass
if __name__ == "__main__":
main()
When running main.py
an output directory is created according to the current date and time.
How does Hydra get the current time ? is it possible to change the timezone ?
Hydra is registering a simple OmegaConf custom resolver here with a line like:
You can register your own custom resolver with a different name before
@hydra.main()
runs that will do what you want.You can also file a feature request to add support for time zone to the
${now:...}
custom resolve in Hydra. a PR would be appreciated. For example,${now:...}
can support an optional second parameter for the time zone.