FlorianGD
04/13/2022, 11:46 AMkedro==0.18.0
. We use kedro.framework.session.get_current_session
to get the current session in order to either create a new session if it is None, or use it directly. This function was removed in 0.18.0
(with https://github.com/kedro-org/kedro/pull/1138) . What is the new way to find the current active session?datajoely
04/13/2022, 12:06 PMFlorianGD
04/13/2022, 12:13 PMsession.run
still the best way to run programmatically a pipeline? And if I want to access the context and catalog for a given env, I used to use a session, is it still OK or do I have to find another way?datajoely
04/13/2022, 12:14 PMFlorianGD
04/13/2022, 12:18 PMcatalog.log
. I do not see how I can use hooks for this use casedatajoely
04/13/2022, 12:20 PMFlorianGD
04/13/2022, 12:23 PMdatajoely
04/13/2022, 12:23 PMbefore_pipeline_run
or after_pipeline_run
hook the right place to do this?FlorianGD
04/13/2022, 12:24 PMdatajoely
04/13/2022, 12:24 PMFlorianGD
04/13/2022, 12:25 PMdatajoely
04/13/2022, 12:25 PMFlorianGD
04/13/2022, 12:27 PMdatajoely
04/13/2022, 12:33 PMFlorianGD
04/13/2022, 1:08 PMpython
# this would create a session and return the catalog
catalog = get_catalog()
# but this would also return the catalog inside the already created session
with KedroSession.create(env="prod"):
catalog = get_catalog()
Without access to the current session, I do not see how we can provide it nowdatajoely
04/13/2022, 1:09 PMas session
to the end of your context manager you can access the objects liveFlorianGD
04/13/2022, 1:14 PMget_catalog
function, as a helper for those that do not remember that you need to do session.load_context().catalog
. But maybe, it is not that usefulnoklam
04/13/2022, 2:56 PMsession.run()
would be the preferred way to run a pipeline programaticallyFlorianGD
04/13/2022, 3:28 PMnoklam
04/19/2022, 4:54 PMwith KedroSession.create() as session
will probably give you access to one session without the need to close/recreate a new one.
The active session will soon be removed and you could create as many sessions as you needed, but most likely you only need one.