Include spark submit canonical logs in failure exceptions#70178
Merged
Conversation
amoghrajesh
requested review from
Lee-W,
gopidesupavan,
jason810496,
kaxil,
potiuk and
tirkarthi
July 21, 2026 10:35
1 task
Lee-W
reviewed
Jul 21, 2026
amoghrajesh
force-pushed
the
betterlog-spark-submit-trail
branch
from
July 22, 2026 11:36
a7418cd to
0b095a6
Compare
Lee-W
approved these changes
Jul 22, 2026
Member
|
This is useful as a baseline improvement over the current exit-code-only exception, but I’m not sure the last 20 lines will consistently include the root cause. Spark often logs the meaningful failure earlier and then ends with generic shutdown/final-status lines. |
shahar1
reviewed
Jul 22, 2026
shahar1
left a comment
Contributor
There was a problem hiding this comment.
Static checks currently fail
Lee-W
force-pushed
the
betterlog-spark-submit-trail
branch
from
July 23, 2026 01:49
0b095a6 to
94feefa
Compare
Member
|
rebase for the main for the CI fix |
eladkal
approved these changes
Jul 23, 2026
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.
Why?
Airflow only surfaced spark-submit's exit code when the process failed, discarding the JVM's actual stdout/stderr (missing jar, bad main class, Kerberos errors, etc.). Humans and Retry policies evaluating these exceptions had nothing but an exit code to reason from.
Some cases I encountered are when Spark's
SparkSubmitHook.submit()raisesAirflowExceptionon threefailure paths:
In all three cases the exception message contained only the masked command line and an exit code -- never the spark-submit process's own stdout/stderr, even though that output already streams through
_process_spark_submit_log()line by line and often contains the real cause (missing jar, bad main class, Kerberos failure, etc.).This makes root-causing failures harder for humans, and gives automated/LLM-based retry policies nothing to work with beyond an exit code cos they can't distinguish a transient submit infra hiccup from a permanent misconfiguration.
What
This PR adds a small rolling buffer of the last 20 lines of spark-submit's own output (
_last_submit_log_lines, populated in_process_spark_submit_log) and appends it, masked the same way the command line already is, to all three submit-failure exceptions via a new_format_submit_log_tail()helper. Example:Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.