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

Move the try outside the loop when this is possible in kubernetes provider #33977

Merged

Conversation

hussein-awala
Copy link
Member

related: #33975


^ 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.

@@ -354,8 +355,8 @@ def sync(self) -> None:
self.kube_scheduler.sync()

last_resource_version: dict[str, str] = defaultdict(lambda: "0")
while True:
try:
with contextlib.suppress(Empty):
Copy link
Member

@Lee-W Lee-W Sep 1, 2023

Choose a reason for hiding this comment

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

Will it break when Empty is raised as it used to be or just suppress it?

Copy link
Member

Choose a reason for hiding this comment

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

Empty should be raised by queue.get_nowait(), so previously this would be caught by the exception block to break the loop. Now Empty would be raised and break out of the loop, and then suppressed by this context manager. The end result should be the same.

@hussein-awala hussein-awala merged commit 1b122c1 into apache:main Sep 1, 2023
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants