-
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
Fix petits logging regressions from feature/click-cli
merge
#6940
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. |
fmt = LineFormat.PlainText | ||
if log_format == "json": | ||
fmt = LineFormat.Json | ||
elif debug: | ||
fmt = LineFormat.DebugText | ||
level = EventLevel.DEBUG if debug else EventLevel.INFO | ||
# We don't have access to these values when we need to setup the default stdout logger! |
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.
@peterallenwebb I don't think we'll be able to solve #6847 in the same way you did #6886, because we now need a click Context to access flags.QUIET
(even if it's passed in on the CLI), and we don't have access to that as early as we used to.
That approach was always a bit opportunistic, so I don't feel like this is a huge deal. Open to ideas for sure.
core/dbt/tracking.py
Outdated
# import click.Abort as clickAbortError | ||
# except clickAbortError: # a.k.a. MainKeyboardInterrupt | ||
# if the logger isn't configured yet, it will use the default logger | ||
# fire_event(MainKeyboardInterrupt()) # how much do we care about this? | ||
# 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.
Trying to emulate this logic:
Lines 142 to 145 in 4d0ee2f
except KeyboardInterrupt: | |
# if the logger isn't configured yet, it will use the default logger | |
fire_event(MainKeyboardInterrupt()) | |
exit_code = ExitCodes.UnhandledError.value |
Not sure of exactly how this works now. The only thing we're losing out on is a structured event (MainKeyboardInterrupt
) recording that a run was cancelled. Still, that might be cause enough to want to keep this logic around.
core/dbt/tracking.py
Outdated
if not isinstance(e, dbtException): | ||
fire_event(MainStackTrace(stack_trace=traceback.format_exc())) |
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.
Emulating this logic:
Lines 151 to 155 in 4d0ee2f
except BaseException as e: | |
fire_event(MainEncounteredError(exc=str(e))) | |
if not isinstance(e, dbtException): | |
fire_event(MainStackTrace(stack_trace=traceback.format_exc())) | |
exit_code = ExitCodes.UnhandledError.value |
I'm going to kick this piece out of the present PR, and prioritize the simpler & less controversial changes for now |
flags_dict_str = cast_dict_to_dict_of_strings(get_flag_dict()) | ||
fire_event(MainReportArgs(args=flags_dict_str)) |
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 values needs to be stringified first, because it's defined as Dict[str, str]
:
dbt-core/core/dbt/events/types.proto
Lines 82 to 85 in f1087e5
// A002 | |
message MainReportArgs { | |
map<string, string> args = 1; | |
} |
(The good news is, this was caught by some of our functional tests!)
As discussed during BLG on Friday, we should investigate if we can support the Struct
proto type (Dict[str, Any]
): #6803 (comment)
This reverts commit 26f22d9.
60a0f03
to
05661a9
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.
Looks good.
resolves #6933
Description
main.py
EventManager
initialization, to fix--log-cache-events
. I think we have access to less than we used to(?)track_run
, matching oldmain.py
. Not sure if we need/want to do thisChecklist
I have opened an issue to add/update docs, or docs changes are not required/relevant for this PRchangie new
to create a changelog entry