File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 49
49
asyncio .set_event_loop_policy (uvloop .EventLoopPolicy ())
50
50
51
51
52
+ _default_executor = (
53
+ loky .get_reusable_executor if with_loky else concurrent .ProcessPoolExecutor
54
+ )
55
+
56
+
52
57
class BaseRunner (metaclass = abc .ABCMeta ):
53
58
r"""Base class for runners that use `concurrent.futures.Executors`.
54
59
@@ -478,7 +483,11 @@ def __init__(
478
483
def goal (_ ):
479
484
return False
480
485
481
- if executor is None and not inspect .iscoroutinefunction (learner .function ):
486
+ if (
487
+ executor is None
488
+ and _default_executor is concurrent .ProcessPoolExecutor
489
+ and not inspect .iscoroutinefunction (learner .function )
490
+ ):
482
491
try :
483
492
pickle .dumps (learner .function )
484
493
except pickle .PicklingError :
@@ -756,13 +765,6 @@ def shutdown(self, wait=True):
756
765
pass
757
766
758
767
759
- def _default_executor ():
760
- if with_loky :
761
- return loky .get_reusable_executor ()
762
- else :
763
- return concurrent .ProcessPoolExecutor ()
764
-
765
-
766
768
def _ensure_executor (executor ):
767
769
if executor is None :
768
770
executor = _default_executor ()
You can’t perform that action at this time.
0 commit comments