-
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
CT-2049: Add CommandCompleted event #7180
Conversation
For [CT-2049](#6878) we concluded that we wanted a new event type, [CommandCompleted](#6878 (comment)) with [four (4) values](#6878 (comment)): which command was run, whether the command succeeded, the timestamp that the command finished, and how long the command took. This commit adds the new event proto defition, the auto generated proto_types, and the instantiatable even type.
The [preflight decorator](https://github.com/dbt-labs/dbt-core/blob/4186f99b742b47e0e95aca4f604cc09e5c67a449/core/dbt/cli/requires.py#L19) runs at the start of every CLI invocation. Thus is a perfect candidate for emitting the CommandCompleted event. This is noted in the [dicussion on CT-2049](#6878 (comment)).
a4c05c3
to
dd256b4
Compare
dd256b4
to
10bce2c
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.
yo!! nice quick work - love to see an early draft PR :)
Previously, if `--fail-fast` was specified and an issue was run into or an unhandled issue became an exception, the CommandCompleted event would not get fired because at this point in the stack we'd be in exception thrown handling mode. If an exception does reach this point, we want to still fire the event and also continue to propogate the exception. Hence the bare `raise` exists to reraise the caught exception
We don't actually "always" need this event to be logged. Thus we've updated it to `Debug` level. [Discussion Context](#7180 (comment))
10bce2c
to
92cec27
Compare
# Bare except because we really do want to catch ALL exceptions, | ||
# i.e. we want to fire this event in ALL cases. | ||
except: # noqa | ||
fire_event( |
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.
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.
Totally okay doing it separately to keep each PR smaller.
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 agree that we should definitely work to fire that event again (and handle the fail fast exceptions better). I'm not opposed to taking on that work. However, I'd personally prefer to make it a separate PR to keep the PR process as smooth as possible.
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.
Agree - let's do it in a separate PR! Even though that issue is not scheduled for the current sprint, we definitely want it before the v1.5 RC - we have it tracked in #7162
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.
Looks good.
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 know it's already a little bloated, but it might be nice to move your work out of the preflight
decorator as that's meant to contain setup type initialization, not managing the resulting data.
Hey @stu-k! I'm happy to move it out of the |
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!!! Thanks for also have a loom videos showing how this works under all of the failure modes!
Also agreed on let's leave the |
@QMalcolm We can follow up on the moving into another place in another ticket! |
resolves #6878
Description
CT-2049 outlines a desire to have an event that is output on completion of any and every command. This PR adds that functionality. Below is a demo of the functionality in a loom video (clicking will redirect you to loom)
Checklist
changie new
to create a changelog entry