From f19af46a22ffbc4844b27a64b478a08bd67ce820 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 25 Jun 2018 13:40:17 +0200 Subject: [PATCH 1/2] ensure correct ioloop is used on tornado 4 default of ZMQStream is to use IOLoop.instance, which isn't correct in a background thread on tornado < 5 --- ipyparallel/client/client.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ipyparallel/client/client.py b/ipyparallel/client/client.py index 41068917f..f22f2df2a 100644 --- a/ipyparallel/client/client.py +++ b/ipyparallel/client/client.py @@ -850,7 +850,9 @@ def _make_io_loop(self): # no asyncio loop, make one # e.g. asyncio.set_event_loop(asyncio.new_event_loop()) - return IOLoop.current() + loop = IOLoop() + loop.make_current() + return loop def _stop_io_thread(self): """Stop my IO thread""" @@ -860,17 +862,17 @@ def _stop_io_thread(self): self._io_thread.join() def _setup_streams(self): - self._query_stream = ZMQStream(self._query_socket) + self._query_stream = ZMQStream(self._query_socket, self._io_loop) self._query_stream.on_recv(self._dispatch_single_reply, copy=False) - self._control_stream = ZMQStream(self._control_socket) + self._control_stream = ZMQStream(self._control_socket, self._io_loop) self._control_stream.on_recv(self._dispatch_single_reply, copy=False) - self._mux_stream = ZMQStream(self._mux_socket) + self._mux_stream = ZMQStream(self._mux_socket, self._io_loop) self._mux_stream.on_recv(self._dispatch_reply, copy=False) - self._task_stream = ZMQStream(self._task_socket) + self._task_stream = ZMQStream(self._task_socket, self._io_loop) self._task_stream.on_recv(self._dispatch_reply, copy=False) - self._iopub_stream = ZMQStream(self._iopub_socket) + self._iopub_stream = ZMQStream(self._iopub_socket, self._io_loop) self._iopub_stream.on_recv(self._dispatch_iopub, copy=False) - self._notification_stream = ZMQStream(self._notification_socket) + self._notification_stream = ZMQStream(self._notification_socket, self._io_loop) self._notification_stream.on_recv(self._dispatch_notification, copy=False) def _start_io_thread(self): From aa32f39420218e90ca295a692a2f5a711620ff4c Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 25 Jun 2018 13:41:26 +0200 Subject: [PATCH 2/2] test with tornado 4 on travis --- .travis.yml | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c73a9da95..545c40824 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,34 @@ # http://travis-ci.org/#!/ipython/ipyparallel language: python python: - - "nightly" - - 3.6 - - 2.7 - - 3.5 - - 3.4 + - "nightly" + - 3.6 + - 2.7 + - 3.5 + - 3.4 sudo: false cache: directories: - $HOME/.cache/pip install: - - pip install --upgrade setuptools pip - - pip install --pre --upgrade .[test] distributed joblib codecov - - 'pip install --only-binary :all: matplotlib || echo "no matplotlib"' + - pip install --upgrade setuptools pip + - pip install --pre --upgrade .[test] distributed joblib codecov + - | + # install pinned tornado + if [[ ! -z "$TORNADO" ]]; then + pip install tornado==${TORNADO} + fi + - 'pip install --only-binary :all: matplotlib || echo "no matplotlib"' + - pip freeze script: - - pytest --maxfail=3 --cov ipyparallel -vsx ipyparallel/tests + - pytest --maxfail=3 --cov ipyparallel -vsx ipyparallel/tests after_success: - - codecov + - codecov matrix: - allow_failures: - - python: "nightly" + allow_failures: + - python: "nightly" + include: + - python: 3.6 + env: TORNADO="4.5.3" + - python: 2.7 + env: TORNADO="4.5.3"