Hello, I am running a kedro run with a custom cli ...
# questions
l
Hello, I am running a kedro run with a custom cli arg. like
kedro run --custom-flag
. I wanted to pass this flag into
KedroContext
. Does anyone know how I could do that? p.s If I pass to
extra_params
it will complain that this param is not in the config files (I didn't want it to be in the config files)
j
Hi Leo, you need to use a templated config loader to parse that extra_param, below more details: https://kedro-org.slack.com/archives/C03RKP2LW64/p1681738604209009?thread_ts=1681734506.034519&cid=C03RKP2LW64 You should also search in this channel "templated config loader" or "omega config loader" it's a common question :)
👍 1
👍🏼 1
l
thanks Javier!
j
you're welcome!, if you can't find the the way around of what you want to achieve, don't hesitate to ask 🙂
👍 1
l
I did something different. I ran
from kedro.framework.project import settings
then I just inserted the flag I needed inside the context class
settings.CONTEXT_CLASS.custom_flag = custom_flag
does it look too hacky?
j
I rather not answer hahahha! In the past I have done things very very far away from the kedro philosophy. I would still recommend taking your time to research a bit the templated or omega config loader, because you can not only do that, but all sorts of weird and extremely elaborate configurations in one place. There are a lot of examples in this channel or doing a google search. 😊
l
cool. Thanks!