##// END OF EJS Templates
Various fixes to ipapp/ipcluster/ipengine/ipcontroller....
Brian Granger -
Show More
@@ -97,11 +97,11 b' class Application(object):'
97 97 usage = None
98 98 #: The command line config loader. Subclass of ArgParseConfigLoader.
99 99 command_line_loader = BaseAppConfigLoader
100 #: The name of the config file to load.
101 config_file_name = u'ipython_config.py'
100 #: The name of the config file to load, determined at runtime
101 config_file_name = None
102 102 #: The name of the default config file. Track separately from the actual
103 103 #: name because some logic happens only if we aren't using the default.
104 default_config_file_name = config_file_name
104 default_config_file_name = u'ipython_config.py'
105 105 default_log_level = logging.WARN
106 106 #: Set by --profile option
107 107 profile_name = None
@@ -315,18 +315,22 b' class Application(object):'
315 315
316 316 If a profile has been set at the command line, this will resolve it.
317 317 """
318
319 318 try:
320 319 self.config_file_name = self.command_line_config.Global.config_file
321 320 except AttributeError:
322 321 pass
322 else:
323 return
323 324
324 325 try:
325 326 self.profile_name = self.command_line_config.Global.profile
326 327 except AttributeError:
327 pass
328 # Just use the default as there is no profile
329 self.config_file_name = self.default_config_file_name
328 330 else:
329 name_parts = self.config_file_name.split('.')
331 # Use the default config file name and profile name if set
332 # to determine the used config file name.
333 name_parts = self.default_config_file_name.split('.')
330 334 name_parts.insert(1, u'_' + self.profile_name + u'.')
331 335 self.config_file_name = ''.join(name_parts)
332 336
@@ -252,7 +252,7 b' class IPAppConfigLoader(BaseAppConfigLoader):'
252 252 type=str, dest='InteractiveShell.separate_out2',
253 253 help="Separator after output prompts. Default 0 (nonight).",
254 254 metavar='InteractiveShell.separate_out2')
255 paa('-no-sep',
255 paa('--no-sep',
256 256 action='store_true', dest='Global.nosep',
257 257 help="Eliminate all spacing between prompts.")
258 258 paa('--term-title',
@@ -389,7 +389,7 b' class IPythonApp(Application):'
389 389 description = None
390 390 usage = usage.cl_usage
391 391 command_line_loader = IPAppConfigLoader
392 config_file_name = default_config_file_name
392 default_config_file_name = default_config_file_name
393 393 crash_handler_class = IPAppCrashHandler
394 394
395 395 def create_default_config(self):
@@ -486,7 +486,6 b' class IPythonApp(Application):'
486 486 # based app, because we call shell.show_banner() by hand below
487 487 # so the banner shows *before* all extension loading stuff.
488 488 self.shell.display_banner = False
489
490 489 if config.Global.display_banner and \
491 490 config.Global.interact:
492 491 self.shell.show_banner()
@@ -441,8 +441,10 b' class ApplicationWithClusterDir(Application):'
441 441 def find_config_file_name(self):
442 442 """Find the config file name for this application."""
443 443 # For this type of Application it should be set as a class attribute.
444 if not hasattr(self, 'config_file_name'):
444 if not hasattr(self, 'default_config_file_name'):
445 445 self.log.critical("No config filename found")
446 else:
447 self.config_file_name = self.default_config_file_name
446 448
447 449 def find_config_file_paths(self):
448 450 # Set the search path to to the cluster directory. We should NOT
@@ -265,9 +265,13 b' class FCServiceFactory(AdaptedConfiguredObjectFactory):'
265 265 """Register the reference with the FURL file.
266 266
267 267 The FURL file is created and then moved to make sure that when the
268 file appears, the buffer has been flushed and the file closed.
268 file appears, the buffer has been flushed and the file closed. This
269 is not done if we are re-using FURLS however.
269 270 """
270 temp_furl_file = get_temp_furlfile(furl_file)
271 self.tub.registerReference(ref, furlFile=temp_furl_file)
272 os.rename(temp_furl_file, furl_file)
271 if self.reuse_furls:
272 self.tub.registerReference(ref, furlFile=furl_file)
273 else:
274 temp_furl_file = get_temp_furlfile(furl_file)
275 self.tub.registerReference(ref, furlFile=temp_furl_file)
276 os.rename(temp_furl_file, furl_file)
273 277
@@ -218,7 +218,7 b' class IPClusterApp(ApplicationWithClusterDir):'
218 218 description = _description
219 219 usage = None
220 220 command_line_loader = IPClusterAppConfigLoader
221 config_file_name = default_config_file_name
221 default_config_file_name = default_config_file_name
222 222 default_log_level = logging.INFO
223 223 auto_create_cluster_dir = False
224 224
@@ -30,7 +30,7 b' from IPython.kernel.clusterdir import ('
30 30 ApplicationWithClusterDir,
31 31 ClusterDirConfigLoader
32 32 )
33 from IPython.kernel.fcutil import FCServiceFactory
33 from IPython.kernel.fcutil import FCServiceFactory, FURLError
34 34 from IPython.utils.traitlets import Instance, Unicode
35 35
36 36
@@ -186,19 +186,22 b' class IPControllerApp(ApplicationWithClusterDir):'
186 186 name = u'ipcontroller'
187 187 description = _description
188 188 command_line_loader = IPControllerAppConfigLoader
189 config_file_name = default_config_file_name
189 default_config_file_name = default_config_file_name
190 190 auto_create_cluster_dir = True
191 191
192 192 def create_default_config(self):
193 193 super(IPControllerApp, self).create_default_config()
194 self.default_config.Global.reuse_furls = False
195 self.default_config.Global.secure = True
194 # Don't set defaults for Global.secure or Global.reuse_furls
195 # as those are set in a component.
196 196 self.default_config.Global.import_statements = []
197 197 self.default_config.Global.clean_logs = True
198 198
199 def post_load_command_line_config(self):
200 # Now setup reuse_furls
201 c = self.command_line_config
199 def pre_construct(self):
200 super(IPControllerApp, self).pre_construct()
201 c = self.master_config
202 # The defaults for these are set in FCClientServiceFactory and
203 # FCEngineServiceFactory, so we only set them here if the global
204 # options have be set to override the class level defaults.
202 205 if hasattr(c.Global, 'reuse_furls'):
203 206 c.FCClientServiceFactory.reuse_furls = c.Global.reuse_furls
204 207 c.FCEngineServiceFactory.reuse_furls = c.Global.reuse_furls
@@ -221,11 +224,19 b' class IPControllerApp(ApplicationWithClusterDir):'
221 224 controller_service = controllerservice.ControllerService()
222 225 controller_service.setServiceParent(self.main_service)
223 226 # The client tub and all its refereceables
224 csfactory = FCClientServiceFactory(self.master_config, controller_service)
227 try:
228 csfactory = FCClientServiceFactory(self.master_config, controller_service)
229 except FURLError, e:
230 log.err(e)
231 self.exit(0)
225 232 client_service = csfactory.create()
226 233 client_service.setServiceParent(self.main_service)
227 234 # The engine tub
228 esfactory = FCEngineServiceFactory(self.master_config, controller_service)
235 try:
236 esfactory = FCEngineServiceFactory(self.master_config, controller_service)
237 except FURLError, e:
238 log.err(e)
239 self.exit(0)
229 240 engine_service = esfactory.create()
230 241 engine_service.setServiceParent(self.main_service)
231 242
@@ -103,7 +103,7 b' class IPEngineApp(ApplicationWithClusterDir):'
103 103 name = u'ipengine'
104 104 description = _description
105 105 command_line_loader = IPEngineAppConfigLoader
106 config_file_name = default_config_file_name
106 default_config_file_name = default_config_file_name
107 107 auto_create_cluster_dir = True
108 108
109 109 def create_default_config(self):
General Comments 0
You need to be logged in to leave comments. Login now