Surface YARN diagnostics for spark on yarn clusters#70183
Merged
amoghrajesh merged 2 commits intoJul 22, 2026
Merged
Conversation
Lee-W
approved these changes
Jul 21, 2026
kaxil
approved these changes
Jul 21, 2026
amoghrajesh
force-pushed
the
enhance-spark-logs-with-yarn-diagnostics
branch
from
July 22, 2026 10:28
8895a86 to
34c1c26
Compare
Contributor
Author
|
cc @nailo2c fyi |
Contributor
Author
|
Unrelated failures, merging. |
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.
Was generative AI tooling used to co-author this PR?
Continuation of the exception-enrichment work for spark like: Better log when spark k8s driver remains in Unknown Phase and Include spark submit canonical logs in failure exceptions. Retry policies (LLM-based or deterministic) can only reason from what in the exception message, and Spark's YARN tracking
path was the thinnest of the three deploy modes --
_start_yarn_application_status_trackingraised only
"ended with state: FAILED, final status: FAILED", with no indication of why.Solution
YARN has a "diagnostics" field to provide detailed diag bundle for failures: https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html
Rather than assume the RM API's
diagnosticsfield is populated with anything useful, I triggered real jobs against a live cluster and captured the actual RM responses.HADOOP_MAPRED_HOMEenv)Application application_...0002 failed 2 times due to AM Container for appattempt_...000002 exited with exitCode: 1 ... Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster ...YARN application application_...0002 ended with state: FAILED, final status: FAILEDYARN application application_...0002 ended with state: FAILED, final status: FAILEDDiagnostics: Application application_...0002 failed 2 times due to AM Container for appattempt_...000002 exited with exitCode: 1 ... Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster ...pijob killed mid-flight viayarn application -killApplication application_...0005 was killed by user root at 192.168.117.5YARN application application_...0005 ended with state: KILLED, final status: KILLEDYARN application application_...0005 ended with state: KILLED, final status: KILLEDDiagnostics: Application application_...0005 was killed by user root at 192.168.117.5Both captured payloads were fed into
LLMRetryPolicyacross runbook instruction variants and all consistently classifiedFAIL, including on bare defaults (none), once the message carried the real diagnostics text. The killed job case also resolved an open question: "was killed by user root at <ip>" is unambiguous, distinct from how YARN phrasesscheduler-preemption terminations -- so diagnostics alone is enough to tell an explicit kill from an infra-driven one.
Proposed Change
_query_yarn_application_statusnow returnstuple[str, str, str](state,finalStatus,diagnostics), readingapp.get("diagnostics", "")._start_yarn_application_status_trackingappend\nDiagnostics: {diagnostics}when present; unchanged when absent.query_yarn_application_status(the normalized-status public method) updated to unpack the 3-tuple.{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.