475 }), |
475 }), |
476 ) |
476 ) |
477 |
477 |
478 def start_instance(self, appid): |
478 def start_instance(self, appid): |
479 """start the instance's server""" |
479 """start the instance's server""" |
480 debug = self['debug'] |
|
481 force = self['force'] |
480 force = self['force'] |
482 loglevel = self['loglevel'] |
481 loglevel = self['loglevel'] |
483 config = cwcfg.config_for(appid) |
482 config = cwcfg.config_for(appid, debugmode=self['debug']) |
484 if loglevel is not None: |
483 if loglevel is not None: |
485 loglevel = 'LOG_%s' % loglevel.upper() |
484 loglevel = 'LOG_%s' % loglevel.upper() |
486 config.global_set_option('log-threshold', loglevel) |
485 config.global_set_option('log-threshold', loglevel) |
487 config.init_log(loglevel, debug=debug, force=True) |
486 config.init_log(loglevel, force=True) |
488 if self['profile']: |
487 if self['profile']: |
489 config.global_set_option('profile', self.config.profile) |
488 config.global_set_option('profile', self.config.profile) |
490 helper = self.config_helper(config, cmdname='start') |
489 helper = self.config_helper(config, cmdname='start') |
491 pidf = config['pid-file'] |
490 pidf = config['pid-file'] |
492 if exists(pidf) and not force: |
491 if exists(pidf) and not force: |
493 msg = "%s seems to be running. Remove %s by hand if necessary or use \ |
492 msg = "%s seems to be running. Remove %s by hand if necessary or use \ |
494 the --force option." |
493 the --force option." |
495 raise ExecutionError(msg % (appid, pidf)) |
494 raise ExecutionError(msg % (appid, pidf)) |
496 helper.start_server(config, debug) |
495 helper.start_server(config) |
497 |
496 |
498 |
497 |
499 class StopInstanceCommand(InstanceCommand): |
498 class StopInstanceCommand(InstanceCommand): |
500 """Stop the given instances. |
499 """Stop the given instances. |
501 |
500 |