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

Fix/futures context #1512

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Fix/futures context #1512

merged 3 commits into from
Jan 7, 2025

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented Jan 6, 2025

Describe your changes

Fixed

  • Occasional crash during FuturesExecutorMixin cleanup.

Deprecated

  • FuturesExecutorMixin.futures_executor. Use FuturesExecutorMixin.create_futures_executor instead.

Issue ticket number and link

Closes #1507

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@collindutter collindutter marked this pull request as ready for review January 6, 2025 18:30
@collindutter collindutter force-pushed the fix/futures-context branch 2 times, most recently from 0df9525 to b72086b Compare January 6, 2025 18:52
@collindutter collindutter enabled auto-merge January 6, 2025 19:20

def __raise_deprecation_warning(self) -> None:
warnings.warn(
"`FuturesExecutorMixin.futures_executor` is deprecated and will be removed in a future release. Use `FuturesExecutorMixin.create_futures_executor` instead.",
Copy link
Member

Choose a reason for hiding this comment

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

maybe specify "use FuturesExecutorMixin.create_futures_executor() as a context manager instead."? better to be explicit

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically you could use it not as a context manager:

executor = self.create_futures_executor()
executor.shutdown()

Comment on lines -21 to -29
def __del__(self) -> None:
executor = self.futures_executor

if executor is not None:
self.futures_executor = None # pyright: ignore[reportAttributeAccessIssue] In practice this is safe, nobody will access this attribute after this point

with contextlib.suppress(Exception):
# don't raise exceptions in __del__
executor.shutdown(wait=True)
Copy link
Member

Choose a reason for hiding this comment

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

is this currently safe to remove without causing the issues that caused it to be added?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe that was resolved by #1074. This particular method was only introduced as a clean-up effort.

@collindutter collindutter requested a review from vachillo January 7, 2025 20:56
@collindutter collindutter added this pull request to the merge queue Jan 7, 2025
Merged via the queue into main with commit 446df15 Jan 7, 2025
16 checks passed
@collindutter collindutter deleted the fix/futures-context branch January 7, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Attribute Futures Executor
2 participants