feat(tools): add list_cached_rdds tool for RDD storage info #252
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 623 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.385
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #252"
general
weight: 0.35
nabuskey
🔄 Pull Request
📝 Description
Adds a
list_cached_rddstool. It returns the data behind the Spark UI's Storage tab, so an agent can check whethercache()/persist()worked. Each entry has the RDD or DataFrame name, its storage level, how many of its partitions are cached, and the bytes it uses in memory and on disk. Until now no tool exposed this data. Issue #27 lists it aslist_rdds, and the CLI'sstoragecommand is still a stub.GET /applications/{app}/storage/rddreturns one entry per cached partition and a breakdown per executor. Both lists grow with the partition count and make up most of the response. The tool drops them unlessinclude_distributionorinclude_partitionsis set.offset/lengthwork as inlist_executors.rdd_idusesGET /storage/rdd/{rddId}. That endpoint also returns a persisted RDD that has no cached partitions. The listing leaves those out.SparkRestClientgainslist_storage_rddsandget_storage_rdd. Both use_resilient_call, so a YARN app with no attempt given falls back to its latest attempt, as the other methods do.spark.eventLog.logBlockUpdates.enabled=true(defaultfalse). Without it, the History Server reports no cached RDDs. A live Spark UI always tracks them. The tool docstring says this, and so does the README's Running Applications (Live Spark UI) section.🎯 Type of Change
<!-- Mark with [x] -->
🧪 Testing
<!-- Describe how you tested your changes -->
task test)🔬 Test Commands Run
- the client's app paths, plus the retry with the latest attempt
- ordering largest first, with ties broken by RDD ID
- trimming the lists by default, and each
include_*combination- pagination, and rejection of a negative
offset/length- the
rdd_idlookup- app1 caches a DataFrame, but its event log has no block updates, so the tool returns
[].- An unknown
rdd_idreturns the History Server's 404 as a tool error.- The whole HTTP e2e suite passes: 124 passed. The stdio tests were not run locally.
spark-submitonapache/spark:4.1.0withspark.eventLog.logBlockUpdates.enabled=true. The job did the following:- persisted a DataFrame with
MEMORY_AND_DISK(8 partitions)- cached a small DataFrame (2 partitions)
- cached and then unpersisted a third DataFrame
- persisted an RDD named
named-rddwithDISK_ONLY(4 partitions)Results:
-
list_cached_rddsreturned RDDs 7 (25.6 MB in memory), 49 (30.6 KB on disk) and 23 (6 KB), in that order. The unpersisted DataFrame was absent.- The default output was 1.1 KB. The raw endpoint returned 4.2 KB for these 14 cached partitions, and its size grows with the partition count.
-
include_distribution,rdd_idwithinclude_partitions,offset, andserverall returned what was expected.🛠️ New Tools Added (if applicable)
<!-- For new MCP tools -->
list_cached_rdds{"app_id": "app-123"},{"app_id": "app-123", "length": 5, "include_distribution": true},{"app_id": "app-123", "rdd_id": 7, "include_partitions": true}📸 Screenshots (if applicable)
N/A
✅ Checklist
📚 Related Issues
Related to #27
🤔 Additional Context
The tool returns the generated
RDDStorageInfomodel, asget_environmentreturnsEnvironment. The trimmed lists are set toNone, so they are left out of the serialized result. The other endpoints listed in #27 are left out of this PR.