Skip to content

Commit d27436a

Browse files
authored
Merge pull request #482 from minrk/stream-output-race
avoid race in stream_outputs
2 parents db8f354 + 0ba517e commit d27436a

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)