Repository navigation
Commit bda472d
authored
Fix deferrable KPO trigger_reentry crash when pod is GC'd before re-entry (#66716)
* Fix deferrable KPO trigger_reentry crash when pod is GC'd before re-entry
When KubernetesPodOperator runs in deferrable mode and the pod is reclaimed by
Kubernetes between the trigger firing and the worker re-entering the task,
the unguarded `self.pod = self.hook.get_pod(...)` in `trigger_reentry` raises
`ApiException(404)` and escapes. The dead-code `if not self.pod:` branch
intended to translate this to `PodNotFoundException` is never reached because
`get_pod` raises rather than returning `None`.
Wrap the `get_pod` call so that:
- Non-404 ApiExceptions re-raise unchanged.
- 404 + event status "success" returns cleanly (the trigger already observed
the pod completed successfully; logs/XCom are unrecoverable but the task
itself succeeded).
- 404 + non-success event raises `PodNotFoundException` (matches existing
dead-code intent).
Refs #66715.
* fix: apply ruff-format to new test signatures1 parent 41e16d5 commit bda472d
2 files changed
Lines changed: 93 additions & 2 deletions
File tree
- providers/cncf/kubernetes
- src/airflow/providers/cncf/kubernetes/operators
- tests/unit/cncf/kubernetes/operators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
969 | | - | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
970 | 989 | | |
971 | 990 | | |
| 991 | + | |
| 992 | + | |
972 | 993 | | |
973 | 994 | | |
974 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
3346 | 3351 | | |
3347 | 3352 | | |
3348 | 3353 | | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
3349 | 3419 | | |
3350 | 3420 | | |
3351 | 3421 | | |
| |||
0 commit comments