Changeset 8748 for main/waeup.stress


Ignore:
Timestamp:
18 Jun 2012, 10:12:48 (12 years ago)
Author:
uli
Message:
  • Add support for running in profiling mode.
  • Make commands to be executed in instance context more modular.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.stress/trunk/src/waeup/stress/__init__.py

    r8690 r8748  
    7373    directory.
    7474
    75     `mode` can be one of `paster`|`kofactl` and tells how to start the
    76     instance.
     75    `mode` can be one of `paster`|`kofactl`|`zeo`|`profile` and tells
     76    how to start the instance.
    7777    """
    7878    path = instances[name]
     
    8484    if mode == 'kofactl':
    8585        subprocess.call('./bin/kofactl start', shell=True)
     86    elif mode == 'profile':
     87        subprocess.call(
     88            './bin/paster serve --daemon parts/etc/profile.ini', shell=True)
    8689    elif mode == 'zeo':
    8790        os.listdir('./bin')
     
    150153    """Execute waeup.stress.script in instance context.
    151154    """
     155    return exec_in_instance(name, 'install_app')
    152156    path = instances[name]
    153157    old_cwd_ = os.getcwd()
     
    157161        './bin/python-console %s' % script, shell=True)
    158162    os.chdir(old_cwd_)
     163
     164def import_csv(name, *paths):
     165    return exec_in_instance(name, 'import_csv', *paths)
     166
     167def exec_in_instance(name, cmd, *args):
     168    path = instances[name]
     169    old_cwd_ = os.getcwd()
     170    os.chdir(path)
     171    script = os.path.join(os.path.dirname(__file__), 'scripts.py')
     172    if args:
     173        args = ' '.join(args)
     174    else:
     175        args = ''
     176    subprocess.call(
     177        './bin/python-console %s %s %s' % (
     178            script, cmd, args), shell=True)
     179    os.chdir(old_cwd_)
Note: See TracChangeset for help on using the changeset viewer.