Panos P
11/17/2022, 11:17 PMpipelines:
- test1
- test2
I want to return 2 pipelines like this:
pipes = []
for pipeline in pipelines:
pipes.append(Pipeline([
node(do_something, [f"params:{pipeline}"], [f"output_{pipeline}"], tags=pipeline)
]))
In the older versions of Kedro I was able to get the params before the creation of pipelines and then work from there.
Like this:
def get_kedro_env() -> str:
"""Get the kedro --env parameter or local
Returns:
The kedro --env parameter
"""
return os.getenv("KEDRO_ENV", "local")
def _get_config() -> ConfigLoader:
"""Get the kedro configuration context
Returns:
The kedro configuration context
"""
try:
return get_current_session().load_context().config_loader
except Exception: # NOQA
env = get_kedro_env()
return ConfigLoader(["./conf/base", f"./conf/{env}"])
def get_params() -> Dict[str, Any]:
"""Get all the parameter values from the parameters.yml as a dictionary.
Returns:
The parameter values
"""
return _get_config().get("parameters*", "parameters*/**", "**/parameters*")
It seems like in kedro 0.18.3 There is no more load_context()
any thoughts?Nok Lam Chan
11/17/2022, 11:21 PMPanos P
11/17/2022, 11:21 PMclass ProjectHooks:
@hook_impl
def after_context_created(self, context: KedroContext) -> None:
print("&"*10)
print(context.env)
print(context.params)
print("&"*10)
Nok Lam Chan
11/17/2022, 11:32 PM