-
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
Persist timing info for failed nodes #7353
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.
Can you write a test here?
|
||
def test_timing_exists(self, project): | ||
results = run_dbt(["run"]) | ||
assert results.results[0].timing |
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 you want to do something like this:
for result in results.results:
assert isinstance(result, TimingInfo)
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.
results.results
is a list of RunResult
s, not TimingInfo
. RunResult
has a timing
attribute on it which is a list of TimingInfo
s. What I'm doing here is asserting that this list of TimingInfo
s is not empty.
There should however only ever be one result in results.results
since only one model is run for each of these tests, so I will add an assertion for that.
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!
Go @stu-k :) |
resolves #5476
Description
Since python's context managers
__exit__
method still runs if the code they wrap throws an exception, added a callback to thecollect_timing_info
context manager to handle persisting the timing info for failed nodes toctx.timing
.Checklist
changie new
to create a changelog entry