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

feat(python): release GIL for common functions #2269

Closed

Conversation

franz101
Copy link
Contributor

@franz101 franz101 commented Mar 9, 2024

Description

Inspired by the previous request to release the GIL added to most common functions.

Related Issue(s)

#2234

If some function are not supported / should not be released or I forgot to add the function, happy to modify the PR

@github-actions github-actions bot added binding/python Issues for the Python package documentation Improvements or additions to documentation labels Mar 9, 2024
@mrocklin
Copy link

I'm excited for this. Thanks for working on it @franz101 ! Looking briefly it looks like the linter is sad.

let (table, metrics) = rt()?
.block_on(cmd.into_future())
.map_err(PythonError::from)?;
self._table.state = table.state;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we move updating the table state outside of the allow_threads call? this requires mutating self, which should be done while holding the GIL.

Same thing applies to other methods.

@ion-elgreco ion-elgreco force-pushed the feature/release_gil_common_patterns branch from 36206bd to 97967cb Compare March 13, 2024 22:08
@adriangb
Copy link
Contributor

adriangb commented May 8, 2024

For the cases when you need the GIL, could you also release it and re-acquire it when needed, if the fraction of time it's not needed is large?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants