Non_retriable_error_reasons - how to set

what should be the value set for “non_retriable_error_reasons” in retry policy?
should it be the exception classes?

1 Like

The values you specify for “non_retriable_error_reasons” should be the Error/Exception types that indicate that an activity should not be retried. This can be used to early-exit the retry process for an Activity instead of waiting for all the retries to finish.

1 Like

It did not work for me.
this is what i did:

retry_parameters=RetryParameters(initial_interval_in_seconds=3, maximum_attempts=3, backoff_coefficient=2, non_retriable_error_reasons=['no-retry-error'])

and in the activity code:

raise Exception("no-retry-error")

it still retried.

I also tried:

retry_parameters=RetryParameters(initial_interval_in_seconds=3, maximum_attempts=3, backoff_coefficient=2, non_retriable_error_reasons=['RuntimeError'])

and in activity code:

raise RuntimeError

in the above case also it retried.
what should be set so that it does not retry?

I even tried with the absolute package name of the exception class, still it didn’t work

Look at the error reason in the ActivityTaskFailed event in the event history. The non_retriable_error_reasons should match that string exactly.

In reason, it always says: ActivityFailureException

If this is the reason in the ActivityTaskFailed event then it is a bug in the activity worker that should be fixed. The reason should contain the original exception name.

didn’t get, fix should be in my code or the library?

In the library. Here is the line that assigns ActivityFailureException instead of the exception type name.

1 Like

Thanks. Raised PR

1 Like