feat(spark): add get_job_metrics to SparkClient - #692
Open
Sharkyii wants to merge 1 commit into
Open
Conversation
Batch jobs have status and logs but no visibility into what's actually running, no executor count, no task progress. This pulls basic runtime metrics off the driver's web UI service via Spark's own REST API. Looks the UI service up by the sparkoperator.k8s.io/app-name label instead of guessing its name, since the operator truncates and hashes names past the 63 char DNS limit. Falls back to an empty SparkJobMetrics rather than raising when the service isn't there yet, already gone, or the operator has it disabled entirely. Part of the observability work tracked in kubeflow#655 and scoped in kubeflow#689. Signed-off-by: Sneh Kansagara <snehkansagara@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.
What this PR does / why we need it:
SparkClient.get_jobandget_job_logscover status and logs for a batch job, but there's no visibility into what's actually happening while it runs, no executor count, no task progress, nothing. This addsget_job_metrics(name), which pulls basic runtime metrics from Spark's own REST API on the driver's web UI (executor counts, task counts, stage progress).The Spark Operator creates a Service for the driver web UI on every SparkApplication. Rather than constructing that name (
<app-name>-ui-svc), which the operator itself truncates and hashes past the 63 character DNS label limit, this looks the service up by thesparkoperator.k8s.io/app-namelabel the operator sets on it, and reuses the existing port-forward pattern fromget_connect_urlfor out-of-cluster access.Returns an empty
SparkJobMetricsinstead of raising when metrics aren't available, covering three real cases: the driver hasn't started yet, the SparkApplication has already been cleaned up, or the cluster's Spark Operator was deployed with--enable-ui-service=false(defaults to true, but it's an operator-level flag, so it can't be assumed present).Opening as a draft since the approach hasn't had maintainer eyes on it yet, see the open questions on #689. Happy to adjust the field set on
SparkJobMetricsor the fallback behavior based on feedback.Testing done:
make verify(ruff check + format) cleanuv run pytest kubeflow/spark/passes (268 tests)Which issue(s) this PR fixes:
Fixes #689
Checklist: