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(python): Release the GIL in Python APIs, part 2 of 2 #19762

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

itamarst
Copy link
Contributor

@itamarst itamarst commented Nov 13, 2024

Fixes #19382

This (hopefully) covers the rest of the APIs. I skipped APIs that seemed immediate, and so I may have missed some, but hopefully coverage is significantly better.

There should be no other meaningful code changes, just GIL releasing.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Nov 13, 2024
for i in invalid_indices {
validity.set(i, false);
pub fn to_struct(&self, py: Python, name: &str, invalid_indices: Vec<usize>) -> PySeries {
py.allow_threads(|| {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same code, just indented.

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 91.63347% with 21 lines in your changes missing coverage. Please review.

Project coverage is 79.55%. Comparing base (8cb7839) to head (b6b69d3).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-python/src/dataframe/general.rs 93.81% 12 Missing ⚠️
crates/polars-python/src/map/series.rs 42.85% 8 Missing ⚠️
crates/polars-python/src/cloud.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #19762   +/-   ##
=======================================
  Coverage   79.55%   79.55%           
=======================================
  Files        1544     1544           
  Lines      213240   213325   +85     
  Branches     2441     2441           
=======================================
+ Hits       169643   169720   +77     
- Misses      43048    43056    +8     
  Partials      549      549           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wukan1986
Copy link

Can map_batches release the GIL?

@ritchie46 ritchie46 merged commit 869d1b9 into pola-rs:main Nov 14, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release GIL as much as possible in PySeries and PyDataFrame methods
4 participants