File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 5
5
import concurrent .futures as concurrent
6
6
import inspect
7
7
import os
8
+ import pickle
8
9
import sys
9
10
import time
10
11
import traceback
@@ -494,6 +495,18 @@ def __init__(
494
495
def goal (_ ):
495
496
return False
496
497
498
+ if executor is None and not inspect .iscoroutinefunction (learner .function ):
499
+ try :
500
+ pickle .dumps (learner .function )
501
+ except pickle .PicklingError :
502
+ raise ValueError (
503
+ "`learner.function` cannot be pickled (is it a lamdba function?)"
504
+ " and therefore does not work with the default executor."
505
+ " Either make sure the function is pickleble or use an executor"
506
+ " that might work with 'hard to pickle'-functions"
507
+ " , e.g. `ipyparallel` with `dill`."
508
+ )
509
+
497
510
super ().__init__ (
498
511
learner ,
499
512
goal ,
You can’t perform that action at this time.
0 commit comments