diff --git a/IPython/parallel/apps/ipcontrollerapp.py b/IPython/parallel/apps/ipcontrollerapp.py index 8fc424a..f9fba94 100755 --- a/IPython/parallel/apps/ipcontrollerapp.py +++ b/IPython/parallel/apps/ipcontrollerapp.py @@ -55,7 +55,7 @@ from IPython.parallel.controller.hub import HubFactory from IPython.parallel.controller.scheduler import TaskScheduler,launch_scheduler from IPython.parallel.controller.sqlitedb import SQLiteDB -from IPython.parallel.util import signal_children, split_url, asbytes, disambiguate_url +from IPython.parallel.util import signal_children, split_url, disambiguate_url # conditional import of MongoDB backend class @@ -224,7 +224,9 @@ class IPControllerApp(BaseParallelApplication): self.log.info("loading connection info from %s", fname) with open(fname) as f: cfg = json.loads(f.read()) - key = c.Session.key = asbytes(cfg['exec_key']) + key = cfg['exec_key'] + # json gives unicode, Session.key wants bytes + c.Session.key = key.encode('ascii') xport,addr = cfg['url'].split('://') c.HubFactory.engine_transport = xport ip,ports = addr.split(':') diff --git a/IPython/parallel/controller/hub.py b/IPython/parallel/controller/hub.py index ea82988..0868616 100644 --- a/IPython/parallel/controller/hub.py +++ b/IPython/parallel/controller/hub.py @@ -653,7 +653,7 @@ class Hub(SessionFactory): return record = init_record(msg) - record['client_uuid'] = client_id + record['client_uuid'] = client_id.decode('ascii') record['queue'] = 'task' header = msg['header'] msg_id = header['msg_id'] diff --git a/IPython/parallel/engine/engine.py b/IPython/parallel/engine/engine.py index 66c60ff..fa0f8d4 100644 --- a/IPython/parallel/engine/engine.py +++ b/IPython/parallel/engine/engine.py @@ -27,7 +27,7 @@ from IPython.external.ssh import tunnel from IPython.utils.traitlets import ( Instance, Dict, Integer, Type, CFloat, Unicode, CBytes, Bool ) -# from IPython.utils.localinterfaces import LOCALHOST +from IPython.utils import py3compat from IPython.parallel.controller.heartmonitor import Heart from IPython.parallel.factory import RegistrationFactory @@ -192,12 +192,12 @@ class EngineFactory(RegistrationFactory): # # Redirect input streams and set a display hook. if self.out_stream_factory: sys.stdout = self.out_stream_factory(self.session, iopub_stream, u'stdout') - sys.stdout.topic = 'engine.%i.stdout'%self.id + sys.stdout.topic = py3compat.cast_bytes('engine.%i.stdout' % self.id) sys.stderr = self.out_stream_factory(self.session, iopub_stream, u'stderr') - sys.stderr.topic = 'engine.%i.stderr'%self.id + sys.stderr.topic = py3compat.cast_bytes('engine.%i.stderr' % self.id) if self.display_hook_factory: sys.displayhook = self.display_hook_factory(self.session, iopub_stream) - sys.displayhook.topic = 'engine.%i.pyout'%self.id + sys.displayhook.topic = py3compat.cast_bytes('engine.%i.pyout' % self.id) self.kernel = Kernel(config=self.config, int_id=self.id, ident=self.ident, session=self.session, control_stream=control_stream, shell_streams=shell_streams, iopub_stream=iopub_stream, diff --git a/IPython/parallel/tests/test_view.py b/IPython/parallel/tests/test_view.py index 81022d8..c641c9b 100644 --- a/IPython/parallel/tests/test_view.py +++ b/IPython/parallel/tests/test_view.py @@ -24,6 +24,8 @@ from StringIO import StringIO import zmq from nose import SkipTest +from IPython.testing import decorators as dec + from IPython import parallel as pmod from IPython.parallel import error from IPython.parallel import AsyncResult, AsyncHubResult, AsyncMapResult @@ -298,6 +300,7 @@ class TestView(ClusterTestCase): self.assertFalse(view.block) self.assertTrue(view.block) + @dec.known_failure_py3 def test_importer(self): view = self.client[-1] view.clear(block=True) @@ -330,7 +333,7 @@ class TestView(ClusterTestCase): sys.stdout = sio # just 'print a' worst ~99% of the time, but this ensures that # the stdout message has arrived when the result is finished: - ip.magic_px('import sys,time;print a; sys.stdout.flush();time.sleep(0.2)') + ip.magic_px('import sys,time;print (a); sys.stdout.flush();time.sleep(0.2)') sys.stdout = savestdout buf = sio.getvalue() self.assertTrue('[stdout:' in buf, buf)