diff --git a/CHANGELOG.md b/CHANGELOG.md index ef72d365..e7403ed8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fixed CI MinIO client installation by following download redirects. - Suppressed Dremio Cloud folder-creation errors when a folder already exists. - Avoided creating existing folders during schema setup. +- Fix infinite hang on cancelled Dremio jobs by handling the CANCELED job state (single L) # dbt-dremio v1.10.0 diff --git a/dbt/adapters/dremio/api/cursor.py b/dbt/adapters/dremio/api/cursor.py index 99946aef..e7524fda 100644 --- a/dbt/adapters/dremio/api/cursor.py +++ b/dbt/adapters/dremio/api/cursor.py @@ -115,7 +115,7 @@ def _initialize(self): def _populate_rowcount(self): if self.closed: raise Exception("CursorClosed") - # keep checking job status until status is one of COMPLETE, CANCELLED or FAILED + # keep checking job status until status is one of COMPLETED, CANCELED or FAILED # map job results to AdapterResponse job_id = self._job_id @@ -132,7 +132,14 @@ def _populate_rowcount(self): error_message = job_status_response["errorMessage"] raise Exception(f"ERROR: {error_message}") - if job_status_state == "CANCELLED": + if job_status_state in ("CANCELED", "CANCELLED"): + cancellation_reason = job_status_response.get( + "cancellationReason" + ) + if cancellation_reason: + raise Exception( + f"Job was cancelled: {cancellation_reason}" + ) raise Exception("Job was cancelled") if job_status_state == "COMPLETED":