Replies: 2 comments 4 replies
-
|
Hi @ywyga, I believe Hydra is doing some special maneuvering here. Without diving too deep into Hydra's internals to figure out exactly how this works, I can offer a tip: If you register your own version of the from datetime import datetime
OmegaConf.register_new_resolver(
"my_now",
lambda pattern: datetime.now().strftime(pattern),
use_cache=True,
replace=True,
)Using |
Beta Was this translation helpful? Give feedback.
-
|
@Jasha10 related to this, I wonder how I can replicate the implementation of the Hydra resolvers as I would like the cache to be preserved between jobs in a multirun? From the code I suspect this isn't possible as the hydra resolvers are created when launching the launcher and the custom resolvers are only created upon importing/running the decorated function but I'm quite new to Hydra so thought I'd check. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
When using multirun, I notice that $now is resolved only once (when multirun is started) but custom resolvers are called for each job even if they are declared with use_cache=True. So I am wondering what is the general rule as to when config resolutions happen in multirun. And also whether there is a way to make $now resolve at job creation time instead of at multirun start.
Here for example:
main.py
config.yaml
and the output after running
python main.py a=0,1,2 -mnote that the fields depending on $now (and also the output directory) all have the same timestamp, while the fields depending on cached randint change between jobs.
Beta Was this translation helpful? Give feedback.
All reactions