Is there a way to access the session ID or any oth...
# questions
e
Is there a way to access the session ID or any other pipeline-execution identifier from within the nodes of a pipeline?
👀 1
m
You can generate your own ID using hooks early in the lifecycle and then inject it into all nodes in
before_node_run
. Alternatively - use mlflow run id, if you're using mlflow.
e
The first sounds like a neat solution - so I understand the
KedroSession
cannot be/is not available to the pipeline and nodes upon execution?
j
node functions don't know anything about Kedro, they're regular functions that take dataframes and produce dataframes. so much so that you could reuse them in a non-Kedro context without changes. hence the way to achieve what you want is by using hooks as @marrrcin suggests
n
If you know what your id should be, or have the flexibility to generate your own. It will be simpler to register a customer resolver and simply treat that session id as a parameter so it is immediate available for nodes
e
totally understand the independence of nodes
I was referring to something like
KedroSession.get_current_session()
something liek that that I can use within nodes, to get the session data
m
So the question is - why do you need that? 😉
👍🏼 1
e
@marrrcin sorry for late reply I wanted that because I need to carry a string for teleemtry purposes over nodes. So I have some kind of a session ID, and traces go underneath that session ID. From a business perspective ,the session is the same throughout the execution of the pipeline. This Session ID is what I was trying to set