From 727919234381a959601ae6d5a6c02bf41d3b5ace Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Fri, 11 Jul 2025 10:42:28 -0300 Subject: [PATCH] SIENTIAPDE-1148 refactor: streamline Temporal connection logic in temporal_manager.py and remove redundant logging in worker.py --- orchestrator/activities/temporal_manager.py | 25 ++++++++++++--------- orchestrator/worker/worker.py | 2 -- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/orchestrator/activities/temporal_manager.py b/orchestrator/activities/temporal_manager.py index e78b46e..d4caf19 100644 --- a/orchestrator/activities/temporal_manager.py +++ b/orchestrator/activities/temporal_manager.py @@ -40,20 +40,25 @@ class TemporalManager(BaseActivity): notification_handler=notification_handler) async def connect_to_temporal(self): - self.logger.info("Connecting to Temporal side namespaces...") - + self.logger.info( + f"Connecting to Temporal side namespaces at {self.host}") self.logger.info(f"Scouter namespace: {self.scouter_namespace}") + + scouter_client = await Client.connect( + target_host=self.host, + namespace=self.scouter_namespace + ) + self.logger.info(f"Laborious namespace: {self.laborious_namespace}") + laborious_client = await Client.connect( + target_host=self.host, + namespace=self.laborious_namespace + ) + self.temporal_clients = { - self.scouter_namespace: await Client.connect( - target_host=self.host, - namespace=self.scouter_namespace - ), - self.laborious_namespace: await Client.connect( - target_host=self.host, - namespace=self.laborious_namespace - ) + self.scouter_namespace: scouter_client, + self.laborious_namespace: laborious_client } @activity.defn(name="load_schedule") diff --git a/orchestrator/worker/worker.py b/orchestrator/worker/worker.py index 32aaff4..f4a2804 100644 --- a/orchestrator/worker/worker.py +++ b/orchestrator/worker/worker.py @@ -49,8 +49,6 @@ async def main(): notification_handler=notification_handler ) - logger.info('Connecting to Temporal side namespaces...') - await activities.connect_to_temporal() logger.info('Starting Workers...')