Skip to content

Preserve Spark application failures after Spark stops on YARN - #12596

Open
aboitreaud wants to merge 1 commit into
masterfrom
adrien.boitreaud/fix-spark-yarn-exit-status
Open

aboitreaud wants to merge 1 commit into
masterfrom
adrien.boitreaud/fix-spark-yarn-exit-status

Conversation

@aboitreaud

@aboitreaud aboitreaud commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Wait for ApplicationMaster.finish() to finalize Spark application spans in YARN cluster mode, allowing the existing instrumentation to capture the driver's exit code and failure diagnostics after SparkContext.stop().

Motivation

Fixes a Spark application status gap between what the tracer reports (OK) and the expected ERROR.
A Python driver can create a Spark session, fail before submitting any jobs, and stop the session during cleanup before exiting nonzero. The application-end event previously finalized and flushed an "ok" span; the later YARN failure was ignored because the span had already ended.

The change applies only when spark.master=yarn and spark.submit.deployMode=cluster. OpenLineage notification and the shutdown fallback are preserved.

Contributor Checklist

  • Imperative title and required labels.
  • Formatting and targeted tests passed.
  • No source files added, moved, or deleted; no CODEOWNERS update needed.
  • No new configuration flags.

@aboitreaud aboitreaud added type: bug fix Bug fix inst: apache spark Apache Spark instrumentation tag: ai generated Largely based on code generated by an AI or LLM labels Sep 22, 2026
@aboitreaud
aboitreaud marked this pull request as ready for review September 22, 2026 02:19
@aboitreaud
aboitreaud requested review from a team as code owners September 22, 2026 02:19
@aboitreaud
aboitreaud requested review from ValentinZakharov and removed request for a team September 22, 2026 02:19
@datadog-prod-us1-4

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)

Suite Status
Startup 🟡 warning

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.79 s 14.72 s [-0.3%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 13.54 s 13.78 s [-2.5%; -1.0%] (significantly better)
startup:petclinic:appsec:Agent 17.54 s 17.40 s [-0.1%; +1.8%] (no difference)
startup:petclinic:iast:Agent 17.45 s 17.61 s [-1.9%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.43 s 17.42 s [-1.2%; +1.3%] (no difference)
startup:petclinic:sca:Agent 17.56 s 16.78 s [+0.4%; +9.0%] (maybe worse)
startup:petclinic:tracing:Agent 16.50 s 16.66 s [-1.9%; -0.1%] (maybe better)

Commit: a87b8177 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The change delays the Spark application span only in YARN cluster mode until ApplicationMaster.finish() supplies the exit status. Other modes keep application-end completion.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit a87b817 · @DataDog review to ask questions

@aboitreaud aboitreaud removed the tag: ai generated Largely based on code generated by an AI or LLM label Sep 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: apache spark Apache Spark instrumentation type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant