fix: filter compute discovery to interactive cluster sources - #31
Merged
Conversation
The compute helper listed every cluster in the workspace before the plugin reported readiness. On shared workspaces this can be tens of thousands of ephemeral JOB clusters (observed: 22,590), taking ~8 minutes and blocking DatabricksRunCell the entire time. Restrict the SDK list call to UI/API sources via ListClustersFilterBy, so the API returns only the interactive compute a notebook could attach to. Discovery drops from ~8m to ~4s against the same workspace.
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.
Problem
:DatabricksInithangs "looking for computes" for minutes on shared workspaces. The compute helper (cli.py) callsclient.clusters.list()with no filter, so the SDK paginates through every cluster in the workspace before the plugin reports readiness — and blocksDatabricksRunCellthe whole time.On our shared marketplace workspace this is 22,590 clusters, almost all ephemeral
JOBclusters from other teams. A full list takes ~7m51s.project_computethen discards nearly all of them (usable = state == RUNNING and source != JOB), so the fetch is wasted work.Fix
Pass
filter_by=ListClustersFilterBy(cluster_sources=[UI, API])to the list call, so the API returns only the interactive compute a notebook can attach to.Verification
Live against the affected workspace (managed venv, patched helper):
test_cli_requests_only_interactive_cluster_sources(TDD: red -> green).mypyandruffclean.🤖 Generated with Claude Code