Skip to content

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
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Jun 21, 2023
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
@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/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants