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
| exceptExceptionase: |
| self.tracebacks[x] =traceback.format_exc() |
| self.to_retry[x] =self.to_retry.get(x, 0) +1 |
| ifself.to_retry[x] >self.retries: |
| self.to_retry.pop(x) |
| ifself.raise_if_retries_exceeded: |
| self._do_raise(e, x) |
Reproduce with:
importadaptiveimportnumpyasnpadaptive.notebook_extension()
deff(dct):
importrandomifrandom.random() <0.5:
raiseException()
returndct["x"]
seq= [dict(x=x) forxinnp.linspace(-1, 1, 101)] # unhashablelearner=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)
When a
SequenceLearnerthat has unhashable entries in sequence (e.g.,List[dict]) fails, theRunnerbreaks.This happens because of the
dict[x]inadaptive/adaptive/runner.py
Lines 204 to 210 in 0f85d3a
Reproduce with:
traceback