Hey,
Tried looking to see if this issue has come up before but I’m not seeing it. We are trying to model what a Workflow failure would look like (understanding that this should be a rare occurrence), and essentially have a code block within a workflow that looks like
random_number_between_0_and_100 = workflow.execute_activity_method(ActivityClass.generate_random_number, start_to_close_timeout=timedelta(seconds=5)
if random_number_between_0_and_100 > 50:
raise ValueError("This step failed")
When I run this workflow with
client.excecute_workflow(
...,
retry_policy=RetryPolicy(
initial_interval=timedelta(seconds=1),
backoff_coefficient=1,
maximum_attempts=0,
),
I get this kind of strange behavior in the workflow that looks like this screenshot:
This is being run in the WorkflowEnvironment.start_local
environment for Python (maybe this would run differently in a different environment).
The failed workflow task retries within 0.04 seconds, not respecting the retry policy initial_interval, and doesn’t retry again.
I’ve seen some documentation that says that Workflows can take retry policies that should apply for the workflow execution, while some posts on this forum have (perhaps erroneously) wondered whether the retry policy passed in client.execute_workflow
just acts as the RetryPolicy
for all of the activity executions.
I would like to know if it’s possible to have a workflow retry (or not retry) from a failed state (without necessarily having the failure be a non-retryable
error). It seems at least in my local usage, I can’t get the workflow to retry more than once and it does not respect my RetryPolicy.