More adjustments to runners.

This commit is contained in:
Joshua Harlow 2012-02-27 17:18:00 -08:00
parent 89c19bdefd
commit 4254841a84
5 changed files with 23 additions and 16 deletions

View File

@ -405,8 +405,8 @@ class ProgramRuntime(ComponentBase):
# Configure it with the given settings
LOG.info("Configuring runner for program [%s]" % (app_name))
runtime_info = (app_pth, app_dir, program_opts)
starter.configure(app_name, runtime_info, self.tracedir)
LOG.info("Configured runner for program [%s]" % (app_name))
cfg_am = starter.configure(self.component_name, app_name, runtime_info)
LOG.info("Configured %s files for runner for program [%s]" % (cfg_am, app_name))
def start(self):
# Select how we are going to start it

View File

@ -20,5 +20,11 @@ class RunnerBase(object):
def __init__(self, cfg):
self.cfg = cfg
def configure(self, component_name, app_name, runtime_info, tracedir):
return list()
def configure(self, component_name, app_name, runtime_info):
raise NotImplementedError()
def start(self, component_name, name, runtime_info, tracedir):
raise NotImplementedError()
def stop(self, component_name, name, trace_dir):
raise NotImplementedError()

View File

@ -24,12 +24,11 @@ import time
from devstack import exceptions as excp
from devstack import log as logging
from devstack import runner as base
from devstack import settings
from devstack import shell as sh
from devstack import trace as tr
from devstack.runners import runnerbase as base
LOG = logging.getLogger("devstack.runners.fork")
#maximum for the number of available file descriptors (when not found)
@ -173,6 +172,9 @@ class ForkRunner(base.RunnerBase):
runtrace.trace(k, v)
return tracefn
def configure(self, component_name, app_name, runtime_info):
return 0
def start(self, component_name, name, runtime_info, tracedir):
(program, appdir, program_args) = runtime_info
fn_name = FORK_TEMPL % (name)

View File

@ -22,13 +22,12 @@ import time
from devstack import date
from devstack import exceptions as excp
from devstack import log as logging
from devstack import runner as base
from devstack import settings
from devstack import shell as sh
from devstack import trace as tr
from devstack import utils
from devstack.runners import runnerbase as base
LOG = logging.getLogger("devstack.runners.screen")
#my type
@ -78,6 +77,9 @@ class ScreenRunner(base.RunnerBase):
base.RunnerBase.__init__(self, cfg)
self.socket_dir = sh.joinpths(tempfile.gettempdir(), SCREEN_SOCKET_DIR_NAME)
def configure(self, component_name, app_name, runtime_info):
return 0
def stop(self, component_name, name, tracedir):
fn_name = SCREEN_TEMPL % (name)
trace_fn = tr.trace_fn(tracedir, fn_name)

View File

@ -21,13 +21,12 @@ import subprocess
from devstack import date
from devstack import log as logging
from devstack import runner as base
from devstack import settings
from devstack import shell as sh
from devstack import trace as tr
from devstack import utils
from devstack.runners import runnerbase as base
LOG = logging.getLogger("devstack.runners.upstart")
#my type
@ -48,7 +47,6 @@ CONF_EXT = ".conf"
#shared template
UPSTART_CONF_TMPL = 'upstart.conf'
# Keep track of what we've emitted in the current python session
class UpstartRunner(base.RunnerBase):
@ -71,11 +69,10 @@ class UpstartRunner(base.RunnerBase):
self.events.add(component_event)
sh.unlink(trace_fn)
def configure(self, component_name, app_name, runtime_info, tracedir):
LOG.debug("Configure called for app:%s" % (app_name))
result = list()
result.append(self._do_upstart_configure(component_name, app_name, runtime_info))
return result
def configure(self, component_name, app_name, runtime_info):
LOG.debug("Configure called for app: %s" % (app_name))
self._do_upstart_configure(component_name, app_name, runtime_info)
return 1
def _get_upstart_conf_params(self, component_name, program_name, *program_args):
params = dict()