##// END OF EJS Templates
use BaseIPythonApp.load_config, not Application.load_config
MinRK -
Show More
@@ -36,7 +36,7 b' from IPython.utils.path import ('
36 36 get_ipython_dir,
37 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 42 # Module errors
@@ -303,12 +303,12 b' class ClusterDirCrashHandler(CrashHandler):'
303 303 base_aliases = {
304 304 'profile' : "ClusterDir.profile",
305 305 'cluster_dir' : 'ClusterDir.location',
306 'auto_create' : 'ClusterDirApplication.auto_create',
307 306 'log_level' : 'ClusterApplication.log_level',
308 307 'work_dir' : 'ClusterApplication.work_dir',
309 308 'log_to_file' : 'ClusterApplication.log_to_file',
310 309 'clean_logs' : 'ClusterApplication.clean_logs',
311 310 'log_url' : 'ClusterApplication.log_url',
311 'config' : 'ClusterApplication.config_file',
312 312 }
313 313
314 314 base_flags = {
@@ -357,16 +357,27 b' class ClusterApplication(BaseIPythonApplication):'
357 357 log_to_file = Bool(config=True,
358 358 help="whether to log to a file")
359 359
360 clean_logs = Bool(False, shortname='--clean-logs', config=True,
360 clean_logs = Bool(False, config=True,
361 361 help="whether to cleanup old logfiles before starting")
362 362
363 log_url = Unicode('', shortname='--log-url', config=True,
363 log_url = Unicode('', config=True,
364 364 help="The ZMQ URL of the iplogger to aggregate logging.")
365 365
366 366 config_file = Unicode(u'', config=True,
367 help="""Path to ipcontroller configuration file. The default is to use
367 help="""Path to ip<appname> configuration file. The default is to use
368 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 382 loop = Instance('zmq.eventloop.ioloop.IOLoop')
372 383 def _loop_default(self):
@@ -410,20 +421,16 b' class ClusterApplication(BaseIPythonApplication):'
410 421 self.log.info('Using existing cluster dir: %s' % \
411 422 self.cluster_dir.location)
412 423
424 # insert after cwd:
425 self.config_file_paths.insert(1, self.cluster_dir.location)
426
413 427 def initialize(self, argv=None):
414 428 """initialize the app"""
415 429 self.init_crash_handler()
416 430 self.parse_command_line(argv)
417 431 cl_config = self.config
418 432 self.init_clusterdir()
419 if self.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")
433 self.load_config_file()
427 434 # command-line should *override* config file, but command-line is necessary
428 435 # to determine clusterdir, etc.
429 436 self.update_config(cl_config)
@@ -438,17 +445,6 b' class ClusterApplication(BaseIPythonApplication):'
438 445 # This is the working dir by now.
439 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 448 def reinit_logging(self):
453 449 # Remove old log files
454 450 log_dir = self.cluster_dir.log_dir
@@ -178,7 +178,7 b' class IPClusterCreate(ClusterApplication):'
178 178 description = create_help
179 179 auto_create_cluster_dir = Bool(True,
180 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 183 reset = Bool(False, config=True,
184 184 help="Whether to reset config files as part of 'create'."
@@ -210,7 +210,7 b' class IPClusterStop(ClusterApplication):'
210 210 name = u'ipcluster'
211 211 description = stop_help
212 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 215 signal = Int(signal.SIGINT, config=True,
216 216 help="signal to use for stopping processes.")
@@ -277,7 +277,7 b' class IPClusterEngines(ClusterApplication):'
277 277 name = u'ipcluster'
278 278 description = engines_help
279 279 usage = None
280 default_config_file_name = default_config_file_name
280 config_file_name = Unicode(default_config_file_name)
281 281 default_log_level = logging.INFO
282 282 auto_create_cluster_dir = Bool(False)
283 283 classes = List()
@@ -409,8 +409,6 b' class IPClusterStart(IPClusterEngines):'
409 409
410 410 name = u'ipcluster'
411 411 description = start_help
412 usage = None
413 default_config_file_name = default_config_file_name
414 412 default_log_level = logging.INFO
415 413 auto_create_cluster_dir = Bool(True, config=True,
416 414 help="whether to create the cluster_dir if it doesn't exist")
@@ -110,8 +110,7 b' class IPControllerApp(ClusterApplication):'
110 110
111 111 name = u'ipcontroller'
112 112 description = _description
113 # command_line_loader = IPControllerAppConfigLoader
114 default_config_file_name = default_config_file_name
113 config_file_name = Unicode(default_config_file_name)
115 114 classes = [ClusterDir, StreamSession, HubFactory, TaskScheduler, HeartMonitor, SQLiteDB] + maybe_mongo
116 115
117 116 auto_create_cluster_dir = Bool(True, config=True,
@@ -102,7 +102,7 b' class IPEngineApp(ClusterApplication):'
102 102
103 103 app_name = Unicode(u'ipengine')
104 104 description = Unicode(_description)
105 default_config_file_name = default_config_file_name
105 config_file_name = Unicode(default_config_file_name)
106 106 classes = List([ClusterDir, StreamSession, EngineFactory, Kernel, MPI])
107 107
108 108 auto_create_cluster_dir = Bool(False,
@@ -20,7 +20,7 b' import sys'
20 20
21 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 25 from IPython.parallel.apps.clusterdir import (
26 26 ClusterApplication,
@@ -58,7 +58,7 b' class IPLoggerApp(ClusterApplication):'
58 58
59 59 name = u'iploggerz'
60 60 description = _description
61 default_config_file_name = default_config_file_name
61 config_file_name = Unicode(default_config_file_name)
62 62 auto_create_cluster_dir = Bool(False)
63 63
64 64 classes = [LogWatcher, ClusterDir]
General Comments 0
You need to be logged in to leave comments. Login now