Add validate tirgger events in dbt cloud deferrable tasks#69739
Open
takayoshi-makabe wants to merge 4 commits into
Open
Add validate tirgger events in dbt cloud deferrable tasks#69739takayoshi-makabe wants to merge 4 commits into
takayoshi-makabe wants to merge 4 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.
DbtCloudRunJobOperator.execute_completeandDbtCloudJobRunSensor.execute_completeused the trigger event without validating it:event=None: happens when a deferred task resumes without a payload — a custom or subclassed trigger that yieldsTriggerEvent(None), or an event payload lost between the triggerer and the worker. Both methods crashed with an opaqueTypeError: 'NoneType' object is not subscriptable.status: happens on triggerer/worker version skew (a task defers under one provider version and resumes under another whose trigger emits a different status vocabulary) or with a custom trigger.DbtCloudRunJobTriggeremitssuccess/cancelled/error/timeout, but bothexecute_completemethods branch deny-list style (only specific failure statuses raise, everything else succeeds), so an unknown status fell through into the success path — the task was marked SUCCESS even though the dbt Cloud job outcome was unknown.timeoutat all — it only raised onerror/cancelled, so a job run that timed out while deferred was silently marked SUCCESS.This adds a
validate_execute_complete_event()helper (with a dedicatedDbtCloudTriggerEventException), applied at the top of bothexecute_completemethods. Same fix shape as the anthropic (#69379) and OpenAI (#69506) providers: theNonecheck mirrors the amazon provider's helper of the same name, and the status check plays the role amazon's call sites cover with theirif validated_event["status"] != "success": raiseallow-list branching.The sensor's fix also replaces a bare
raise AirflowException()(no message) withDbtCloudJobRunException(event["message"]), which both fixes the missingtimeouthandling and surfaces the trigger's actual message instead of an empty exception.The operator keeps its existing per-status branching (
cancelled/error/timeouteach have distinct messages, andtimeoutadditionally attempts job cancellation) sincevalidate_execute_complete_event()already closes the status set to the four values above.Was generative AI tooling used to co-author this PR?
Claude code
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.