-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create skip_nodes_if_on_run_start_fails
behavior change flag
#10699
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10699 +/- ##
=======================================
Coverage 89.16% 89.17%
=======================================
Files 183 183
Lines 23258 23288 +30
=======================================
+ Hits 20738 20767 +29
- Misses 2520 2521 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
skip_nodes_if_on_run_start_fails
to allow skipping nodes if on-run-start
hooks fail
skip_nodes_if_on_run_start_fails
to allow skipping nodes if on-run-start
hooks failskip_nodes_if_on_run_start_fails
behavior change flag
skip_nodes_if_on_run_start_fails
behavior change flagskip_nodes_if_on_run_start_fails
behavior change flag
@aranke Behavior flag looks good, as does the "happy path" for skipping downstream nodes when it's enabled. When the behavior flag is not set / disabled, it works as before and the logs are even a bit nicer 👍 I found a few corner cases around
# dbt_project.yml
on-run-start:
- "select 1 as id"
- "select column_does_not_exist"
- "select 2 as id"
flags:
skip_nodes_if_on_run_start_fails: True The first run fails as expected, and skips models from running (good!):
Now retry, with weird numbering. dbt thinks it's running 4 total models (I think because the failed/skipped hooks are counted):
Fix the syntax error in second hook, retry again. dbt will successfully run the hooks and build the models, but it also tries to build the hooks as models...
|
@jtcohen6 Thanks for reviewing the behavior here, and good catch! I've tweaked the logic in I've also added a test for this case, but here are the new logs with the fix applied:
|
@jtcohen6 are there any other corner cases here I should fix before merging in this PR? If not, would appreciate a 👍🏾 on the PR. Thanks once again for taking the time to review this PR right before the Coalesce crunch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aranke Thanks for fixing! That's the only issue I found in my testing. This looks fit to ship 👍
Resolves #7387
Problem
Solution
I'm documenting how this PR is currently implemented, open to questions/comments/concerns.
Behavior
on-run-start/end
hooks are run in serial (--threads 1
)run_results.json
at the end of the runskip_nodes_if_on_run_start_fails
project config flagon-run-start
hook fails, mark all selected nodes as skippedon-run-start/end
hooks are always run, regardless of whether they passed or failed last timesource_freshness_run_project_hooks
is set toFalse
Implementation
before_run
to return aRunStatus
instead ofNone
so we can implement some railway-oriented programmingsafe_run_hooks
andrun_hooks
into a single method to make logic easier to followget_execution_status
method to encapsulateRunStatus
logicHookNode
toResultNode
union typetest_run_hooks
→test_on_run_hooks
with the following tests:None
/False
/True
run_results.json
are still surfacedretry
to run hooks even if they succeeded last timeChecklist