diff --git a/agents-api/agents_api/worker/__main__.py b/agents-api/agents_api/worker/__main__.py index 72f9ccf14..217f0b05d 100644 --- a/agents-api/agents_api/worker/__main__.py +++ b/agents-api/agents_api/worker/__main__.py @@ -6,11 +6,26 @@ #!/usr/bin/env python3 import asyncio +import logging + +from tenacity import after_log, retry, retry_if_exception_type, wait_fixed from ..clients import temporal from .worker import create_worker +logger = logging.getLogger(__name__) +h = logging.StreamHandler() +fmt = logging.Formatter("[%(asctime)s/%(levelname)s] - %(message)s") +h.setFormatter(fmt) +logger.addHandler(h) +logger.setLevel(logging.DEBUG) + +@retry( + wait=wait_fixed(20), + retry=retry_if_exception_type(RuntimeError), + after=after_log(logger, logging.DEBUG), +) async def main(): """ Initializes the Temporal client and worker with TLS configuration (if provided),