I am trying to implement the following behavior.
Workflow has 3 attempts(RetryPolicy) to do the work, if it fails, I want to run another wf that will do other logic instead.
try:
result = await workflow.execute_child_workflow(
RetryWorkflow.run,
params,
id="wf_id",
task_queue="queue",
retry_policy=RetryPolicy(maximum_attempts=3)
)
except WorkflowFailureError as err:
if isinstance(err.value.cause, ApplicationError) and str(err.value.cause) == "attempt 3":
# other stuff goes here
How can I fail wf after 3 attempts to mock the flow, raise with the error seems not to be working as expected. The code inside except is unreachable and wf continues running.
Can you clarify a bit here? Are you saying the child workflow is not running 3 times and then throwing? Throwing a different error? Only in test cases? What type of test environment/server?
Just checked by hand seems the raise is fine for the test. But when I raise the error my parent wf is also terminating. How to fix this?
I have the following setup:
Parent_WF → Child_WF(here I am going to catch the error) → Child_of_child_WF(here I expect the error)