Skip to content

clusters start: no-op when cluster isn't TERMINATED - #6344

Open
dkling-it wants to merge 1 commit into
databricks:mainfrom
dkling-it:fix/clusters-start-already-running
Open

clusters start: no-op when cluster isn't TERMINATED#6344
dkling-it wants to merge 1 commit into
databricks:mainfrom
dkling-it:fix/clusters-start-already-running

Conversation

@dkling-it

Copy link
Copy Markdown

Changes

databricks clusters start returns an API error if the target cluster isn't TERMINATED (e.g. it's already RUNNING). The command's own help text says otherwise: "If the cluster is not currently in a TERMINATED state, nothing will happen." This PR makes the command match that text: on INVALID_STATE, it prints a short message and exits 0 instead of failing.

Why

Fixes #1372. Scripts that call clusters start to make sure a cluster is up (a common idempotent pattern) currently have to special-case this error themselves. A previous attempt at this fix (#2947) took a similar approach but stalled and auto-closed without maintainer feedback.

Tests

Added cmd/workspace/clusters/overrides_test.go, covering:

  • INVALID_STATE is swallowed and the command returns nil
  • any other error still propagates unchanged

go build ./cmd/workspace/clusters/... and go vet ./cmd/workspace/clusters/... pass. I don't have a Databricks workspace to run this against a live already-running cluster, so I'd appreciate a maintainer or CI check on that path.

`databricks clusters start` returns an INVALID_STATE API error if the
target cluster is already RUNNING/PENDING/RESTARTING/RESIZING, even
though the command's own help text says "If the cluster is not
currently in a TERMINATED state, nothing will happen."

Wrap the generated start command's RunE (mirrors the same INVALID_STATE
handling already used in bundle/direct/dresources/cluster.go) so that
error is swallowed and treated as a successful no-op instead.

Fixes databricks#1372

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @janniklasrose -- recent work in .nextchanges/cli/, cmd/workspace/clusters/

Eligible reviewers: @andrewnester, @anton-107, @denik, @lennartkats-db, @pietern, @rclarey, @renaudhartert-db, @rugpanov, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6344
  • Commit SHA: 36958cab23981656cde11d5c554adc60175b8a7c

Checks will be approved automatically on success.

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.

databricks clusters start fails if cluster is already running, despite documentation to the contrary

1 participant