Changeset 8681


Ignore:
Timestamp:
11 Jun 2012, 13:24:39 (12 years ago)
Author:
uli
Message:

Consider instance mode when starting/stopping instances.

Location:
main/waeup.stress/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.stress/trunk/kofa01/config.cfg

    r8673 r8681  
    1010kofa_instance = kofa
    1111kofa_baseport = 8080
    12 
     12kofa_instance_mode = paster
    1313
    1414[user_group-1]
  • main/waeup.stress/trunk/kofa01/post_run.py

    r8672 r8681  
    1 ## Actions to do after test runs.
     1"""Script run after tests have been done.
     2
     3This script is run with some additional globals set:
     4
     5- project_name: The name of this project (dir)
     6- cmd_opts: Commandline args from stress-run invocation
     7  Includes the stresstest-project directory.
     8- cfg_opts: options as set in local config.cfg.
     9
     10Context Python is normally the version used when running bootstrap on
     11the waeup.stress package.
     12"""
    213import waeup.stress
    314
    4 instance = 'kofa'
     15instance=cfg_opts['instance']
     16mode = cfg_opts['instance_mode']
    517
    6 waeup.stress.stop_instance(instance)
    7 waeup.stress.configure()
     18waeup.stress.stop_instance(instance, mode=mode)
  • main/waeup.stress/trunk/kofa01/pre_run.py

    r8675 r8681  
    1414
    1515instance=cfg_opts['instance']
     16mode = cfg_opts['instance_mode']
     17
    1618print "PRE-RUN.PY: using instance: waeup.%s" % instance
    1719
     
    2325
    2426## starts an instance as daemon
    25 waeup.stress.start_instance(instance)
     27waeup.stress.start_instance(instance, mode=mode)
    2628## wait for instance to come up
    2729waeup.stress.wait_for_startup(cfg_opts['host'], int(cfg_opts['baseport']))
  • main/waeup.stress/trunk/src/waeup/stress/__init__.py

    r8672 r8681  
    6868    return
    6969
    70 def start_instance(name):
     70def start_instance(name, mode='paster'):
     71    """Start instance `name` in `mode`.
     72
     73    The `name` should be someone like 'kofa', 'uniben', etc. where
     74    ``waeup.<NAME>`` is an existent instance in the `instances/`
     75    directory.
     76
     77    `mode` can be one of `paster`|`kofactl` and tells how to start the
     78    instance.
     79    """
    7180    path = kofa_projects[name]
    72     print "WAEUP.STRESS: starting instance %s at %s" % (name, path)
     81    print "WAEUP.STRESS: starting instance %s at %s using %s" % (
     82        name, path, mode),
    7383    old_cwd_ = os.getcwd()
    7484    os.chdir(path)
    7585    # yes, shell _is_ neccessary here
    76     subprocess.call(
    77         './bin/paster serve --daemon parts/etc/debug.ini', shell=True)
     86    if mode == 'kofactl':
     87        subprocess.call('./bin/kofactl start', shell=True)
     88    else:
     89        # by default we start paster as daemon
     90        subprocess.call(
     91            './bin/paster serve --daemon parts/etc/debug.ini', shell=True)
    7892    os.chdir(old_cwd_)
    7993    return
     
    92106    return
    93107
    94 def stop_instance(name):
     108def stop_instance(name, mode='paster'):
     109    """Stop instance `name` in `mode`.
     110
     111    The `name` should be someone like 'kofa', 'uniben', etc. where
     112    ``waeup.<NAME>`` is an existent instance in the `instances/`
     113    directory.
     114
     115    `mode` can be one of `paster`|`kofactl` and tells which tool to
     116    use to stop the instance.
     117    """
    95118    path = kofa_projects[name]
    96     print "WAEUP.STRESS: shutting down instance %s at %s" % (name, path),
     119    print "WAEUP.STRESS: shutting down instance %s at %s using %s" % (
     120        name, path, mode),
    97121    old_cwd_ = os.getcwd()
    98122    os.chdir(path)
    99     subprocess.call(
     123    if mode == 'kofactl':
     124        subprocess.call('./bin/kofactl stop', shell=True)
     125    else:
     126        # by default we use paster
     127        subprocess.call(
    100128        './bin/paster serve --stop-daemon', shell=True)
    101129    print "... done."
Note: See TracChangeset for help on using the changeset viewer.