Skip to content

Using retry_policy without max_retry_interval fails with no helpful error #96

@andystaples

Description

@andystaples

Calling context.call_activity with a retry policy that doesn't specify max_retry_interval prevents the retry behavior from working, causing the orchestration to fail after the first activity failure.
Example:

@bp.orchestration_trigger(context_name="context", orchestration="RetryActivityFunction")
def retry_activity_function(context: OrchestrationContext, _):
    retry_policy = RetryPolicy(
        first_retry_interval=timedelta(milliseconds=5000),
        max_number_of_attempts=3,
    )
    # raise_exception will throw on the first invocation, then succeed on the second
    yield context.call_activity('raise_exception', input=context.instance_id, retry_policy=retry_policy)
    return "Success"

Cause:
When the _OrchestrationExecutor runs process_event on the taskFailed event, it calls compute_next_delay on the task, which returns None because self._retry_policy.max_retry_interval is None. This shunts to the default "fail the orchestration" behavior without logging a reason why.

Not sure what the best solution is - should we have a default max_retry_interval, not enforce max_retry_interval if it is not specified, or continue to fail, but with a warning about providing max_retry_interval?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions