[SPARK-58556][CONNECT][UI] Show ML cache status in Spark Connect UI - #57754
Draft
zhengruifeng wants to merge 10 commits into
Draft
[SPARK-58556][CONNECT][UI] Show ML cache status in Spark Connect UI#57754zhengruifeng wants to merge 10 commits into
zhengruifeng wants to merge 10 commits into
Conversation
Contributor
Author
|
Here is a simple end-to-end PySpark ML example for manually checking the UI. Start a Connect server from the built Spark checkout: ./sbin/start-connect-server.sh --master local[2]In another terminal, start a Connect PySpark shell: ./bin/pyspark --remote sc://localhost:15002Then run: from pyspark.ml.classification import LogisticRegression
from pyspark.ml.linalg import Vectors
training = spark.createDataFrame(
[
(1.0, Vectors.dense([0.0, 1.1, 0.1])),
(0.0, Vectors.dense([2.0, 1.0, -1.0])),
(0.0, Vectors.dense([2.0, 1.3, 1.0])),
(1.0, Vectors.dense([0.0, 1.2, -0.5])),
],
["label", "features"],
)
model = LogisticRegression(maxIter=5, regParam=0.01).fit(training)
model.transform(training).select("label", "prediction", "probability").show(
truncate=False
)Keep the PySpark shell open and visit |
Contributor
Author
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 changes were proposed in this pull request?
This PR adds a live ML cache status column to the session table in the Spark Connect UI.
For active sessions, the column shows the number of objects currently in memory and the current and maximum in-memory and total cache sizes. It also reports when memory control is disabled or the ML cache has not been used. Closed sessions and History Server views show
N/Abecause their live cache state is unavailable.The UI reads the cache status without updating the session's last-access time or initializing an unused ML cache.
Why are the changes needed?
Spark Connect ML models are cached per session, but operators currently cannot inspect cache utilization in the Spark UI. Showing the live status makes it easier to understand model retention, memory pressure, and disk offloading for each session.
Does this PR introduce any user-facing change?
Yes. The Spark Connect session table has a new
ML Cachecolumn showing live per-session cache utilization.How was this patch tested?
Added unit coverage for ML cache status collection and Connect UI rendering.
Tests have not been run yet; this is a draft PR.
git diff --checkpasses.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)