Open
Description
When a SequenceLearner
that has unhashable entries in sequence (e.g., List[dict]
) fails, the Runner
breaks.
This happens because of the dict[x]
in
Lines 204 to 210 in 0f85d3a
Reproduce with:
import adaptive
import numpy as np
adaptive.notebook_extension()
def f(dct):
import random
if random.random() < 0.5:
raise Exception()
return dct["x"]
seq = [dict(x=x) for x in np.linspace(-1, 1, 101)] # unhashable
learner = adaptive.SequenceLearner(f, sequence=seq)
runner = adaptive.Runner(learner, goal=adaptive.SequenceLearner.done)
runner.live_info()
runner.task.print_stack()
traceback
Traceback for <Task finished name='Task-3' coro=<AsyncRunner._run() done, defined at /Users/basnijholt/Work/adaptive/adaptive/runner.py:601> exception=TypeError("unhashable type: 'dict'")> (most recent call last):
TypeError: unhashable type: 'dict'
File "/Users/basnijholt/Work/adaptive/adaptive/runner.py", line 555, in status
return "failed"
File "/Users/basnijholt/Work/adaptive/adaptive/runner.py", line 555, in status
return "failed"
File "/Users/basnijholt/Work/adaptive/adaptive/runner.py", line 618, in _run
self._cleanup()
File "/Users/basnijholt/Work/adaptive/adaptive/runner.py", line 210, in _process_futures
self._do_raise(e, x)