Hey all: How to get session/context inside the nod...
# questions
a
Hey all: How to get session/context inside the node ?
1
n
Hi @Allen Ma, why do you need to access context within a node?
a
hi @Nok Lam Chan I want to combine hook mechanism to dynamically pass some configuration information to node through context
n
When you say dynamically, where is this configuration coming from? Is it from external files or nodes output?
a
From our metadata or config-center service
Or it could be the argument that was passed when we started our DAG, e.g. airflow’s dag_run_conf
Hi @Nok Lam Chan Is it not supported now?
n
I think there are better ways to do it. Session and context are higher level object and they are the containers for the parameters etc. You don’t need session inside a node to do that, as you are awared that you can use hook. For things like a config from airflow - I would probably use environment variable to solve this, simply write this into environment and communicate with the Kedro pipeline.
👍 1
Another option is using the after_context_created hook, where you can access the context, I don’t think you need to access the context within a node.
a
Thank you for your advice Let me try that