Skip to content

Commit 707efb7

Browse files
committed
remove lambda check
1 parent f3c5ea3 commit 707efb7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

adaptive/runner.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import sys
1010
import time
1111
import traceback
12-
import types
1312
import warnings
1413
from contextlib import suppress
1514

@@ -497,17 +496,16 @@ def goal(_):
497496
return False
498497

499498
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-
)
507499
try:
508500
pickle.dumps(learner.function)
509501
except pickle.PicklingError:
510-
raise ValueError("`learner.function` needs to be pickleble.")
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+
)
511509

512510
super().__init__(
513511
learner,

0 commit comments

Comments
 (0)