Skip to content

Commit

Permalink
fix: race condition on cluster creation (#751)
Browse files Browse the repository at this point in the history
Signed-off-by: Juri Krainjukov <[email protected]>
  • Loading branch information
jurasan authored Jul 31, 2024
1 parent 669c5b8 commit 38aefbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Always use lower case when gathering metadata (since objects are stored internally as lower case regardless of how we create them) ([742](https://github.com/databricks/dbt-databricks/pull/742))
- Persist table comments for python models ([743](https://github.com/databricks/dbt-databricks/pull/743))
- Stop cursor destructor warnings ([744](https://github.com/databricks/dbt-databricks/pull/744))
- Race condition on cluster creation. (thanks @jurasan!) ([751](https://github.com/databricks/dbt-databricks/pull/751))

## dbt-databricks 1.8.4 (July 17, 2024)

Expand Down
4 changes: 3 additions & 1 deletion dbt/adapters/databricks/python_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ def start_cluster(self) -> None:
json={"cluster_id": self.cluster_id},
)
if response.status_code != 200:
raise DbtRuntimeError(f"Error starting terminated cluster.\n {response.content!r}")
current_status = self.get_cluster_status().get("state", "").upper()
if current_status not in ["RUNNING", "PENDING"]:
raise DbtRuntimeError(f"Error starting terminated cluster.\n {response.content!r}")

self._wait_for_cluster_to_start()

Expand Down

0 comments on commit 38aefbf

Please sign in to comment.