Hello everyone, Is there a way to use parameters ...
# questions
s
Hello everyone, Is there a way to use parameters that are passed to
kedro run
as an input to a node ? Here is a quick example: • Kedro run command:
kedro run --pipeline my_pipeline --params first_param:first_value
• I’d like to use first_param as an input to a node without having to put it in parameters.yml just to use it as an input to my node. If not, is there a way to use it directly into code ?
Copy code
Pipeline([
            node(
                do_something,
                 inputs="first_param",
                 outputs="some_output"
            )
       ])
Thanks 👍
f
You can use
params:first_param
as an input and it should work without having to declare it in
parameters.yml
👍 1
s
Actually, that was the first thing that I tried and I got this error: ValueError: Pipeline input(s) {‘params:first_param’} not found in the DataCatalog
f
Which Kedro version are you using?
s
I’m using 0.17.6
f
I'd recommend switching to Kedro 0.18.3 and trying again
s
and just to clarify something, the param first_param is added dynamically to
extra_params
in
register_config_loader
f
So,
kedro run --pipeline my_pipeline --params first_param:first_value
is not what you actually run?
s
Well, adding it to extra_params in register_config_loader is equivalent to passing to in kedro run as a parameter
or so I thought 😅
f
Could you try and see if it changes something?
s
It works that way... So, they are different after all 😅
f
We are more and more trying to have static pipelines, rather than adding too much dynamically, except for parameters, and we do not have this problem. We do use a custom ConfigLoader, but this is to use the parameters in the catalog, it should not change the way parameters are passed to nodes
👍 1
s
Well, I’ve just tested both options and
extra_params
in
register_config_loader
has the same content whether it’s added dynamically or through kedro run. But as the error says that it didn’t find the parameter in the data catalog, I think it should be injected in it as well So, it becomes a big hurdle just to avoid passing to kedro run directly 😅
f
Frankly, as
register_config_loader
is removed in Kedro
0.18+
, I would not go down this road
👍 1
s
You’re right 👍 Thanks for your help 👍
👍 1