Hi everyone, I'm using Kedro with two main configu...
# questions
r
Hi everyone, I'm using Kedro with two main configuration envs: "conf/base" and "conf/test", and I'm running
kedro run --env=test
when I need to run a quick pipeline check. However, I have some code in my "settings.py" file that I must not run when I'm using the "conf/test" env, but I'm not managing to get this environment information in the "settings.py" code so I can write a simple if/else condition. What is the best way to do this? Thanks for this awesome open-source tool!
j
hi, what version are you using?
In kedro < 0.18 you should use the
TempleatedConfigLoader
in
hooks.py
in kedro >= 0.18 you need to create a thin layer over the
TempleatedConfigLoader
class to catch that CLI param. https://github.com/kedro-org/kedro/issues/1527#issuecomment-1127697871
d
you could also parameterize the env with the environment variable KEDRO_ENV = test
and pick this up in settings.py
r
Thanks you both for the answers 🙂 And I'm currently using kedro==0.18.6
One more question regarding the suggestion made in that Github issue. If I define that "MyTemplatedConfigLoader" class in the settings.py file, can also access the extra param value I'm passing through the command line also in settings.py?