File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
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
@@ -495,13 +496,18 @@ def __init__(
495
496
def goal (_ ):
496
497
return False
497
498
498
- if isinstance (learner .function , types .LambdaType ) and executor is None :
499
- raise ValueError (
500
- "A lambda function cannot be pickled and "
501
- "therefore doesn't work with the default executor."
502
- "Either do not use a lamdba or use a framework that"
503
- " allows this, i.e. `ipyparallel` with `dill`."
504
- )
499
+ if executor is None :
500
+ if isinstance (learner .function , types .LambdaType ):
501
+ raise ValueError (
502
+ "A lambda function cannot be pickled and "
503
+ "therefore doesn't work with the default executor."
504
+ "Either do not use a lamdba or use a framework that"
505
+ " allows this, e.g. `ipyparallel` with `dill`."
506
+ )
507
+ try :
508
+ pickle .dumps (learner .function )
509
+ except pickle .PicklingError :
510
+ raise ValueError ("`learner.function` needs to be pickleble." )
505
511
506
512
super ().__init__ (
507
513
learner ,
You can’t perform that action at this time.
0 commit comments