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

Apply flake8-logging-format changes to core #24977

Closed
wants to merge 1 commit into from

Conversation

josh-fell
Copy link
Contributor

@josh-fell josh-fell commented Jul 11, 2022

Related: #23597 #24910

This is some pre-work for hopefully/maybe including the flake8-logging-format extension in CI. There are roughly 88 file changes so splitting these up into smaller chunks.

After the initial sweeps are completed we can do a final pass when formally implementing the extension in CI.

I'm not entirely certain if there are impacts to useful info that will be missed with log handlers but would love feedback on general patterns.

  • Fix failing tests

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:CLI provider:cncf-kubernetes Kubernetes provider related issues area:providers area:Scheduler including HA (high availability) scheduler area:webserver Webserver related Issues provider:google Google (including GCP) related issues labels Jul 11, 2022
@josh-fell josh-fell removed provider:google Google (including GCP) related issues area:providers labels Jul 11, 2022
@@ -106,7 +106,7 @@ def create_db(self):
log.info(c.LOGMSG_INF_SEC_ADD_DB)
super().create_db()
except Exception as e:
log.error(c.LOGMSG_ERR_SEC_CREATE_DB.format(str(e)))
log.error(c.LOGMSG_ERR_SEC_CREATE_DB.format(str(e))) # noqa: G001
Copy link
Member

@potiuk potiuk Jul 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we extract a common function doing the logging? Then we could ignore just once.

log_error(c.LOGMSG_ERR_SEC_CREATE_DB, e)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or:

log_message(Logging.WARNING,c.LOGMSG_ERR_SEC_CREATE_DB, e)

To account for different log levels? That would also allow to make it performant with "if log.level< level)"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the ignore because it was FAB and I assume we just copy directly without making modifications, but I could be wrong. I was thinking adding the ignores would be the least invasive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The common logging function is a cool and intriguing idea though. Let's see what I can cook up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought sqa/manager is ours :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if it is FAB, then I'd simply exclude the whole file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like FAB generally is a mix of both. It's copied and then modified accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Seen that In SecurityManager. 🤯

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks cool

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 29, 2022
@josh-fell josh-fell removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 29, 2022
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 14, 2022
@github-actions github-actions bot closed this Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:CLI area:Scheduler including HA (high availability) scheduler area:webserver Webserver related Issues provider:cncf-kubernetes Kubernetes provider related issues stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants