Repository navigation
Write KubernetesJobOperator pod logs before raising on a failed Job - #76328
Open
Ankitraj-builds wants to merge 5 commits into
Open
Ankitraj-builds wants to merge 5 commits into
Ankitraj-builds wants to merge 5 commits into
Conversation
Ankitraj-builds
requested review from
hussein-awala,
jedcunningham and
jscheffl
as code owners
November 2, 2026 21:12
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
henry3260
reviewed
Nov 3, 2026
henry3260
left a comment
Member
There was a problem hiding this comment.
Looks good, leave some comments
Contributor
Author
|
Hi @jscheffl , I’ve addressed @henry3260’s review (retry pods are now logged too, and the tests are parametrized). Could you take a look when you have time? The CI workflows are also waiting for approval. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #76325
In deferrable mode,
KubernetesJobOperator.execute_completeraised onstatus == "error"before theget_logsblock, so the pod logs of a failed Job were never written. Withon_finish_action="delete_pod"the pod is then deleted, so the cause of the failure was lost.This writes the pod logs first and raises afterwards. A failure while writing logs is logged as a warning, so it doesn't replace the Job's own error.
Tests:
test_execute_complete_fail_writes_logs: logs are written for a failed Job, and the Job error is still raised.test_execute_complete_fail_log_error_keeps_job_error: an error while writing logs doesn't hide the Job error.Both fail on main and pass with this change. All 95 tests in
test_job.pypass.