-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
add async wait method to the "with logging" aws utils #32055
Conversation
also changed the status formatting in the logs so that it'd not be done if log level is not including INFO
@@ -68,23 +70,81 @@ def wait( | |||
except WaiterError as error: | |||
if "terminal failure" in str(error): | |||
raise AirflowException(f"{failure_message}: {error}") | |||
status_string = _format_status_string(status_args, error.last_response) | |||
log.info("%s: %s", status_message, status_string) | |||
log.info("%s: %s", status_message, _LazyStatusFormatter(status_args, error.last_response)) |
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.
Just so I'm understanding this correctly, the __str__
of _LazyStatusFormatter
will only be called if the log is actually being printed, which saves computation time right?
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.
yes, we pass the object itself to the logger, and it only calls __str__
if the log level requires it.
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.
Nice, looks good to me
Also changed the status formatting in the logs so that it'd not be done if log level is not including INFO
also changed the status formatting in the logs so that it'd not be done if log level is not including INFO
cc @syedahsn