Skip to content
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

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

vandonr-amz
Copy link
Contributor

also changed the status formatting in the logs so that it'd not be done if log level is not including INFO

cc @syedahsn

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))
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@syedahsn syedahsn left a 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

@o-nikolas o-nikolas merged commit 4797192 into apache:main Jun 22, 2023
42 checks passed
@vandonr-amz vandonr-amz deleted the vandonr/op branch June 22, 2023 17:35
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 27, 2023
Also changed the status formatting in the logs so that it'd not be done if log level is not including INFO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants