From 4b9b411ec6eee9404423f77196a599150d2ea15b Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 25 Oct 2023 05:47:44 -0500 Subject: [PATCH] Revert "Revert "Update kernel env to reflect changes in session." (#1346)" This reverts commit bb293ec5cac5b277259f27e458da60fa8a926f46. --- jupyter_server/services/sessions/sessionmanager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jupyter_server/services/sessions/sessionmanager.py b/jupyter_server/services/sessions/sessionmanager.py index ba55cc2836..398490a8d4 100644 --- a/jupyter_server/services/sessions/sessionmanager.py +++ b/jupyter_server/services/sessions/sessionmanager.py @@ -461,6 +461,13 @@ async def update_session(self, session_id, **kwargs): query = "UPDATE session SET %s WHERE session_id=?" % (", ".join(sets)) # noqa self.cursor.execute(query, [*list(kwargs.values()), session_id]) + if hasattr(self.kernel_manager, "update_env"): + self.cursor.execute( + "SELECT path, name, kernel_id FROM session WHERE session_id=?", [session_id] + ) + path, name, kernel_id = self.cursor.fetchone() + self.kernel_manager.update_env(kernel_id=kernel_id, env=self.get_kernel_env(path, name)) + async def kernel_culled(self, kernel_id: str) -> bool: """Checks if the kernel is still considered alive and returns true if its not found.""" return kernel_id not in self.kernel_manager