diff --git a/IPython/kernel/clientconnector.py b/IPython/kernel/clientconnector.py index 9a73f49..ffa55d4 100644 --- a/IPython/kernel/clientconnector.py +++ b/IPython/kernel/clientconnector.py @@ -275,19 +275,26 @@ class AsyncClientConnector(object): d = self._try_to_connect(furl_file, delay, max_tries, attempt=0) d.addCallback(_wrap_remote_reference) + d.addErrback(self._handle_error, furl_file) return d + def _handle_error(self, f, furl_file): + raise ClientConnectorError('Could not connect to the controller ' + 'using the FURL file. This usually means that i) the controller ' + 'was not started or ii) a firewall was blocking the client from ' + 'connecting to the controller: %s' % furl_file) + @inlineCallbacks def _try_to_connect(self, furl_or_file, delay, max_tries, attempt): """Try to connect to the controller with retry logic.""" if attempt < max_tries: - log.msg("Connecting to controller [%r]: %s" % \ - (attempt, furl_or_file)) + log.msg("Connecting [%r]" % attempt) try: self.furl = find_furl(furl_or_file) # Uncomment this to see the FURL being tried. # log.msg("FURL: %s" % self.furl) rr = yield self.get_reference(self.furl) + log.msg("Connected: %s" % furl_or_file) except: if attempt==max_tries-1: # This will propagate the exception all the way to the top diff --git a/IPython/kernel/ipclusterapp.py b/IPython/kernel/ipclusterapp.py index 71fcaa7..a1f444b 100644 --- a/IPython/kernel/ipclusterapp.py +++ b/IPython/kernel/ipclusterapp.py @@ -243,7 +243,7 @@ class IPClusterApp(ApplicationWithClusterDir): full_path = os.path.join(path, f) if os.path.isdir(full_path) and f.startswith('cluster_'): profile = full_path.split('_')[-1] - start_cmd = '"ipcluster start -n 4 -p %s"' % profile + start_cmd = 'ipcluster start -p %s -n 4' % profile print start_cmd + " ==> " + full_path def pre_construct(self): @@ -362,7 +362,7 @@ class IPClusterApp(ApplicationWithClusterDir): d= self.stop_engines() d2 = self.stop_controller() # Wait a few seconds to let things shut down. - reactor.callLater(3.0, reactor.stop) + reactor.callLater(4.0, reactor.stop) def sigint_handler(self, signum, frame): self.stop_launchers() diff --git a/IPython/kernel/multiengine.py b/IPython/kernel/multiengine.py index 0a5bd65..bdeba67 100644 --- a/IPython/kernel/multiengine.py +++ b/IPython/kernel/multiengine.py @@ -262,9 +262,8 @@ class MultiEngine(ControllerAdapterBase): elif targets == 'all': eList = self.engines.values() if len(eList) == 0: - msg = """There are no engines registered. - Check the logs in ~/.ipython/log if you think there should have been.""" - raise error.NoEnginesRegistered(msg) + raise error.NoEnginesRegistered("There are no engines registered. " + "Check the logs if you think there should have been.") else: return eList else: