Commit 08e293a
authored
feat: Classify non-retryable customer errors for Durable API calls (#358)
Non-retryable customer errors from Lambda (e.g., KMSAccessDeniedException, KMSDisabledException) arrive as HTTP 502 during CheckpointDurableExecution and GetDurableExecutionState API calls. Without this change, these 502s are classified as retryable invocation errors, causing the SDK to retry invocations that will never self-resolve.
Extract shared classification logic into BotoClientError with a _NON_RETRYABLE_CUSTOMER_ERROR_CODES set and _classify_error_category method. Both CheckpointError and GetExecutionStateError now inherit from_exception() with unified classification so that non-retryable errors (KMS 502s, 4xx client errors) return Status: FAILED immediately, while retryable errors (5xx, 429, network errors) continue to raise for Lambda retry.
Add is_retryable() to InvocationError hierarchy so execution.py handlers use a single interface instead of isinstance checks.
Add backward-compatible aliases for CheckpointErrorCategory and is_retriable().
Log Durable API errors during state fetch, and save partially fetched state.
Testing — parameterized classification tests across both error types for all four KMS codes, 4xx, 429, 5xx, and 502 scenarios. Integration tests for non-retryable/retryable errors across all three execution.py code paths: initial pagination, background thread, and user thread.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.1 parent 72a2ba4 commit 08e293a
6 files changed
Lines changed: 547 additions & 100 deletions
File tree
- src/aws_durable_execution_sdk_python
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
16 | 32 | | |
17 | 33 | | |
18 | 34 | | |
| |||
77 | 93 | | |
78 | 94 | | |
79 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
80 | 104 | | |
81 | 105 | | |
82 | 106 | | |
| |||
86 | 110 | | |
87 | 111 | | |
88 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
89 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
90 | 131 | | |
91 | 132 | | |
92 | 133 | | |
| 134 | + | |
93 | 135 | | |
94 | 136 | | |
95 | 137 | | |
96 | 138 | | |
97 | 139 | | |
98 | 140 | | |
99 | 141 | | |
| 142 | + | |
100 | 143 | | |
101 | 144 | | |
102 | 145 | | |
103 | 146 | | |
104 | 147 | | |
105 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
106 | 152 | | |
107 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
108 | 157 | | |
109 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
110 | 205 | | |
111 | 206 | | |
112 | 207 | | |
| |||
125 | 220 | | |
126 | 221 | | |
127 | 222 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 223 | | |
134 | 224 | | |
135 | 225 | | |
136 | 226 | | |
137 | 227 | | |
138 | 228 | | |
139 | | - | |
| 229 | + | |
140 | 230 | | |
141 | 231 | | |
142 | 232 | | |
143 | 233 | | |
144 | 234 | | |
| 235 | + | |
145 | 236 | | |
146 | 237 | | |
147 | 238 | | |
148 | 239 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 240 | | |
178 | 241 | | |
179 | 242 | | |
| |||
186 | 249 | | |
187 | 250 | | |
188 | 251 | | |
| 252 | + | |
189 | 253 | | |
190 | 254 | | |
191 | 255 | | |
192 | 256 | | |
193 | 257 | | |
| 258 | + | |
194 | 259 | | |
195 | 260 | | |
196 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
| |||
356 | 371 | | |
357 | 372 | | |
358 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
359 | 386 | | |
360 | 387 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | 388 | | |
365 | 389 | | |
366 | 390 | | |
| |||
377 | 401 | | |
378 | 402 | | |
379 | 403 | | |
380 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
381 | 416 | | |
382 | 417 | | |
383 | 418 | | |
384 | 419 | | |
385 | | - | |
| 420 | + | |
386 | 421 | | |
387 | 422 | | |
388 | 423 | | |
| |||
428 | 463 | | |
429 | 464 | | |
430 | 465 | | |
431 | | - | |
| 466 | + | |
432 | 467 | | |
433 | 468 | | |
434 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
281 | 288 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
287 | 302 | | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
292 | 311 | | |
293 | 312 | | |
294 | 313 | | |
| |||
0 commit comments