Show More
@@ -47,6 +47,7 b' from .view import DirectView, LoadBalancedView' | |||||
47 | # Decorators for Client methods |
|
47 | # Decorators for Client methods | |
48 | #-------------------------------------------------------------------------- |
|
48 | #-------------------------------------------------------------------------- | |
49 |
|
49 | |||
|
50 | ||||
50 | @decorator |
|
51 | @decorator | |
51 | def spin_first(f, self, *args, **kwargs): |
|
52 | def spin_first(f, self, *args, **kwargs): | |
52 | """Call spin() to sync state prior to calling the method.""" |
|
53 | """Call spin() to sync state prior to calling the method.""" | |
@@ -58,6 +59,10 b' def spin_first(f, self, *args, **kwargs):' | |||||
58 | # Classes |
|
59 | # Classes | |
59 | #-------------------------------------------------------------------------- |
|
60 | #-------------------------------------------------------------------------- | |
60 |
|
61 | |||
|
62 | _no_connection_file_msg = """ | |||
|
63 | Failed to connect because no Controller could be found. | |||
|
64 | Please double-check your profile and ensure that a cluster is running. | |||
|
65 | """ | |||
61 |
|
66 | |||
62 | class ExecuteReply(RichOutput): |
|
67 | class ExecuteReply(RichOutput): | |
63 | """wrapper for finished Execute results""" |
|
68 | """wrapper for finished Execute results""" | |
@@ -382,6 +387,11 b' class Client(HasTraits):' | |||||
382 |
|
387 | |||
383 | self._setup_profile_dir(self.profile, profile_dir, ipython_dir) |
|
388 | self._setup_profile_dir(self.profile, profile_dir, ipython_dir) | |
384 |
|
389 | |||
|
390 | no_file_msg = '\n'.join([ | |||
|
391 | "You have attempted to connect to an IPython Cluster but no Controller could be found.", | |||
|
392 | "Please double-check your configuration and ensure that a cluster is running.", | |||
|
393 | ]) | |||
|
394 | ||||
385 | if self._cd is not None: |
|
395 | if self._cd is not None: | |
386 | if url_file is None: |
|
396 | if url_file is None: | |
387 | if not cluster_id: |
|
397 | if not cluster_id: | |
@@ -389,13 +399,17 b' class Client(HasTraits):' | |||||
389 | else: |
|
399 | else: | |
390 | client_json = 'ipcontroller-%s-client.json' % cluster_id |
|
400 | client_json = 'ipcontroller-%s-client.json' % cluster_id | |
391 | url_file = pjoin(self._cd.security_dir, client_json) |
|
401 | url_file = pjoin(self._cd.security_dir, client_json) | |
|
402 | if not os.path.exists(url_file): | |||
|
403 | msg = '\n'.join([ | |||
|
404 | "Connection file %r not found." % compress_user(url_file), | |||
|
405 | no_file_msg, | |||
|
406 | ]) | |||
|
407 | raise IOError(msg) | |||
392 | if url_file is None: |
|
408 | if url_file is None: | |
393 |
raise |
|
409 | raise IOError(no_file_msg) | |
394 | "I can't find enough information to connect to a hub!" |
|
|||
395 | " Please specify at least one of url_file or profile." |
|
|||
396 | ) |
|
|||
397 |
|
410 | |||
398 | if not os.path.exists(url_file): |
|
411 | if not os.path.exists(url_file): | |
|
412 | # Connection file explicitly specified, but not found | |||
399 | raise IOError("Connection file %r not found. Is a controller running?" % \ |
|
413 | raise IOError("Connection file %r not found. Is a controller running?" % \ | |
400 | compress_user(url_file) |
|
414 | compress_user(url_file) | |
401 | ) |
|
415 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now