CI Add CPython 3.13 free-threaded test#1589
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1589 +/- ##
==========================================
- Coverage 95.27% 95.25% -0.03%
==========================================
Files 45 45
Lines 7708 7715 +7
==========================================
+ Hits 7344 7349 +5
- Misses 364 366 +2 ☔ View full report in Codecov by Sentry. |
|
I was just looking at the |
|
Thanks for the pointers, so indeed the change is that on Linux in CPython 3.14, the default multiprocessing start method will change from 'fork' to a better default (I haven't read enough to figure out what the new default is 😅) To quote the relevant section for more precision:
In joblib
I would lean slightly towards 3. maybe? Probably not 1. because my understanding is that joblib To be honest I am not that sure how much the joblib cc @tomMoral and @ogrisel for informed opinions on this topic |
My understanding is: very likely |
I agree we might want the swallow this warning in our test. This is quite a synthetic case that should not happen much in practice, so we can ignore and leave the deprecation warning go through in joblib. |
I think I would let the
Once CPython 3.14 has settled down on its plan, we can adapt joblib accordingly to adapt the tests for CPython 3.14 and later but I would not change joblib's default behavior for earlier Python versions. |
+1. I just assume that "swallow the warning" is only done in when running the tests, not in general in joblib. |
ogrisel
left a comment
There was a problem hiding this comment.
Other than the warning problem and the following, LGTM. Thanks Loïc!
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
|
OK, CI is green and this is ready for another review round! I have mostly:
|
9fa3602 to
a4f10c4
Compare
|
Thanks @lesteve ! |
I guess the issue are more likely to happen when using free-threaded + joblib multithreading backend + some other library. Next thing I want to do is run the joblib test suite with default backend switched to threading. I think locally I have seen some errors but I need to investigate more. After this trying to run the scikit-learn test suite with default backend switched to threading. |
Giving it a go to CPython 3.13 free-threaded which is in beta and scheduled to be released in October 2024. Context: scikit-learn/scikit-learn#28978 and more generally https://github.com/Quansight-Labs/free-threaded-compatibility.
Locally and in a quick Github action workflow (see latest runs) there are the following test failures. Note: this is easier to write a Github Action with the action
deadsnakes/actionwhich allow to have an easily working Python 3.13 beta.DeprecationWarning about forking multi-threaded processes
Doing a
Parallelwith loky followed by aParallelby multiprocessing yields aDeprecationWarningbecause I guesslokycreates thread and doing a fork of a multi-threaded warning may lead to issues. Maybe we should swallow warning in the test? Not sure if there are use cases where using both loky and multiprocessing and what to do in this case.produces this warning:
The failures are:
There are some warnings like this where the test expects no warning:
Fixed: Changes in
locals()afterexecI fixed it by tweaking the test and passing a dict to the
execlocalsargument. I think this still tests interactively defined functions.This happens in the test that is trying to test an interactive function in Jupyter by using
execto define a function and expectinglocals()to be udpated. This is likely related to CPython 3.13 (not free-threaded related).Probably related: