Skip to content

fix: filter compute discovery to interactive cluster sources - #31

Merged
Tomoscorbin merged 1 commit into
mainfrom
fix/filter-compute-list-by-source
Aug 3, 2026
Merged

fix: filter compute discovery to interactive cluster sources#31
Tomoscorbin merged 1 commit into
mainfrom
fix/filter-compute-list-by-source

Conversation

@Tomoscorbin

Copy link
Copy Markdown
Owner

Problem

:DatabricksInit hangs "looking for computes" for minutes on shared workspaces. The compute helper (cli.py) calls client.clusters.list() with no filter, so the SDK paginates through every cluster in the workspace before the plugin reports readiness — and blocks DatabricksRunCell the whole time.

On our shared marketplace workspace this is 22,590 clusters, almost all ephemeral JOB clusters from other teams. A full list takes ~7m51s. project_compute then 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):

Before After
Clusters fetched 22,590 3
Wall time ~7m51s ~4.2s
  • Added test_cli_requests_only_interactive_cluster_sources (TDD: red -> green).
  • Full python suite: 81 passed. mypy and ruff clean.
  • End-to-end run of the helper through the managed venv returns valid protocol JSON.

🤖 Generated with Claude Code

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.
@Tomoscorbin
Tomoscorbin merged commit b6fdeef into main Aug 3, 2026
3 checks passed
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