-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Handle internal exceptions in postflight #7242
Conversation
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.
Thanks for throwing up the draft PR so early @stu-k!
79f30aa
to
d0567bc
Compare
d0567bc
to
7bf96bd
Compare
7bf96bd
to
5d256d0
Compare
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.
The changes look good and through. We should figure out a bit about the impact of the interface update before merge.
@@ -17,4 +17,4 @@ | |||
# initialize the runner with pre-loaded profile and project, you can also pass in a preloaded manifest | |||
dbt = dbtRunner(profile=profile, project=project) | |||
# run the command, this will use the pre-loaded profile and project instead of loading | |||
res, success = dbt.invoke(cli_args) | |||
res = dbt.invoke(cli_args) |
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.
This actually changed our previous interface a bit, two other places someone should update once this is merged
I probably will do the first one and CC @racheldaniel for the second one.
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.
Thank you!
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.
I think we should maintain the previous interface if we can.
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.
As discussed during quick huddle last week - I'm okay with changing the interface here. It's only being used in a few places, only for v1.5+, and we can handle those changes. Unless we think the previous interface (returning & unpacking a tuple) is strictly better, more important that we get this right going forward.
We may just need a bit of conditional logic in those call sites, since this change will roll out in HEAD
before we include it in a new v1.5 prerelease.
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.
My bad, I missed that we're returning a data class now.
Aligned with the approach outlined here.
@@ -17,4 +17,4 @@ | |||
# initialize the runner with pre-loaded profile and project, you can also pass in a preloaded manifest | |||
dbt = dbtRunner(profile=profile, project=project) | |||
# run the command, this will use the pre-loaded profile and project instead of loading | |||
res, success = dbt.invoke(cli_args) | |||
res = dbt.invoke(cli_args) |
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.
I think we should maintain the previous interface if we can.
* Add code example to cli/README.md * Remove optional from DbtRunnerResult's result attribute to add None for better comments on which task returns what type * Use exc.exit_code for an int comparison when handling a click Exit exception * Split apart exception cases when handling in postflight * Remove unnecessary test file
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.
Mostly LGTM, but I'll wait for Chenyu to provide the final approval.
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.
LGTM!
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.
This PR is awesome!! Really appreciative of the thorough README :)
resolves #7118
Description
dbt
thrown exceptions in thepostflight
decoratorDbtRunnerResult
dataclass with the intent ofdbtRunner.invoke
not throwing exceptionscli.invoke
withindbtRunner.invoke
dbt/cli/README.md
run_dbt
method fromtests/util.py
to raise any exceptions returned fromdbtRunner.invoke
dbt/cli/exceptions.py
Checklist
changie new
to create a changelog entry