Skip to content

[LIVY-1082] Add config to disable Kubernetes driver pod log polling - #557

Open
soumyadeeplogin wants to merge 1 commit into
apache:masterfrom
soumyadeeplogin:livy-item9-driver-log-polling-toggle
Open

soumyadeeplogin wants to merge 1 commit into
apache:masterfrom
soumyadeeplogin:livy-item9-driver-log-polling-toggle

Conversation

@soumyadeeplogin

@soumyadeeplogin soumyadeeplogin commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

SparkKubernetesApp currently fetches the driver pod's Kubernetes log (pods/<driver>/log) on every poll cycle to populate live log lines in /sessions/:id/log and /batches/:id/log responses. On large clusters, or when driver logs are already collected externally (e.g. via a centralized log pipeline / Spark History Server), this is wasted request volume against the Kubernetes API server, and can be a source of transient errors during pod lifecycle transitions.

This PR adds a new config, livy.server.kubernetes.driver-log-polling.enabled (default true, preserving existing behavior), that when set to false skips the pods/<driver>/log fetch while Livy continues to poll pod state and diagnostics normally.

Why are the changes needed?

To let operators opt out of the driver log poll when it's unnecessary, reducing Kubernetes API server load and avoiding transient log-fetch errors during pod lifecycle transitions, without losing pod state/diagnostics monitoring.

Does this PR introduce any user-facing change?

Yes. A new optional config livy.server.kubernetes.driver-log-polling.enabled is added (default true). When explicitly set to false, /sessions/:id/log and /batches/:id/log will no longer include live Kubernetes driver log lines; pod state and diagnostics continue to be polled and reported as before.

How was this patch tested?

Added/updated unit tests in SparkKubernetesAppSpec:

  • should enable driver log polling by default
  • resolveDriverAppLog - should skip fetching the log when driver log polling is disabled
  • resolveDriverAppLog - should fetch the log when driver log polling is enabled

Ran mvn -pl server -am test -Dtest=SparkKubernetesAppSpec -DwildcardSuites=org.apache.livy.utils.SparkKubernetesAppSpec; all 14 tests in the suite pass.

Was this patch authored or co-authored using generative AI tooling?

Yes, this patch was co-authored using Claude Code (Anthropic).

Livy fetches the driver pod's Kubernetes log (pods/<driver>/log) on
every poll cycle. On large clusters or when driver logs are already
collected externally (e.g. via a centralized log pipeline), this is
wasted load against the Kubernetes API server for log content that
is never read.

Add livy.server.kubernetes.driver-log-polling.enabled (default true)
to skip this fetch while still polling pod state and diagnostics.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@soumyadeeplogin

Copy link
Copy Markdown
Contributor Author

Filed LIVY-1082 for this change.

@soumyadeeplogin

Copy link
Copy Markdown
Contributor Author

Hi @gyogal / @roczei — could one of you approve the pending CI workflow run for this PR (fork-contributor approval gate)? Happy to address any review feedback as well. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant