Prevent error when starting an already running cluster #2947
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.
The
databricks clusters start
command returns an error if the target cluster is already in a RUNNING state, contrary to the help documentation, which states "If the cluster is not currently in a TERMINATED state, nothing will happen."My code for this commit modifies the command to first check the cluster's state and if it is already RUNNING, prints to console (e.g., "Cluster <cluster_id> is already running.") and exits gracefully (status code 0).
I've added an integration test to verify this behavior (an absolute cliche, but worked on my local for me) to ensure a cluster is in a RUNNING state and then attempts to start it, checking for the correct output message and a successful exit code.
FYI: I did a deep dive of the repo, then created documentation to understand deeply on deepwiki.org & finally leveraged Cline + Claude, and Google Jules for test case generation + verification (apologies, not always 100% sure about edge cases and thought to AI-augment my PR) to ensure I actually got it right. Let me know if this strategy is acceptable, else reject the PR and I'll create another to fix what all I missed.