We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5db0f73 + 3a37f4b commit 9492193Copy full SHA for 9492193
1 file changed
adaptive/runner.py
@@ -5,6 +5,7 @@
5
import concurrent.futures as concurrent
6
import inspect
7
import os
8
+import pickle
9
import sys
10
import time
11
import traceback
@@ -494,6 +495,18 @@ def __init__(
494
495
def goal(_):
496
return False
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
+
510
super().__init__(
511
learner,
512
goal,
0 commit comments