##// END OF EJS Templates
Minor improvements to the parallel computing stuff....
bgranger -
Show More
@@ -275,19 +275,26 b' class AsyncClientConnector(object):'
275
275
276 d = self._try_to_connect(furl_file, delay, max_tries, attempt=0)
276 d = self._try_to_connect(furl_file, delay, max_tries, attempt=0)
277 d.addCallback(_wrap_remote_reference)
277 d.addCallback(_wrap_remote_reference)
278 d.addErrback(self._handle_error, furl_file)
278 return d
279 return d
279
280
281 def _handle_error(self, f, furl_file):
282 raise ClientConnectorError('Could not connect to the controller '
283 'using the FURL file. This usually means that i) the controller '
284 'was not started or ii) a firewall was blocking the client from '
285 'connecting to the controller: %s' % furl_file)
286
280 @inlineCallbacks
287 @inlineCallbacks
281 def _try_to_connect(self, furl_or_file, delay, max_tries, attempt):
288 def _try_to_connect(self, furl_or_file, delay, max_tries, attempt):
282 """Try to connect to the controller with retry logic."""
289 """Try to connect to the controller with retry logic."""
283 if attempt < max_tries:
290 if attempt < max_tries:
284 log.msg("Connecting to controller [%r]: %s" % \
291 log.msg("Connecting [%r]" % attempt)
285 (attempt, furl_or_file))
286 try:
292 try:
287 self.furl = find_furl(furl_or_file)
293 self.furl = find_furl(furl_or_file)
288 # Uncomment this to see the FURL being tried.
294 # Uncomment this to see the FURL being tried.
289 # log.msg("FURL: %s" % self.furl)
295 # log.msg("FURL: %s" % self.furl)
290 rr = yield self.get_reference(self.furl)
296 rr = yield self.get_reference(self.furl)
297 log.msg("Connected: %s" % furl_or_file)
291 except:
298 except:
292 if attempt==max_tries-1:
299 if attempt==max_tries-1:
293 # This will propagate the exception all the way to the top
300 # This will propagate the exception all the way to the top
@@ -243,7 +243,7 b' class IPClusterApp(ApplicationWithClusterDir):'
243 full_path = os.path.join(path, f)
243 full_path = os.path.join(path, f)
244 if os.path.isdir(full_path) and f.startswith('cluster_'):
244 if os.path.isdir(full_path) and f.startswith('cluster_'):
245 profile = full_path.split('_')[-1]
245 profile = full_path.split('_')[-1]
246 start_cmd = '"ipcluster start -n 4 -p %s"' % profile
246 start_cmd = 'ipcluster start -p %s -n 4' % profile
247 print start_cmd + " ==> " + full_path
247 print start_cmd + " ==> " + full_path
248
248
249 def pre_construct(self):
249 def pre_construct(self):
@@ -362,7 +362,7 b' class IPClusterApp(ApplicationWithClusterDir):'
362 d= self.stop_engines()
362 d= self.stop_engines()
363 d2 = self.stop_controller()
363 d2 = self.stop_controller()
364 # Wait a few seconds to let things shut down.
364 # Wait a few seconds to let things shut down.
365 reactor.callLater(3.0, reactor.stop)
365 reactor.callLater(4.0, reactor.stop)
366
366
367 def sigint_handler(self, signum, frame):
367 def sigint_handler(self, signum, frame):
368 self.stop_launchers()
368 self.stop_launchers()
@@ -262,9 +262,8 b' class MultiEngine(ControllerAdapterBase):'
262 elif targets == 'all':
262 elif targets == 'all':
263 eList = self.engines.values()
263 eList = self.engines.values()
264 if len(eList) == 0:
264 if len(eList) == 0:
265 msg = """There are no engines registered.
265 raise error.NoEnginesRegistered("There are no engines registered. "
266 Check the logs in ~/.ipython/log if you think there should have been."""
266 "Check the logs if you think there should have been.")
267 raise error.NoEnginesRegistered(msg)
268 else:
267 else:
269 return eList
268 return eList
270 else:
269 else:
General Comments 0
You need to be logged in to leave comments. Login now