Skip to content

Commit 0ba517e

Browse files
committed
avoid race in stream_outputs
use existing handle on msg_future in `AsyncResult._children`, since `client._futures` can be cleared once results are completed
1 parent db8f354 commit 0ba517e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ipyparallel/client/asyncresult.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@ def stream_output(self):
170170

171171
# Keep a handle on the futures so we can remove the callback later
172172
future_callbacks = {}
173-
for eid, msg_id in zip(self._targets, self.msg_ids):
173+
for eid, msg_future in zip(self._targets, self._children):
174174
callback_func = partial(self._iopub_streaming_output_callback, eid)
175-
f = self._client._futures[msg_id]
176-
future_callbacks[f] = callback_func
177-
f.iopub_callbacks.append(callback_func)
175+
future_callbacks[msg_future] = callback_func
176+
msg_future.iopub_callbacks.append(callback_func)
178177

179178
try:
180179
yield

0 commit comments

Comments
 (0)