Skip to content

TST Fix test_nested_parallel_warnings_parent_backend for Python nogil#1394

Merged
tomMoral merged 2 commits intojoblib:masterfrom
lesteve:nogil-len-warnings
Feb 20, 2023
Merged

TST Fix test_nested_parallel_warnings_parent_backend for Python nogil#1394
tomMoral merged 2 commits intojoblib:masterfrom
lesteve:nogil-len-warnings

Conversation

@lesteve
Copy link
Copy Markdown
Member

@lesteve lesteve commented Feb 17, 2023

Another fix for making the test pass with Python nogil

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 17, 2023

Codecov Report

Base: 93.32% // Head: 94.04% // Increases project coverage by +0.71% 🎉

Coverage data is based on head (18d762c) compared to base (83ba40f).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1394      +/-   ##
==========================================
+ Coverage   93.32%   94.04%   +0.71%     
==========================================
  Files          52       52              
  Lines        7300     7343      +43     
==========================================
+ Hits         6813     6906      +93     
+ Misses        487      437      -50     
Impacted Files Coverage Δ
joblib/test/test_parallel.py 97.06% <100.00%> (+0.24%) ⬆️
joblib/memory.py 95.26% <0.00%> (+0.01%) ⬆️
joblib/test/test_memory.py 98.58% <0.00%> (+0.14%) ⬆️
joblib/parallel.py 96.56% <0.00%> (+0.52%) ⬆️
joblib/test/test_func_inspect.py 91.36% <0.00%> (+0.74%) ⬆️
joblib/_store_backends.py 91.58% <0.00%> (+0.81%) ⬆️
joblib/func_inspect.py 92.43% <0.00%> (+1.17%) ⬆️
joblib/logger.py 86.84% <0.00%> (+1.31%) ⬆️
joblib/_memmapping_reducer.py 95.88% <0.00%> (+1.49%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Copy Markdown
Contributor

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM. I confirm that this patch makes the failing tests pass when using nogil.

Thank you, @lesteve.

Comment on lines +210 to +214
# when the outer backend is threading and with nogil, we might see
# more that one warning
warnings_have_the_right_length = (
len(warninfo) >= 1 if getattr(sys.flags, 'nogil', False)
else len(warninfo) == 1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When reading this comment, nogil can be thought as a nogil-Cython context, and not as the eponymous fork of CPython.

Does this makes this adaptation slightly clearer?

Suggested change
# when the outer backend is threading and with nogil, we might see
# more that one warning
warnings_have_the_right_length = (
len(warninfo) >= 1 if getattr(sys.flags, 'nogil', False)
else len(warninfo) == 1)
# When the outer backend is threading and when one uses nogil
# (the fork of CPython), we might observe more that one warning.
python_interpreter_is_nogil = getattr(sys.flags, 'nogil', False)
n_warnings = len(warninfo)
warnings_have_the_right_length = (
n_warnings >= 1 if python_interpreter_is_nogil
else n_warnings == 1
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tweak the wording to use "Python nogil" I guess this is good enough

@lesteve lesteve changed the title TST Fix test_nested_parallel_warnings(parent_backend for Python nogil TST Fix test_nested_parallel_warnings_parent_backend for Python nogil Feb 17, 2023
Copy link
Copy Markdown
Contributor

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

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

LGTM! thx @lesteve

@tomMoral tomMoral merged commit a4d642d into joblib:master Feb 20, 2023
@lesteve lesteve deleted the nogil-len-warnings branch March 20, 2023 14:53
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.

3 participants