-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agents-api): Add retry policies to temporal workflows/activities (…
…#551) <!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Introduces `DEFAULT_RETRY_POLICY` for consistent retry behavior in Temporal workflows and activities, updating workflows, activities, and tests accordingly. > > - **Retry Policy**: > - Introduces `DEFAULT_RETRY_POLICY` in `retry_policies.py` with specific retry configurations. > - Applies `DEFAULT_RETRY_POLICY` to `run_task_execution_workflow()` in `temporal.py` and `run_embed_docs_task()` in `create_doc.py`. > - **Workflows**: > - Adds `retry_policy=DEFAULT_RETRY_POLICY` to `DemoWorkflow`, `EmbedDocsWorkflow`, `MemRatingWorkflow`, `SummarizationWorkflow`, `TruncationWorkflow`. > - Updates `TaskExecutionWorkflow` in `task_execution/__init__.py` to use `DEFAULT_RETRY_POLICY` for activities. > - **Activities**: > - Updates `raise_complete_async()` in `raise_complete_async.py` to use consistent string formatting. > - Updates `transition()` in `transition.py` to use `DEFAULT_RETRY_POLICY`. > - **Tests**: > - Updates `test_activities.py` to use `DEFAULT_RETRY_POLICY` in workflow execution tests. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup> for 2d945d3. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Signed-off-by: Diwank Singh Tomer <[email protected]> Co-authored-by: Diwank Singh Tomer <[email protected]> Co-authored-by: creatorrr <[email protected]>
- Loading branch information
1 parent
8033549
commit 2e0108e
Showing
12 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from datetime import timedelta | ||
|
||
from temporalio.common import RetryPolicy | ||
|
||
DEFAULT_RETRY_POLICY = RetryPolicy( | ||
initial_interval=timedelta(seconds=1), | ||
backoff_coefficient=2, | ||
maximum_attempts=25, | ||
maximum_interval=timedelta(seconds=300), | ||
non_retryable_error_types=[ | ||
# Temporal-specific errors | ||
"WorkflowExecutionAlreadyStarted", | ||
"temporalio.exceptions.TerminalFailure", | ||
"temporalio.exceptions.CanceledError", | ||
# | ||
# Built-in Python exceptions | ||
"TypeError", | ||
"AssertionError", | ||
"SyntaxError", | ||
"ValueError", | ||
"ZeroDivisionError", | ||
"IndexError", | ||
"AttributeError", | ||
"LookupError", | ||
"BufferError", | ||
"ArithmeticError", | ||
"KeyError", | ||
"NameError", | ||
"NotImplementedError", | ||
"RecursionError", | ||
"RuntimeError", | ||
"StopIteration", | ||
"StopAsyncIteration", | ||
"IndentationError", | ||
"TabError", | ||
# | ||
# Unicode-related errors | ||
"UnicodeError", | ||
"UnicodeEncodeError", | ||
"UnicodeDecodeError", | ||
"UnicodeTranslateError", | ||
# | ||
# HTTP and API-related errors | ||
"HTTPException", | ||
"fastapi.exceptions.HTTPException", | ||
"fastapi.exceptions.RequestValidationError", | ||
"httpx.RequestError", | ||
"httpx.HTTPStatusError", | ||
# | ||
# Asynchronous programming errors | ||
"asyncio.CancelledError", | ||
"asyncio.InvalidStateError", | ||
"GeneratorExit", | ||
# | ||
# Third-party library exceptions | ||
"jinja2.exceptions.TemplateSyntaxError", | ||
"jinja2.exceptions.TemplateNotFound", | ||
"jsonschema.exceptions.ValidationError", | ||
"pydantic.ValidationError", | ||
"requests.exceptions.InvalidURL", | ||
"requests.exceptions.MissingSchema", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters