Update environment configuration and refactor OPC activities for async handling

- Expanded the .env file with configurations for MongoDB, Postgres, MlFlow, and Temporal.
- Refactored OPC class methods to be asynchronous, including init_opc, write_data, manage_output_tags, and shutdown.
- Updated the worker to initialize OPC asynchronously and adjusted shutdown handling for activities.
This commit is contained in:
vitor-aignosi
2025-08-26 16:49:19 -03:00
parent 1cd91f2b58
commit cba90c98fa
6 changed files with 70 additions and 42 deletions

View File

@@ -64,6 +64,9 @@ async def main():
notification_handler=notification_handler
)
logger.custom_info('Initializing OPC...', metadata)
await activities.init_opc()
logger.custom_info(
f'Starting SDK Metrics Server on port {SDK_METRICS_PORT}...', metadata)
@@ -74,7 +77,7 @@ async def main():
)
)
logger.custom_info('Starting Temporal Client...', metadata)
logger.custom_info(f'Starting Temporal Client at {host}...', metadata)
temporal_client = await client.Client.connect(
target_host=host,
@@ -151,7 +154,7 @@ async def main():
if notification_handler:
notification_handler.shutdown()
if activities:
activities.shutdown()
await activities.shutdown()
# Exit with a non-zero status code to indicate failure to Kubernetes
metrics.APP_UP.labels(pod_id=POD_ID).set(0) # Mark app as DOWN
sys.exit(1)