Hi there, I am following the example on this webpa...
# ask-metaflow
c
Hi there, I am following the example on this webpage to use Hydra with metaflow https://outerbounds.com/blog/metaflow-in-notebooks-and-scripts/#running-metaflow-in-scripts-with-custom-configurations . I was able to get the example to work, but it seems I have to define every config parameter with a
Parameter()
statement in the Flow file? Is there a different way to pass configs to the flows? Also, how to use more complicated configs than shown in this example? For example, how to use nested configs (e.g.,
parameter.arg1
,
parameter.arg2
), or those spread over multiple files?
✅ 1
s
Very timely - we have that feature in the works. Meanwhile, you can also use
JSONType
as a parameter type.
thankyou 1
d
Not quite yet — it’s forthcoming
🙂
c
@dry-beach-38304 thanks! for now, i have to define every param in a single hydra config, then declare them all with
Parameter()
calls in the flow file, right?
d
what does your flow look like now?
c
i am following the example on the webpage: a single flat hydra config, and a corresponding
Parameter()
for every config parameter.
d
you should be able to just havea single paramete called
my_config
for example and pass the entire hydra dict as the value for that. The Parameter should be of type JSONType and that should work.
c
So, something like:
Parameter('my_config', default=None)
in the flow file?
d
(apologies in the middle of something so haven’t tried but something like:
Parameter("my_config", type=JSONType, default={})
and then in the runner thing, you can pass it using
run(my_config=**cfg)
or something like that. Basically my_config will contain all the values in a dictionary form.
sorry, it should be
run(my_config=cfg)
c
thanks, will try it!
I tried it, and got this error:
ValueError: Unknown argument: 'my_config', possible args are: tags, max_workers, max_num_splits, max_log_size, decospecs, run_id_file, runner_attribute_file, user_namespace
d
And you have a parameter in that flow? That’s weird, it should be injected as a valid name. Could you send me the snippet you are using and I can try to debug.
c
Thanks! I'll send you a DM with the MWE