clusters start: make the command idempotent when cluster is already active#5776
Open
sridhar-3009 wants to merge 1 commit into
Open
clusters start: make the command idempotent when cluster is already active#5776sridhar-3009 wants to merge 1 commit into
sridhar-3009 wants to merge 1 commit into
Conversation
…ctive The Databricks API rejects a start request with INVALID_STATE when the cluster is not in TERMINATED state, but the documentation says "If the cluster is not currently in a TERMINATED state, nothing will happen." Before this change, running `databricks clusters start <id>` on an already-running cluster produced an error. After this change the command checks the cluster state first and exits with a log message if the cluster is already active (RUNNING, RESIZING, PENDING, etc.), matching the documented behavior. Fixes databricks#1372
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Contributor
Waiting for approvalBased on git history, these people are best suited to review:
Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
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
databricks clusters start <cluster-id>fails with an error when the cluster is already running:The Databricks documentation states:
The CLI was propagating the API's
INVALID_STATEresponse as a hard error instead of treating it as a no-op.Fix
Added a
startIdempotentOverrideincmd/workspace/clusters/start_idempotent.gothat wraps the generated command'sRunE. Before calling the API, it fetches the current cluster state. If the cluster is already in any non-TERMINATED state (RUNNING, RESIZING, PENDING, etc.), it logs a message and returns nil, matching the documented behavior.The original RunE is still called for TERMINATED clusters and for cases where no cluster ID is available before the picker runs.
Tests
Added unit tests covering:
Fixes #1372