From 65aa9a6f1225f7cc46f9ffade8986f9cb4af258d Mon Sep 17 00:00:00 2001 From: Cole Blanchard Date: Wed, 17 Jul 2024 15:13:06 -0400 Subject: [PATCH 1/2] after exec function --- src/askem_beaker/contexts/model_configuration/context.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/askem_beaker/contexts/model_configuration/context.py b/src/askem_beaker/contexts/model_configuration/context.py index ca8ccf6..fbe165c 100644 --- a/src/askem_beaker/contexts/model_configuration/context.py +++ b/src/askem_beaker/contexts/model_configuration/context.py @@ -119,6 +119,15 @@ async def load_config(self): print(f"Running command:\n-------\n{command}\n---------") await self.execute(command) + async def post_execute(self, message): + try: + content = (await self.evaluate(self.get_code("get_config")))["return"] + self.beaker_kernel.send_response( + "iopub", "model_configuration_preview", content, parent_header=message.parent_header + ) + except Exception as e: + raise + @intercept() async def save_model_config_request(self, message): ''' From f0744b1759bd01c8cdbb3f503beeb59b50f28710 Mon Sep 17 00:00:00 2001 From: Cole Blanchard <33158416+blanchco@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:04:57 -0400 Subject: [PATCH 2/2] Update src/askem_beaker/contexts/model_configuration/context.py Co-authored-by: Five Grant <5@fivegrant.com> --- .../contexts/model_configuration/context.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/askem_beaker/contexts/model_configuration/context.py b/src/askem_beaker/contexts/model_configuration/context.py index fbe165c..82cf293 100644 --- a/src/askem_beaker/contexts/model_configuration/context.py +++ b/src/askem_beaker/contexts/model_configuration/context.py @@ -120,13 +120,10 @@ async def load_config(self): await self.execute(command) async def post_execute(self, message): - try: - content = (await self.evaluate(self.get_code("get_config")))["return"] - self.beaker_kernel.send_response( - "iopub", "model_configuration_preview", content, parent_header=message.parent_header - ) - except Exception as e: - raise + content = (await self.evaluate(self.get_code("get_config")))["return"] + self.beaker_kernel.send_response( + "iopub", "model_configuration_preview", content, parent_header=message.parent_header + ) @intercept() async def save_model_config_request(self, message):