You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54-2Lines changed: 54 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,10 +126,62 @@ Orchestrations can be continued as new using the `continue_as_new` API. This API
126
126
127
127
Orchestrations can be suspended using the `suspend_orchestration` client API and will remain suspended until resumed using the `resume_orchestration` client API. A suspended orchestration will stop processing new events, but will continue to buffer any that happen to arrive until resumed, ensuring that no data is lost. An orchestration can also be terminated using the `terminate_orchestration` client API. Terminated orchestrations will stop processing new events and will discard any buffered events.
128
128
129
-
### Retry policies (TODO)
129
+
### Retry policies
130
130
131
131
Orchestrations can specify retry policies for activities and sub-orchestrations. These policies control how many times and how frequently an activity or sub-orchestration will be retried in the event of a transient error.
132
132
133
+
#### Creating a retry policy
134
+
135
+
```python
136
+
from datetime import timedelta
137
+
from durabletask import task
138
+
139
+
retry_policy = task.RetryPolicy(
140
+
first_retry_interval=timedelta(seconds=1), # Initial delay before first retry
141
+
max_number_of_attempts=5, # Maximum total attempts (includes first attempt)
142
+
backoff_coefficient=2.0, # Exponential backoff multiplier (must be >= 1)
143
+
max_retry_interval=timedelta(seconds=30), # Cap on retry delay
144
+
retry_timeout=timedelta(minutes=5), # Total time limit for all retries (optional)
145
+
)
146
+
```
147
+
148
+
**Notes:**
149
+
-`max_number_of_attempts`**includes the initial attempt**. For example, `max_number_of_attempts=5` means 1 initial attempt + up to 4 retries.
150
+
-`retry_timeout` is optional. If omitted or set to `None`, retries continue until `max_number_of_attempts` is reached.
-`non_retryable_error_types` (optional) can specify additional exception types to treat as non-retryable (e.g., `[ValueError, TypeError]`). `NonRetryableError` is always non-retryable regardless of this setting.
153
+
154
+
#### Using retry policies
155
+
156
+
Apply retry policies to activities or sub-orchestrations:
grpcio-tools==1.62.3 # 1.62.X is the latest version before protobuf 1.26.X is used which has breaking changes for Python # supports protobuf 6.x and aligns with generated code
0 commit comments