-
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
Ensure run results artifact get written during "after run hooks" #10941
Ensure run results artifact get written during "after run hooks" #10941
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10941 +/- ##
==========================================
- Coverage 89.19% 89.12% -0.08%
==========================================
Files 183 183
Lines 23496 23508 +12
==========================================
- Hits 20958 20951 -7
- Misses 2538 2557 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Previously in `get_execution_status` if a non `DbtRuntimeError` exception was raised, the finally would be entered, but the `status`/`message` would not be set, and thus a `status not defined` exception would get raised on attempting to return. Tangentially, there is another issue where somehow the `node_status` is becoming `None`. In all my playing with `get_execution_status` I found that trying to return an undefined variable in the `finally` caused an undefined variable exception. However, if in some python version, it instead just handed back `None`, then this fix should also solve that.
0801f6e
to
2929b89
Compare
@@ -94,11 +94,16 @@ def get_execution_status(sql: str, adapter: BaseAdapter) -> Tuple[RunStatus, str | |||
response, _ = adapter.execute(sql, auto_begin=False, fetch=False) | |||
status = RunStatus.Success | |||
message = response._message | |||
except (KeyboardInterrupt, SystemExit): | |||
raise |
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.
checking my own understanding -- these are eventually handled further along, here: https://github.com/dbt-labs/dbt-core/pull/10941/files#diff-299afe4cac0de7af89561129dd7c55a07bd53c06baafff397b51b460bc631bceR804?
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.
Correct!
Resolves #10934
Problem
Occasionally there would be an unhandled exception during the execution of on run end hooks. Because the exception wasn't being handled, the
run_results.json
artifact was not being written.Solution
Handle more exception cases during the execution of on run end hooks.
Demo
Fixing no run_results.json
Checklist