Is there a way to store a python object and make it available throughout the entire kedro lifecycle or a run.
So i want some way to generate an uuid before the pipeline starts which can be done with the help of hooks but how do i make it available throughput all the hook implementations and probably the nodes also.
l
Laurens Vijnck
09/20/2024, 10:04 AM
I'd say use the hook, and add to after_context_created
Laurens Vijnck
09/20/2024, 10:05 AM
Alternatively, you could set it up in the settings and import it from there
v
Vishal Pandey
09/20/2024, 10:07 AM
Thanks for responding. Can you give me some example . In case of after_context_created , i can call the function and generate the uuid but where can i store it ,to access it in other hooks ?
n
Nok Lam Chan
09/20/2024, 11:31 AM
I'd say avoid cross hook communication. Hooks are mean to be a way to extend Kedro and work as a standalone plugin.
You can create the id and save it as an attribute so it available within the same hook. Passing a hook info to node is not recommended since you couple your hook to node and it becomes part of the implementation