Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Retry worker on runtime errors #512

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Add logging to the worker
  • Loading branch information
whiterabbit1983 committed Sep 20, 2024
commit 791ad2beac430880ac33692bdf94d50eb8692b9b
16 changes: 14 additions & 2 deletions agents-api/agents_api/worker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@
#!/usr/bin/env python3

import asyncio
import logging

from tenacity import retry, retry_if_exception_type, wait_fixed
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))

@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),
Expand Down
Loading