Skip to content

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Oct 19, 2022

The main motivation for this is to be able to run joblib and later scikit-learn tests with Python nogil with the default backend set to threading

@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Base: 93.96% // Head: 93.73% // Decreases project coverage by -0.23% ⚠️

Coverage data is based on head (0568c24) compared to base (796e7aa).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1356      +/-   ##
==========================================
- Coverage   93.96%   93.73%   -0.24%     
==========================================
  Files          52       52              
  Lines        7291     7291              
==========================================
- Hits         6851     6834      -17     
- Misses        440      457      +17     
Impacted Files Coverage Δ
joblib/test/test_parallel.py 97.05% <100.00%> (ø)
joblib/test/test_store_backends.py 91.42% <0.00%> (-5.72%) ⬇️
joblib/_parallel_backends.py 88.23% <0.00%> (-4.78%) ⬇️
joblib/pool.py 87.80% <0.00%> (-0.82%) ⬇️
joblib/parallel.py 96.29% <0.00%> (-0.27%) ⬇️

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.

@lesteve
Copy link
Member Author

lesteve commented Oct 20, 2022

The things I am wondering about:

  • right now the JOBLIB_DEFAULT_PARALLEL_BACKEND is only checked when joblib.parallel is imported and setting it to another value after joblib.parallel is imported will not have any effect. Is this OK or do we want to check the environment variable when a Parallel object is created?
  • do we need to add a CI build for running the tests with threading as the default backend?

@ogrisel
Copy link
Contributor

ogrisel commented Oct 20, 2022

do we need to add a CI build for running the tests with threading as the default backend?

I think so, otherwise the test suite will become loky specific again without us realizing it.

@ogrisel
Copy link
Contributor

ogrisel commented Oct 20, 2022

right now the JOBLIB_DEFAULT_PARALLEL_BACKEND is only checked when joblib.parallel is imported and setting it to another value after joblib.parallel is imported will not have any effect. Is this OK or do we want to check the environment variable when a Parallel object is created?

I think it's fine to only check it at joblib import time.

@lesteve lesteve force-pushed the default-backend-env-var branch from 55a5511 to 657d331 Compare October 25, 2022 15:38
@lesteve
Copy link
Member Author

lesteve commented Oct 25, 2022

The windows error does not seem related, maybe similar to #1275

@ogrisel
Copy link
Contributor

ogrisel commented Oct 26, 2022

@GaelVaroquaux raised the concern that the environment variable could be set for other purposes than testing and that users in some environments would not realize that system administrator might change the joblib behaviors without the users being aware causing hard to debug and support situations.

Maybe we would instead change the default backend via a environment variable that would only impact a dedicated pytest configuration (e.g. module level setup function in a top level conftest.py file) instead of inspecting the environment variable in joblib/parallel.py directly.

Copy link
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

I had this comment in a pending for at least a week. Other than that LGTM!

Copy link
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! Thanks @lesteve

Copy link
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

lint fixes

@ogrisel ogrisel merged commit 520dca5 into joblib:master Nov 22, 2022
@ogrisel
Copy link
Contributor

ogrisel commented Nov 22, 2022

Thanks for the improvement @lesteve!

@ogrisel
Copy link
Contributor

ogrisel commented Nov 22, 2022

We now need something similar to run the scikit-learn tests with nogil CPython and the threading backend.

@lesteve lesteve deleted the default-backend-env-var branch November 22, 2022 17:07
@lesteve
Copy link
Member Author

lesteve commented Nov 22, 2022

Yep this is on the list, as an intermediary step I tried a while ago to run the joblib tests with nogil and the threading backend as default, and there were some failures which I did not investigate.

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