Hello! I Have a question Is there a way in Kedro...
# questions
y
Hello! I Have a question Is there a way in Kedro to know which environment I'm using in
settings.py
? The purpose is to choose which Hooks to add depending on the active environment. For example, in pseudocode:
Copy code
if env == "base":
    HOOKS = (PerformanceProfilingHooks(), MlFlow())
elif env == "cake":
    HOOKS = (PerformanceProfilingHooks(),)
else:
    HOOKS = []
d
so
settings.py
happens before the env is created… however you can set your env via the
KEDRO_ENV
environment variable, so you could do that and pick it up in this logic too
👍 1
m
I would say that the hook should be implemented differently - the hook implementation's class should have
after_context_created
and internal field
self._enabled
(or similar) that will enable or disable the hook based on some config / condition.
👍 1
y
Tnhx for the ideas!
m
If you want to add this "conditionally" to MLflow hook, just inherit from the original one and override the
after_context_created
👍 1