Show More
@@ -93,12 +93,12 b' c = get_config()' | |||||
93 | # c.WinHPCTask.is_rerunnable = True |
|
93 | # c.WinHPCTask.is_rerunnable = True | |
94 |
|
94 | |||
95 | # c.IPControllerTask.task_name = 'IPController' |
|
95 | # c.IPControllerTask.task_name = 'IPController' | |
96 | # c.IPControllerTask.controller_cmd = ['ipcontroller.exe'] |
|
96 | # c.IPControllerTask.controller_cmd = [u'ipcontroller.exe'] | |
97 | # c.IPControllerTask.controller_args = ['--log-to-file', '--log-level', '40'] |
|
97 | # c.IPControllerTask.controller_args = ['--log-to-file', '--log-level', '40'] | |
98 | # c.IPControllerTask.environment_variables = {} |
|
98 | # c.IPControllerTask.environment_variables = {} | |
99 |
|
99 | |||
100 | # c.IPEngineTask.task_name = 'IPController' |
|
100 | # c.IPEngineTask.task_name = 'IPController' | |
101 | # c.IPEngineTask.engine_cmd = ['ipengine.exe'] |
|
101 | # c.IPEngineTask.engine_cmd = [u'ipengine.exe'] | |
102 | # c.IPEngineTask.engine_args = ['--log-to-file', '--log-level', '40'] |
|
102 | # c.IPEngineTask.engine_args = ['--log-to-file', '--log-level', '40'] | |
103 | # c.IPEngineTask.environment_variables = {} |
|
103 | # c.IPEngineTask.environment_variables = {} | |
104 |
|
104 |
@@ -101,7 +101,7 b' c = get_config()' | |||||
101 | # are more for developers who want to change the behavior of the controller |
|
101 | # are more for developers who want to change the behavior of the controller | |
102 | # at a fundamental level. |
|
102 | # at a fundamental level. | |
103 |
|
103 | |||
104 | # c.FCClientServiceFactory.cert_file = 'ipcontroller-client.pem' |
|
104 | # c.FCClientServiceFactory.cert_file = u'ipcontroller-client.pem' | |
105 |
|
105 | |||
106 | # default_client_interfaces = Config() |
|
106 | # default_client_interfaces = Config() | |
107 | # default_client_interfaces.Task.interface_chain = [ |
|
107 | # default_client_interfaces.Task.interface_chain = [ | |
@@ -109,24 +109,24 b' c = get_config()' | |||||
109 | # 'IPython.kernel.taskfc.IFCTaskController' |
|
109 | # 'IPython.kernel.taskfc.IFCTaskController' | |
110 | # ] |
|
110 | # ] | |
111 | # |
|
111 | # | |
112 | # default_client_interfaces.Task.furl_file = 'ipcontroller-tc.furl' |
|
112 | # default_client_interfaces.Task.furl_file = u'ipcontroller-tc.furl' | |
113 | # |
|
113 | # | |
114 | # default_client_interfaces.MultiEngine.interface_chain = [ |
|
114 | # default_client_interfaces.MultiEngine.interface_chain = [ | |
115 | # 'IPython.kernel.multiengine.IMultiEngine', |
|
115 | # 'IPython.kernel.multiengine.IMultiEngine', | |
116 | # 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine' |
|
116 | # 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine' | |
117 | # ] |
|
117 | # ] | |
118 | # |
|
118 | # | |
119 | # default_client_interfaces.MultiEngine.furl_file = 'ipcontroller-mec.furl' |
|
119 | # default_client_interfaces.MultiEngine.furl_file = u'ipcontroller-mec.furl' | |
120 | # |
|
120 | # | |
121 | # c.FCEngineServiceFactory.interfaces = default_client_interfaces |
|
121 | # c.FCEngineServiceFactory.interfaces = default_client_interfaces | |
122 |
|
122 | |||
123 | # c.FCEngineServiceFactory.cert_file = 'ipcontroller-engine.pem' |
|
123 | # c.FCEngineServiceFactory.cert_file = u'ipcontroller-engine.pem' | |
124 |
|
124 | |||
125 | # default_engine_interfaces = Config() |
|
125 | # default_engine_interfaces = Config() | |
126 | # default_engine_interfaces.Default.interface_chain = [ |
|
126 | # default_engine_interfaces.Default.interface_chain = [ | |
127 | # 'IPython.kernel.enginefc.IFCControllerBase' |
|
127 | # 'IPython.kernel.enginefc.IFCControllerBase' | |
128 | # ] |
|
128 | # ] | |
129 | # |
|
129 | # | |
130 | # default_engine_interfaces.Default.furl_file = 'ipcontroller-engine.furl' |
|
130 | # default_engine_interfaces.Default.furl_file = u'ipcontroller-engine.furl' | |
131 | # |
|
131 | # | |
132 | # c.FCEngineServiceFactory.interfaces = default_engine_interfaces |
|
132 | # c.FCEngineServiceFactory.interfaces = default_engine_interfaces |
@@ -32,7 +32,7 b' c = get_config()' | |||||
32 | # By default, the engine will look for the controller's FURL file in its own |
|
32 | # By default, the engine will look for the controller's FURL file in its own | |
33 | # cluster directory. Sometimes, the FURL file will be elsewhere and this |
|
33 | # cluster directory. Sometimes, the FURL file will be elsewhere and this | |
34 | # attribute can be set to the full path of the FURL file. |
|
34 | # attribute can be set to the full path of the FURL file. | |
35 | # c.Global.furl_file = '' |
|
35 | # c.Global.furl_file = u'' | |
36 |
|
36 | |||
37 | #----------------------------------------------------------------------------- |
|
37 | #----------------------------------------------------------------------------- | |
38 | # MPI configuration |
|
38 | # MPI configuration | |
@@ -76,7 +76,7 b' c = get_config()' | |||||
76 |
|
76 | |||
77 | # c.Global.shell_class = 'IPython.kernel.core.interpreter.Interpreter' |
|
77 | # c.Global.shell_class = 'IPython.kernel.core.interpreter.Interpreter' | |
78 |
|
78 | |||
79 | # c.Global.furl_file_name = 'ipcontroller-engine.furl' |
|
79 | # c.Global.furl_file_name = u'ipcontroller-engine.furl' | |
80 |
|
80 | |||
81 |
|
81 | |||
82 |
|
82 |
@@ -71,9 +71,9 b' c = get_config()' | |||||
71 |
|
71 | |||
72 | # c.InteractiveShell.logstart = True |
|
72 | # c.InteractiveShell.logstart = True | |
73 |
|
73 | |||
74 | # c.InteractiveShell.logfile = 'ipython_log.py' |
|
74 | # c.InteractiveShell.logfile = u'ipython_log.py' | |
75 |
|
75 | |||
76 | # c.InteractiveShell.logappend = 'mylog.py' |
|
76 | # c.InteractiveShell.logappend = u'mylog.py' | |
77 |
|
77 | |||
78 | # c.InteractiveShell.object_info_string_level = 0 |
|
78 | # c.InteractiveShell.object_info_string_level = 0 | |
79 |
|
79 |
@@ -52,12 +52,12 b' class BaseAppArgParseConfigLoader(ArgParseConfigLoader):' | |||||
52 |
|
52 | |||
53 | def _add_other_arguments(self): |
|
53 | def _add_other_arguments(self): | |
54 | self.parser.add_argument('--ipython-dir', |
|
54 | self.parser.add_argument('--ipython-dir', | |
55 |
dest='Global.ipython_dir',type= |
|
55 | dest='Global.ipython_dir',type=unicode, | |
56 | help='Set to override default location of Global.ipython_dir.', |
|
56 | help='Set to override default location of Global.ipython_dir.', | |
57 | default=NoConfigDefault, |
|
57 | default=NoConfigDefault, | |
58 | metavar='Global.ipython_dir') |
|
58 | metavar='Global.ipython_dir') | |
59 | self.parser.add_argument('-p', '--profile', |
|
59 | self.parser.add_argument('-p', '--profile', | |
60 |
dest='Global.profile',type= |
|
60 | dest='Global.profile',type=unicode, | |
61 | help='The string name of the ipython profile to be used.', |
|
61 | help='The string name of the ipython profile to be used.', | |
62 | default=NoConfigDefault, |
|
62 | default=NoConfigDefault, | |
63 | metavar='Global.profile') |
|
63 | metavar='Global.profile') | |
@@ -67,7 +67,7 b' class BaseAppArgParseConfigLoader(ArgParseConfigLoader):' | |||||
67 | default=NoConfigDefault, |
|
67 | default=NoConfigDefault, | |
68 | metavar='Global.log_level') |
|
68 | metavar='Global.log_level') | |
69 | self.parser.add_argument('--config-file', |
|
69 | self.parser.add_argument('--config-file', | |
70 |
dest='Global.config_file',type= |
|
70 | dest='Global.config_file',type=unicode, | |
71 | help='Set the config file name to override default.', |
|
71 | help='Set the config file name to override default.', | |
72 | default=NoConfigDefault, |
|
72 | default=NoConfigDefault, | |
73 | metavar='Global.config_file') |
|
73 | metavar='Global.config_file') | |
@@ -80,9 +80,9 b' class ApplicationError(Exception):' | |||||
80 | class Application(object): |
|
80 | class Application(object): | |
81 | """Load a config, construct components and set them running.""" |
|
81 | """Load a config, construct components and set them running.""" | |
82 |
|
82 | |||
83 | name = 'ipython' |
|
83 | name = u'ipython' | |
84 | description = 'IPython: an enhanced interactive Python shell.' |
|
84 | description = 'IPython: an enhanced interactive Python shell.' | |
85 | config_file_name = 'ipython_config.py' |
|
85 | config_file_name = u'ipython_config.py' | |
86 | default_log_level = logging.WARN |
|
86 | default_log_level = logging.WARN | |
87 |
|
87 | |||
88 | def __init__(self): |
|
88 | def __init__(self): | |
@@ -242,7 +242,7 b' class Application(object):' | |||||
242 | try: |
|
242 | try: | |
243 | self.profile_name = self.command_line_config.Global.profile |
|
243 | self.profile_name = self.command_line_config.Global.profile | |
244 | name_parts = self.config_file_name.split('.') |
|
244 | name_parts = self.config_file_name.split('.') | |
245 | name_parts.insert(1, '_' + self.profile_name + '.') |
|
245 | name_parts.insert(1, u'_' + self.profile_name + u'.') | |
246 | self.config_file_name = ''.join(name_parts) |
|
246 | self.config_file_name = ''.join(name_parts) | |
247 | except AttributeError: |
|
247 | except AttributeError: | |
248 | pass |
|
248 | pass | |
@@ -280,7 +280,7 b' class Application(object):' | |||||
280 | self.file_config = Config() |
|
280 | self.file_config = Config() | |
281 | except: |
|
281 | except: | |
282 | self.log.warn("Error loading config file: %s" % \ |
|
282 | self.log.warn("Error loading config file: %s" % \ | |
283 |
|
|
283 | self.config_file_name, exc_info=True) | |
284 | self.file_config = Config() |
|
284 | self.file_config = Config() | |
285 |
|
285 | |||
286 | def set_file_config_log_level(self): |
|
286 | def set_file_config_log_level(self): |
@@ -164,20 +164,20 b' cl_args = (' | |||||
164 | help="Start logging to the default file (./ipython_log.py).") |
|
164 | help="Start logging to the default file (./ipython_log.py).") | |
165 | ), |
|
165 | ), | |
166 | (('--logfile','-lf'), dict( |
|
166 | (('--logfile','-lf'), dict( | |
167 |
type= |
|
167 | type=unicode, dest='InteractiveShell.logfile', default=NoConfigDefault, | |
168 | help="Start logging to logfile.", |
|
168 | help="Start logging to logfile.", | |
169 | metavar='InteractiveShell.logfile') |
|
169 | metavar='InteractiveShell.logfile') | |
170 | ), |
|
170 | ), | |
171 | (('--log-append','-la'), dict( |
|
171 | (('--log-append','-la'), dict( | |
172 |
type= |
|
172 | type=unicode, dest='InteractiveShell.logappend', default=NoConfigDefault, | |
173 |
help="Start logging to |
|
173 | help="Start logging to the give file in append mode.", | |
174 | metavar='InteractiveShell.logfile') |
|
174 | metavar='InteractiveShell.logfile') | |
175 | ), |
|
175 | ), | |
176 | (('--pdb',), dict( |
|
176 | (('--pdb',), dict( | |
177 | action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault, |
|
177 | action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault, | |
178 | help="Enable auto calling the pdb debugger after every exception.") |
|
178 | help="Enable auto calling the pdb debugger after every exception.") | |
179 | ), |
|
179 | ), | |
180 | (('--nopdb',), dict( |
|
180 | (('--no-pdb',), dict( | |
181 | action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault, |
|
181 | action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault, | |
182 | help="Disable auto calling the pdb debugger after every exception.") |
|
182 | help="Disable auto calling the pdb debugger after every exception.") | |
183 | ), |
|
183 | ), | |
@@ -293,11 +293,11 b' class IPythonAppCLConfigLoader(BaseAppArgParseConfigLoader):' | |||||
293 | arguments = cl_args |
|
293 | arguments = cl_args | |
294 |
|
294 | |||
295 |
|
295 | |||
296 | default_config_file_name = 'ipython_config.py' |
|
296 | default_config_file_name = u'ipython_config.py' | |
297 |
|
297 | |||
298 |
|
298 | |||
299 | class IPythonApp(Application): |
|
299 | class IPythonApp(Application): | |
300 | name = 'ipython' |
|
300 | name = u'ipython' | |
301 | description = 'IPython: an enhanced interactive Python shell.' |
|
301 | description = 'IPython: an enhanced interactive Python shell.' | |
302 | config_file_name = default_config_file_name |
|
302 | config_file_name = default_config_file_name | |
303 |
|
303 | |||
@@ -475,9 +475,9 b' class IPythonApp(Application):' | |||||
475 | self.shell.showtraceback() |
|
475 | self.shell.showtraceback() | |
476 |
|
476 | |||
477 | def _exec_file(self, fname): |
|
477 | def _exec_file(self, fname): | |
478 | full_filename = filefind(fname, ['.', self.ipython_dir]) |
|
478 | full_filename = filefind(fname, [u'.', self.ipython_dir]) | |
479 | if os.path.isfile(full_filename): |
|
479 | if os.path.isfile(full_filename): | |
480 | if full_filename.endswith('.py'): |
|
480 | if full_filename.endswith(u'.py'): | |
481 | self.log.info("Running file in user namespace: %s" % full_filename) |
|
481 | self.log.info("Running file in user namespace: %s" % full_filename) | |
482 | self.shell.safe_execfile(full_filename, self.shell.user_ns) |
|
482 | self.shell.safe_execfile(full_filename, self.shell.user_ns) | |
483 | elif full_filename.endswith('.ipy'): |
|
483 | elif full_filename.endswith('.ipy'): |
@@ -139,8 +139,8 b' class ClusterDir(Component):' | |||||
139 |
|
139 | |||
140 | def copy_all_config_files(self, path=None, overwrite=False): |
|
140 | def copy_all_config_files(self, path=None, overwrite=False): | |
141 | """Copy all config files into the active cluster directory.""" |
|
141 | """Copy all config files into the active cluster directory.""" | |
142 | for f in ['ipcontroller_config.py', 'ipengine_config.py', |
|
142 | for f in [u'ipcontroller_config.py', u'ipengine_config.py', | |
143 | 'ipcluster_config.py']: |
|
143 | u'ipcluster_config.py']: | |
144 | self.copy_config_file(f, path=path, overwrite=overwrite) |
|
144 | self.copy_config_file(f, path=path, overwrite=overwrite) | |
145 |
|
145 | |||
146 | @classmethod |
|
146 | @classmethod | |
@@ -156,7 +156,7 b' class ClusterDir(Component):' | |||||
156 | return ClusterDir(cluster_dir) |
|
156 | return ClusterDir(cluster_dir) | |
157 |
|
157 | |||
158 | @classmethod |
|
158 | @classmethod | |
159 | def create_cluster_dir_by_profile(cls, path, profile='default'): |
|
159 | def create_cluster_dir_by_profile(cls, path, profile=u'default'): | |
160 | """Create a cluster dir by profile name and path. |
|
160 | """Create a cluster dir by profile name and path. | |
161 |
|
161 | |||
162 | Parameters |
|
162 | Parameters | |
@@ -169,11 +169,11 b' class ClusterDir(Component):' | |||||
169 | """ |
|
169 | """ | |
170 | if not os.path.isdir(path): |
|
170 | if not os.path.isdir(path): | |
171 | raise ClusterDirError('Directory not found: %s' % path) |
|
171 | raise ClusterDirError('Directory not found: %s' % path) | |
172 | cluster_dir = os.path.join(path, 'cluster_' + profile) |
|
172 | cluster_dir = os.path.join(path, u'cluster_' + profile) | |
173 | return ClusterDir(cluster_dir) |
|
173 | return ClusterDir(cluster_dir) | |
174 |
|
174 | |||
175 | @classmethod |
|
175 | @classmethod | |
176 | def find_cluster_dir_by_profile(cls, ipython_dir, profile='default'): |
|
176 | def find_cluster_dir_by_profile(cls, ipython_dir, profile=u'default'): | |
177 | """Find an existing cluster dir by profile name, return its ClusterDir. |
|
177 | """Find an existing cluster dir by profile name, return its ClusterDir. | |
178 |
|
178 | |||
179 | This searches through a sequence of paths for a cluster dir. If it |
|
179 | This searches through a sequence of paths for a cluster dir. If it | |
@@ -193,7 +193,7 b' class ClusterDir(Component):' | |||||
193 | The name of the profile. The name of the cluster directory |
|
193 | The name of the profile. The name of the cluster directory | |
194 | will be "cluster_<profile>". |
|
194 | will be "cluster_<profile>". | |
195 | """ |
|
195 | """ | |
196 | dirname = 'cluster_' + profile |
|
196 | dirname = u'cluster_' + profile | |
197 | cluster_dir_paths = os.environ.get('IPCLUSTER_DIR_PATH','') |
|
197 | cluster_dir_paths = os.environ.get('IPCLUSTER_DIR_PATH','') | |
198 | if cluster_dir_paths: |
|
198 | if cluster_dir_paths: | |
199 | cluster_dir_paths = cluster_dir_paths.split(':') |
|
199 | cluster_dir_paths = cluster_dir_paths.split(':') | |
@@ -230,13 +230,13 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):' | |||||
230 |
|
230 | |||
231 | def _add_other_arguments(self): |
|
231 | def _add_other_arguments(self): | |
232 | self.parser.add_argument('--ipython-dir', |
|
232 | self.parser.add_argument('--ipython-dir', | |
233 |
dest='Global.ipython_dir',type= |
|
233 | dest='Global.ipython_dir',type=unicode, | |
234 | help='Set to override default location of Global.ipython_dir.', |
|
234 | help='Set to override default location of Global.ipython_dir.', | |
235 | default=NoConfigDefault, |
|
235 | default=NoConfigDefault, | |
236 | metavar='Global.ipython_dir' |
|
236 | metavar='Global.ipython_dir' | |
237 | ) |
|
237 | ) | |
238 | self.parser.add_argument('-p', '--profile', |
|
238 | self.parser.add_argument('-p', '--profile', | |
239 |
dest='Global.profile',type= |
|
239 | dest='Global.profile',type=unicode, | |
240 | help='The string name of the profile to be used. This determines ' |
|
240 | help='The string name of the profile to be used. This determines ' | |
241 | 'the name of the cluster dir as: cluster_<profile>. The default profile ' |
|
241 | 'the name of the cluster dir as: cluster_<profile>. The default profile ' | |
242 | 'is named "default". The cluster directory is resolve this way ' |
|
242 | 'is named "default". The cluster directory is resolve this way ' | |
@@ -251,7 +251,7 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):' | |||||
251 | metavar="Global.log_level" |
|
251 | metavar="Global.log_level" | |
252 | ) |
|
252 | ) | |
253 | self.parser.add_argument('--cluster-dir', |
|
253 | self.parser.add_argument('--cluster-dir', | |
254 |
dest='Global.cluster_dir',type= |
|
254 | dest='Global.cluster_dir',type=unicode, | |
255 | help='Set the cluster dir. This overrides the logic used by the ' |
|
255 | help='Set the cluster dir. This overrides the logic used by the ' | |
256 | '--profile option.', |
|
256 | '--profile option.', | |
257 | default=NoConfigDefault, |
|
257 | default=NoConfigDefault, | |
@@ -291,8 +291,8 b' class ApplicationWithClusterDir(Application):' | |||||
291 |
|
291 | |||
292 | def create_default_config(self): |
|
292 | def create_default_config(self): | |
293 | super(ApplicationWithClusterDir, self).create_default_config() |
|
293 | super(ApplicationWithClusterDir, self).create_default_config() | |
294 | self.default_config.Global.profile = 'default' |
|
294 | self.default_config.Global.profile = u'default' | |
295 | self.default_config.Global.cluster_dir = '' |
|
295 | self.default_config.Global.cluster_dir = u'' | |
296 | self.default_config.Global.log_to_file = False |
|
296 | self.default_config.Global.log_to_file = False | |
297 | self.default_config.Global.clean_logs = False |
|
297 | self.default_config.Global.clean_logs = False | |
298 |
|
298 | |||
@@ -404,11 +404,11 b' class ApplicationWithClusterDir(Application):' | |||||
404 | if self.master_config.Global.clean_logs: |
|
404 | if self.master_config.Global.clean_logs: | |
405 | log_dir = self.master_config.Global.log_dir |
|
405 | log_dir = self.master_config.Global.log_dir | |
406 | for f in os.listdir(log_dir): |
|
406 | for f in os.listdir(log_dir): | |
407 | if f.startswith(self.name + '-') and f.endswith('.log'): |
|
407 | if f.startswith(self.name + u'-') and f.endswith('.log'): | |
408 | os.remove(os.path.join(log_dir, f)) |
|
408 | os.remove(os.path.join(log_dir, f)) | |
409 | # Start logging to the new log file |
|
409 | # Start logging to the new log file | |
410 | if self.master_config.Global.log_to_file: |
|
410 | if self.master_config.Global.log_to_file: | |
411 | log_filename = self.name + '-' + str(os.getpid()) + '.log' |
|
411 | log_filename = self.name + u'-' + str(os.getpid()) + u'.log' | |
412 | logfile = os.path.join(self.log_dir, log_filename) |
|
412 | logfile = os.path.join(self.log_dir, log_filename) | |
413 | open_log_file = open(logfile, 'w') |
|
413 | open_log_file = open(logfile, 'w') | |
414 | else: |
|
414 | else: | |
@@ -421,7 +421,7 b' class ApplicationWithClusterDir(Application):' | |||||
421 | This must be called after pre_construct, which sets `self.pid_dir`. |
|
421 | This must be called after pre_construct, which sets `self.pid_dir`. | |
422 | This raises :exc:`PIDFileError` if the pid file exists already. |
|
422 | This raises :exc:`PIDFileError` if the pid file exists already. | |
423 | """ |
|
423 | """ | |
424 | pid_file = os.path.join(self.pid_dir, self.name + '.pid') |
|
424 | pid_file = os.path.join(self.pid_dir, self.name + u'.pid') | |
425 | if os.path.isfile(pid_file): |
|
425 | if os.path.isfile(pid_file): | |
426 | pid = self.get_pid_from_file() |
|
426 | pid = self.get_pid_from_file() | |
427 | if not overwrite: |
|
427 | if not overwrite: | |
@@ -439,7 +439,7 b' class ApplicationWithClusterDir(Application):' | |||||
439 | This should be called at shutdown by registering a callback with |
|
439 | This should be called at shutdown by registering a callback with | |
440 | :func:`reactor.addSystemEventTrigger`. |
|
440 | :func:`reactor.addSystemEventTrigger`. | |
441 | """ |
|
441 | """ | |
442 | pid_file = os.path.join(self.pid_dir, self.name + '.pid') |
|
442 | pid_file = os.path.join(self.pid_dir, self.name + u'.pid') | |
443 | if os.path.isfile(pid_file): |
|
443 | if os.path.isfile(pid_file): | |
444 | try: |
|
444 | try: | |
445 | self.log.info("Removing pid file: %s" % pid_file) |
|
445 | self.log.info("Removing pid file: %s" % pid_file) | |
@@ -453,7 +453,7 b' class ApplicationWithClusterDir(Application):' | |||||
453 |
|
453 | |||
454 | If the pid file doesn't exist a :exc:`PIDFileError` is raised. |
|
454 | If the pid file doesn't exist a :exc:`PIDFileError` is raised. | |
455 | """ |
|
455 | """ | |
456 | pid_file = os.path.join(self.pid_dir, self.name + '.pid') |
|
456 | pid_file = os.path.join(self.pid_dir, self.name + u'.pid') | |
457 | if os.path.isfile(pid_file): |
|
457 | if os.path.isfile(pid_file): | |
458 | with open(pid_file, 'r') as f: |
|
458 | with open(pid_file, 'r') as f: | |
459 | pid = int(f.read().strip()) |
|
459 | pid = int(f.read().strip()) |
@@ -58,7 +58,7 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
58 | # This has all the common options that all subcommands use |
|
58 | # This has all the common options that all subcommands use | |
59 | parent_parser1 = argparse.ArgumentParser(add_help=False) |
|
59 | parent_parser1 = argparse.ArgumentParser(add_help=False) | |
60 | parent_parser1.add_argument('--ipython-dir', |
|
60 | parent_parser1.add_argument('--ipython-dir', | |
61 |
dest='Global.ipython_dir',type= |
|
61 | dest='Global.ipython_dir',type=unicode, | |
62 | help='Set to override default location of Global.ipython_dir.', |
|
62 | help='Set to override default location of Global.ipython_dir.', | |
63 | default=NoConfigDefault, |
|
63 | default=NoConfigDefault, | |
64 | metavar='Global.ipython_dir') |
|
64 | metavar='Global.ipython_dir') | |
@@ -71,7 +71,7 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
71 | # This has all the common options that other subcommands use |
|
71 | # This has all the common options that other subcommands use | |
72 | parent_parser2 = argparse.ArgumentParser(add_help=False) |
|
72 | parent_parser2 = argparse.ArgumentParser(add_help=False) | |
73 | parent_parser2.add_argument('-p','--profile', |
|
73 | parent_parser2.add_argument('-p','--profile', | |
74 |
dest='Global.profile',type= |
|
74 | dest='Global.profile',type=unicode, | |
75 | default=NoConfigDefault, |
|
75 | default=NoConfigDefault, | |
76 | help='The string name of the profile to be used. This determines ' |
|
76 | help='The string name of the profile to be used. This determines ' | |
77 | 'the name of the cluster dir as: cluster_<profile>. The default profile ' |
|
77 | 'the name of the cluster dir as: cluster_<profile>. The default profile ' | |
@@ -80,7 +80,7 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
80 | default=NoConfigDefault, |
|
80 | default=NoConfigDefault, | |
81 | metavar='Global.profile') |
|
81 | metavar='Global.profile') | |
82 | parent_parser2.add_argument('--cluster-dir', |
|
82 | parent_parser2.add_argument('--cluster-dir', | |
83 |
dest='Global.cluster_dir',type= |
|
83 | dest='Global.cluster_dir',type=unicode, | |
84 | default=NoConfigDefault, |
|
84 | default=NoConfigDefault, | |
85 | help='Set the cluster dir. This overrides the logic used by the ' |
|
85 | help='Set the cluster dir. This overrides the logic used by the ' | |
86 | '--profile option.', |
|
86 | '--profile option.', | |
@@ -165,12 +165,12 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
165 | ) |
|
165 | ) | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | default_config_file_name = 'ipcluster_config.py' |
|
168 | default_config_file_name = u'ipcluster_config.py' | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | class IPClusterApp(ApplicationWithClusterDir): |
|
171 | class IPClusterApp(ApplicationWithClusterDir): | |
172 |
|
172 | |||
173 | name = 'ipcluster' |
|
173 | name = u'ipcluster' | |
174 | description = 'Start an IPython cluster (controller and engines).' |
|
174 | description = 'Start an IPython cluster (controller and engines).' | |
175 | config_file_name = default_config_file_name |
|
175 | config_file_name = default_config_file_name | |
176 | default_log_level = logging.INFO |
|
176 | default_log_level = logging.INFO | |
@@ -278,7 +278,6 b' class IPClusterApp(ApplicationWithClusterDir):' | |||||
278 |
|
278 | |||
279 | # Setup signals |
|
279 | # Setup signals | |
280 | signal.signal(signal.SIGINT, self.stop_launchers) |
|
280 | signal.signal(signal.SIGINT, self.stop_launchers) | |
281 | # signal.signal(signal.SIGKILL, self.stop_launchers) |
|
|||
282 |
|
281 | |||
283 | # Setup the observing of stopping |
|
282 | # Setup the observing of stopping | |
284 | d1 = self.controller_launcher.observe_stop() |
|
283 | d1 = self.controller_launcher.observe_stop() |
@@ -59,7 +59,7 b' default_client_interfaces.MultiEngine.interface_chain = [' | |||||
59 | 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine' |
|
59 | 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine' | |
60 | ] |
|
60 | ] | |
61 |
|
61 | |||
62 | default_client_interfaces.MultiEngine.furl_file = 'ipcontroller-mec.furl' |
|
62 | default_client_interfaces.MultiEngine.furl_file = u'ipcontroller-mec.furl' | |
63 |
|
63 | |||
64 | # Make this a dict we can pass to Config.__init__ for the default |
|
64 | # Make this a dict we can pass to Config.__init__ for the default | |
65 | default_client_interfaces = dict(copy.deepcopy(default_client_interfaces.items())) |
|
65 | default_client_interfaces = dict(copy.deepcopy(default_client_interfaces.items())) | |
@@ -72,7 +72,7 b' default_engine_interfaces.Default.interface_chain = [' | |||||
72 | 'IPython.kernel.enginefc.IFCControllerBase' |
|
72 | 'IPython.kernel.enginefc.IFCControllerBase' | |
73 | ] |
|
73 | ] | |
74 |
|
74 | |||
75 | default_engine_interfaces.Default.furl_file = 'ipcontroller-engine.furl' |
|
75 | default_engine_interfaces.Default.furl_file = u'ipcontroller-engine.furl' | |
76 |
|
76 | |||
77 | # Make this a dict we can pass to Config.__init__ for the default |
|
77 | # Make this a dict we can pass to Config.__init__ for the default | |
78 | default_engine_interfaces = dict(copy.deepcopy(default_engine_interfaces.items())) |
|
78 | default_engine_interfaces = dict(copy.deepcopy(default_engine_interfaces.items())) | |
@@ -86,7 +86,7 b' default_engine_interfaces = dict(copy.deepcopy(default_engine_interfaces.items()' | |||||
86 | class FCClientServiceFactory(FCServiceFactory): |
|
86 | class FCClientServiceFactory(FCServiceFactory): | |
87 | """A Foolscap implementation of the client services.""" |
|
87 | """A Foolscap implementation of the client services.""" | |
88 |
|
88 | |||
89 |
cert_file = |
|
89 | cert_file = Unicode(u'ipcontroller-client.pem', config=True) | |
90 | interfaces = Instance(klass=Config, kw=default_client_interfaces, |
|
90 | interfaces = Instance(klass=Config, kw=default_client_interfaces, | |
91 | allow_none=False, config=True) |
|
91 | allow_none=False, config=True) | |
92 |
|
92 | |||
@@ -94,7 +94,7 b' class FCClientServiceFactory(FCServiceFactory):' | |||||
94 | class FCEngineServiceFactory(FCServiceFactory): |
|
94 | class FCEngineServiceFactory(FCServiceFactory): | |
95 | """A Foolscap implementation of the engine services.""" |
|
95 | """A Foolscap implementation of the engine services.""" | |
96 |
|
96 | |||
97 |
cert_file = |
|
97 | cert_file = Unicode(u'ipcontroller-engine.pem', config=True) | |
98 | interfaces = Instance(klass=dict, kw=default_engine_interfaces, |
|
98 | interfaces = Instance(klass=dict, kw=default_engine_interfaces, | |
99 | allow_none=False, config=True) |
|
99 | allow_none=False, config=True) | |
100 |
|
100 | |||
@@ -176,12 +176,12 b' class IPControllerAppCLConfigLoader(AppWithClusterDirArgParseConfigLoader):' | |||||
176 | arguments = cl_args |
|
176 | arguments = cl_args | |
177 |
|
177 | |||
178 |
|
178 | |||
179 | default_config_file_name = 'ipcontroller_config.py' |
|
179 | default_config_file_name = u'ipcontroller_config.py' | |
180 |
|
180 | |||
181 |
|
181 | |||
182 | class IPControllerApp(ApplicationWithClusterDir): |
|
182 | class IPControllerApp(ApplicationWithClusterDir): | |
183 |
|
183 | |||
184 | name = 'ipcontroller' |
|
184 | name = u'ipcontroller' | |
185 | description = 'Start the IPython controller for parallel computing.' |
|
185 | description = 'Start the IPython controller for parallel computing.' | |
186 | config_file_name = default_config_file_name |
|
186 | config_file_name = default_config_file_name | |
187 | auto_create_cluster_dir = True |
|
187 | auto_create_cluster_dir = True |
@@ -44,7 +44,7 b' from IPython.kernel.engineconnector import EngineConnector' | |||||
44 | cl_args = ( |
|
44 | cl_args = ( | |
45 | # Controller config |
|
45 | # Controller config | |
46 | (('--furl-file',), dict( |
|
46 | (('--furl-file',), dict( | |
47 |
type= |
|
47 | type=unicode, dest='Global.furl_file', default=NoConfigDefault, | |
48 | help='The full location of the file containing the FURL of the ' |
|
48 | help='The full location of the file containing the FURL of the ' | |
49 | 'controller. If this is not given, the FURL file must be in the ' |
|
49 | 'controller. If this is not given, the FURL file must be in the ' | |
50 | 'security directory of the cluster directory. This location is ' |
|
50 | 'security directory of the cluster directory. This location is ' | |
@@ -84,12 +84,12 b' mpi.size = 0' | |||||
84 | """ |
|
84 | """ | |
85 |
|
85 | |||
86 |
|
86 | |||
87 | default_config_file_name = 'ipengine_config.py' |
|
87 | default_config_file_name = u'ipengine_config.py' | |
88 |
|
88 | |||
89 |
|
89 | |||
90 | class IPEngineApp(ApplicationWithClusterDir): |
|
90 | class IPEngineApp(ApplicationWithClusterDir): | |
91 |
|
91 | |||
92 | name = 'ipengine' |
|
92 | name = u'ipengine' | |
93 | description = 'Start the IPython engine for parallel computing.' |
|
93 | description = 'Start the IPython engine for parallel computing.' | |
94 | config_file_name = default_config_file_name |
|
94 | config_file_name = default_config_file_name | |
95 | auto_create_cluster_dir = True |
|
95 | auto_create_cluster_dir = True | |
@@ -108,10 +108,10 b' class IPEngineApp(ApplicationWithClusterDir):' | |||||
108 | # Configuration related to the controller |
|
108 | # Configuration related to the controller | |
109 | # This must match the filename (path not included) that the controller |
|
109 | # This must match the filename (path not included) that the controller | |
110 | # used for the FURL file. |
|
110 | # used for the FURL file. | |
111 | self.default_config.Global.furl_file_name = 'ipcontroller-engine.furl' |
|
111 | self.default_config.Global.furl_file_name = u'ipcontroller-engine.furl' | |
112 | # If given, this is the actual location of the controller's FURL file. |
|
112 | # If given, this is the actual location of the controller's FURL file. | |
113 | # If not, this is computed using the profile, app_dir and furl_file_name |
|
113 | # If not, this is computed using the profile, app_dir and furl_file_name | |
114 | self.default_config.Global.furl_file = '' |
|
114 | self.default_config.Global.furl_file = u'' | |
115 |
|
115 | |||
116 | # The max number of connection attemps and the initial delay between |
|
116 | # The max number of connection attemps and the initial delay between | |
117 | # those attemps. |
|
117 | # those attemps. |
@@ -244,8 +244,8 b' class LocalProcessLauncher(BaseLauncher):' | |||||
244 | self.start_deferred = defer.Deferred() |
|
244 | self.start_deferred = defer.Deferred() | |
245 | self.process_transport = reactor.spawnProcess( |
|
245 | self.process_transport = reactor.spawnProcess( | |
246 | self.process_protocol, |
|
246 | self.process_protocol, | |
247 | str(self.args[0]), |
|
247 | str(self.args[0]), # twisted expects these to be str, not unicode | |
248 | [str(a) for a in self.args], |
|
248 | [str(a) for a in self.args], # str expected, not unicode | |
249 | env=os.environ |
|
249 | env=os.environ | |
250 | ) |
|
250 | ) | |
251 | return self.start_deferred |
|
251 | return self.start_deferred |
General Comments 0
You need to be logged in to leave comments.
Login now