Fix KeyError when k8s omits optional reason field in container waiting status #60527#60805
Conversation
359ea64 to
fb5c8d9
Compare
|
hi @anishgirianish any clue when this fix will be attached to a Milestone and released ? |
|
Hi @dthauvin, thanks for your interest in this fix! For questions about milestones and release timelines, the maintainers would have a better idea. @jedcunningham @hussein-awala, would you be able to help with this? And whenever you have a moment, I'd really appreciate your feedback on this PR as well. Thank you! |
Nataneljpwd
left a comment
There was a problem hiding this comment.
Looks great!
I would maybe add a link to the request spec where it states that the field is optional as a comment to the code so that no one changes it later on
jscheffl
left a comment
There was a problem hiding this comment.
Cool! Thanks for the fix!
(And I'd really love if K8s generated API bindings would use fully-typed objects such that these type problems can be directly found by static type checks...)
Closes #60527
The k8s API spec defines
reasonandmessageas optional fields inContainerStateWaiting, but the code assumed they always exist. This causedKeyError: 'reason'crashes in the job watcher, leaving execution slots locked until scheduler restart.Fixed by using
.get()for safe access to these optional fields.Added test case for missing reason scenario.
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.