Show More
@@ -36,7 +36,7 b' from IPython.utils.path import (' | |||||
36 | get_ipython_dir, |
|
36 | get_ipython_dir, | |
37 | expand_path |
|
37 | expand_path | |
38 | ) |
|
38 | ) | |
39 | from IPython.utils.traitlets import Unicode, Bool, Instance, Dict |
|
39 | from IPython.utils.traitlets import Unicode, Bool, Instance, Dict, List | |
40 |
|
40 | |||
41 | #----------------------------------------------------------------------------- |
|
41 | #----------------------------------------------------------------------------- | |
42 | # Module errors |
|
42 | # Module errors | |
@@ -303,12 +303,12 b' class ClusterDirCrashHandler(CrashHandler):' | |||||
303 | base_aliases = { |
|
303 | base_aliases = { | |
304 | 'profile' : "ClusterDir.profile", |
|
304 | 'profile' : "ClusterDir.profile", | |
305 | 'cluster_dir' : 'ClusterDir.location', |
|
305 | 'cluster_dir' : 'ClusterDir.location', | |
306 | 'auto_create' : 'ClusterDirApplication.auto_create', |
|
|||
307 | 'log_level' : 'ClusterApplication.log_level', |
|
306 | 'log_level' : 'ClusterApplication.log_level', | |
308 | 'work_dir' : 'ClusterApplication.work_dir', |
|
307 | 'work_dir' : 'ClusterApplication.work_dir', | |
309 | 'log_to_file' : 'ClusterApplication.log_to_file', |
|
308 | 'log_to_file' : 'ClusterApplication.log_to_file', | |
310 | 'clean_logs' : 'ClusterApplication.clean_logs', |
|
309 | 'clean_logs' : 'ClusterApplication.clean_logs', | |
311 | 'log_url' : 'ClusterApplication.log_url', |
|
310 | 'log_url' : 'ClusterApplication.log_url', | |
|
311 | 'config' : 'ClusterApplication.config_file', | |||
312 | } |
|
312 | } | |
313 |
|
313 | |||
314 | base_flags = { |
|
314 | base_flags = { | |
@@ -329,7 +329,7 b' class ClusterApplication(BaseIPythonApplication):' | |||||
329 | The cluster directory is resolved as follows: |
|
329 | The cluster directory is resolved as follows: | |
330 |
|
330 | |||
331 | * If the ``cluster_dir`` option is given, it is used. |
|
331 | * If the ``cluster_dir`` option is given, it is used. | |
332 | * If ``cluster_dir`` is not given, the application directory is |
|
332 | * If ``cluster_dir`` is not given, the application directory is | |
333 | resolve using the profile name as ``cluster_<profile>``. The search |
|
333 | resolve using the profile name as ``cluster_<profile>``. The search | |
334 | path for this directory is then i) cwd if it is found there |
|
334 | path for this directory is then i) cwd if it is found there | |
335 | and ii) in ipython_dir otherwise. |
|
335 | and ii) in ipython_dir otherwise. | |
@@ -357,16 +357,27 b' class ClusterApplication(BaseIPythonApplication):' | |||||
357 | log_to_file = Bool(config=True, |
|
357 | log_to_file = Bool(config=True, | |
358 | help="whether to log to a file") |
|
358 | help="whether to log to a file") | |
359 |
|
359 | |||
360 |
clean_logs = Bool(False, |
|
360 | clean_logs = Bool(False, config=True, | |
361 | help="whether to cleanup old logfiles before starting") |
|
361 | help="whether to cleanup old logfiles before starting") | |
362 |
|
362 | |||
363 |
log_url = Unicode('', |
|
363 | log_url = Unicode('', config=True, | |
364 | help="The ZMQ URL of the iplogger to aggregate logging.") |
|
364 | help="The ZMQ URL of the iplogger to aggregate logging.") | |
365 |
|
365 | |||
366 | config_file = Unicode(u'', config=True, |
|
366 | config_file = Unicode(u'', config=True, | |
367 |
help="""Path to ip |
|
367 | help="""Path to ip<appname> configuration file. The default is to use | |
368 | <appname>_config.py, as found by cluster-dir.""" |
|
368 | <appname>_config.py, as found by cluster-dir.""" | |
369 | ) |
|
369 | ) | |
|
370 | def _config_file_paths_default(self): | |||
|
371 | # don't include profile dir | |||
|
372 | return [ os.getcwdu(), self.ipython_dir ] | |||
|
373 | ||||
|
374 | def _config_file_changed(self, name, old, new): | |||
|
375 | if os.pathsep in new: | |||
|
376 | path, new = new.rsplit(os.pathsep) | |||
|
377 | self.config_file_paths.insert(0, path) | |||
|
378 | self.config_file_name = new | |||
|
379 | ||||
|
380 | config_file_name = Unicode('') | |||
370 |
|
381 | |||
371 | loop = Instance('zmq.eventloop.ioloop.IOLoop') |
|
382 | loop = Instance('zmq.eventloop.ioloop.IOLoop') | |
372 | def _loop_default(self): |
|
383 | def _loop_default(self): | |
@@ -409,6 +420,9 b' class ClusterApplication(BaseIPythonApplication):' | |||||
409 | else: |
|
420 | else: | |
410 | self.log.info('Using existing cluster dir: %s' % \ |
|
421 | self.log.info('Using existing cluster dir: %s' % \ | |
411 | self.cluster_dir.location) |
|
422 | self.cluster_dir.location) | |
|
423 | ||||
|
424 | # insert after cwd: | |||
|
425 | self.config_file_paths.insert(1, self.cluster_dir.location) | |||
412 |
|
426 | |||
413 | def initialize(self, argv=None): |
|
427 | def initialize(self, argv=None): | |
414 | """initialize the app""" |
|
428 | """initialize the app""" | |
@@ -416,14 +430,7 b' class ClusterApplication(BaseIPythonApplication):' | |||||
416 | self.parse_command_line(argv) |
|
430 | self.parse_command_line(argv) | |
417 | cl_config = self.config |
|
431 | cl_config = self.config | |
418 | self.init_clusterdir() |
|
432 | self.init_clusterdir() | |
419 |
|
|
433 | self.load_config_file() | |
420 | self.load_config_file(self.config_file) |
|
|||
421 | elif self.default_config_file_name: |
|
|||
422 | try: |
|
|||
423 | self.load_config_file(self.default_config_file_name, |
|
|||
424 | path=self.cluster_dir.location) |
|
|||
425 | except IOError: |
|
|||
426 | self.log.warn("Warning: Default config file not found") |
|
|||
427 | # command-line should *override* config file, but command-line is necessary |
|
434 | # command-line should *override* config file, but command-line is necessary | |
428 | # to determine clusterdir, etc. |
|
435 | # to determine clusterdir, etc. | |
429 | self.update_config(cl_config) |
|
436 | self.update_config(cl_config) | |
@@ -438,17 +445,6 b' class ClusterApplication(BaseIPythonApplication):' | |||||
438 | # This is the working dir by now. |
|
445 | # This is the working dir by now. | |
439 | sys.path.insert(0, '') |
|
446 | sys.path.insert(0, '') | |
440 |
|
447 | |||
441 | def load_config_file(self, filename, path=None): |
|
|||
442 | """Load a .py based config file by filename and path.""" |
|
|||
443 | # use config.application.Application.load_config |
|
|||
444 | # instead of inflexible core.newapplication.BaseIPythonApplication.load_config |
|
|||
445 | return Application.load_config_file(self, filename, path=path) |
|
|||
446 | # |
|
|||
447 | # def load_default_config_file(self): |
|
|||
448 | # """Load a .py based config file by filename and path.""" |
|
|||
449 | # return BaseIPythonApplication.load_config_file(self) |
|
|||
450 |
|
||||
451 | # disable URL-logging |
|
|||
452 | def reinit_logging(self): |
|
448 | def reinit_logging(self): | |
453 | # Remove old log files |
|
449 | # Remove old log files | |
454 | log_dir = self.cluster_dir.log_dir |
|
450 | log_dir = self.cluster_dir.log_dir |
@@ -178,7 +178,7 b' class IPClusterCreate(ClusterApplication):' | |||||
178 | description = create_help |
|
178 | description = create_help | |
179 | auto_create_cluster_dir = Bool(True, |
|
179 | auto_create_cluster_dir = Bool(True, | |
180 | help="whether to create the cluster_dir if it doesn't exist") |
|
180 | help="whether to create the cluster_dir if it doesn't exist") | |
181 | default_config_file_name = default_config_file_name |
|
181 | config_file_name = Unicode(default_config_file_name) | |
182 |
|
182 | |||
183 | reset = Bool(False, config=True, |
|
183 | reset = Bool(False, config=True, | |
184 | help="Whether to reset config files as part of 'create'." |
|
184 | help="Whether to reset config files as part of 'create'." | |
@@ -210,7 +210,7 b' class IPClusterStop(ClusterApplication):' | |||||
210 | name = u'ipcluster' |
|
210 | name = u'ipcluster' | |
211 | description = stop_help |
|
211 | description = stop_help | |
212 | auto_create_cluster_dir = Bool(False) |
|
212 | auto_create_cluster_dir = Bool(False) | |
213 | default_config_file_name = default_config_file_name |
|
213 | config_file_name = Unicode(default_config_file_name) | |
214 |
|
214 | |||
215 | signal = Int(signal.SIGINT, config=True, |
|
215 | signal = Int(signal.SIGINT, config=True, | |
216 | help="signal to use for stopping processes.") |
|
216 | help="signal to use for stopping processes.") | |
@@ -277,7 +277,7 b' class IPClusterEngines(ClusterApplication):' | |||||
277 | name = u'ipcluster' |
|
277 | name = u'ipcluster' | |
278 | description = engines_help |
|
278 | description = engines_help | |
279 | usage = None |
|
279 | usage = None | |
280 | default_config_file_name = default_config_file_name |
|
280 | config_file_name = Unicode(default_config_file_name) | |
281 | default_log_level = logging.INFO |
|
281 | default_log_level = logging.INFO | |
282 | auto_create_cluster_dir = Bool(False) |
|
282 | auto_create_cluster_dir = Bool(False) | |
283 | classes = List() |
|
283 | classes = List() | |
@@ -409,8 +409,6 b' class IPClusterStart(IPClusterEngines):' | |||||
409 |
|
409 | |||
410 | name = u'ipcluster' |
|
410 | name = u'ipcluster' | |
411 | description = start_help |
|
411 | description = start_help | |
412 | usage = None |
|
|||
413 | default_config_file_name = default_config_file_name |
|
|||
414 | default_log_level = logging.INFO |
|
412 | default_log_level = logging.INFO | |
415 | auto_create_cluster_dir = Bool(True, config=True, |
|
413 | auto_create_cluster_dir = Bool(True, config=True, | |
416 | help="whether to create the cluster_dir if it doesn't exist") |
|
414 | help="whether to create the cluster_dir if it doesn't exist") |
@@ -110,8 +110,7 b' class IPControllerApp(ClusterApplication):' | |||||
110 |
|
110 | |||
111 | name = u'ipcontroller' |
|
111 | name = u'ipcontroller' | |
112 | description = _description |
|
112 | description = _description | |
113 | # command_line_loader = IPControllerAppConfigLoader |
|
113 | config_file_name = Unicode(default_config_file_name) | |
114 | default_config_file_name = default_config_file_name |
|
|||
115 | classes = [ClusterDir, StreamSession, HubFactory, TaskScheduler, HeartMonitor, SQLiteDB] + maybe_mongo |
|
114 | classes = [ClusterDir, StreamSession, HubFactory, TaskScheduler, HeartMonitor, SQLiteDB] + maybe_mongo | |
116 |
|
115 | |||
117 | auto_create_cluster_dir = Bool(True, config=True, |
|
116 | auto_create_cluster_dir = Bool(True, config=True, |
@@ -102,7 +102,7 b' class IPEngineApp(ClusterApplication):' | |||||
102 |
|
102 | |||
103 | app_name = Unicode(u'ipengine') |
|
103 | app_name = Unicode(u'ipengine') | |
104 | description = Unicode(_description) |
|
104 | description = Unicode(_description) | |
105 | default_config_file_name = default_config_file_name |
|
105 | config_file_name = Unicode(default_config_file_name) | |
106 | classes = List([ClusterDir, StreamSession, EngineFactory, Kernel, MPI]) |
|
106 | classes = List([ClusterDir, StreamSession, EngineFactory, Kernel, MPI]) | |
107 |
|
107 | |||
108 | auto_create_cluster_dir = Bool(False, |
|
108 | auto_create_cluster_dir = Bool(False, |
@@ -20,7 +20,7 b' import sys' | |||||
20 |
|
20 | |||
21 | import zmq |
|
21 | import zmq | |
22 |
|
22 | |||
23 | from IPython.utils.traitlets import Bool, Dict |
|
23 | from IPython.utils.traitlets import Bool, Dict, Unicode | |
24 |
|
24 | |||
25 | from IPython.parallel.apps.clusterdir import ( |
|
25 | from IPython.parallel.apps.clusterdir import ( | |
26 | ClusterApplication, |
|
26 | ClusterApplication, | |
@@ -58,7 +58,7 b' class IPLoggerApp(ClusterApplication):' | |||||
58 |
|
58 | |||
59 | name = u'iploggerz' |
|
59 | name = u'iploggerz' | |
60 | description = _description |
|
60 | description = _description | |
61 | default_config_file_name = default_config_file_name |
|
61 | config_file_name = Unicode(default_config_file_name) | |
62 | auto_create_cluster_dir = Bool(False) |
|
62 | auto_create_cluster_dir = Bool(False) | |
63 |
|
63 | |||
64 | classes = [LogWatcher, ClusterDir] |
|
64 | classes = [LogWatcher, ClusterDir] |
General Comments 0
You need to be logged in to leave comments.
Login now