Fix infinite hang when Dremio job is cancelled (CANCELED vs CANCELLED)#322
Open
shanmugapriya5c wants to merge 2 commits into
Open
Fix infinite hang when Dremio job is cancelled (CANCELED vs CANCELLED)#322shanmugapriya5c wants to merge 2 commits into
shanmugapriya5c wants to merge 2 commits into
Conversation
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.
Summary
Fix infinite hang on cancelled Dremio jobs by handling the CANCELED job state (single L)
Description
[DremioCursor._populate_rowcount()] polls Dremio job status in a while True loop and treats FAILED, COMPLETED, and CANCELLED (double L) as terminal states. However, Dremio's REST API returns the American spelling CANCELED (single L) for cancelled jobs — whether cancelled by a user, by the engine (e.g. low memory), or by hitting a workload-management queue timeout.
Because the loop only checked for CANCELLED, a real CANCELED job never matched any terminal branch, so the poller looped forever. dbt never raised, never failed, and never returned — the run hung indefinitely (and, for orchestrators like Dagster/Airflow, the step neither failed nor cancelled). This is reproducible by letting a query exceed its WLM queue timeout, or by cancelling the job from the Dremio Jobs UI.
Reference — Dremio Job API jobState enum (final states are COMPLETED, CANCELED, FAILED): https://docs.dremio.com/cloud/reference/api/job/
Changes in [cursor.py]:
Match both CANCELED and CANCELLED as terminal cancellation states and raise (previously only CANCELLED).
Surface Dremio's cancellationReason in the error message when present (e.g. queue-timeout reason), falling back to "Job was cancelled" for backward compatibility with the existing message.
Updated the stale loop comment (COMPLETE, CANCELLED → COMPLETED, CANCELED).
The fix is intentionally minimal and preserves the existing exception type/message contract.
Test Results
All tests are passing
Changelog
Contributor License Agreement
Related Issue
NA