Ignore:
Timestamp:
12 Jun 2012, 10:00:07 (13 years ago)
Author:
uli
Message:

Search instances by path and rename kofa_projects to instances.

File:
1 edited

Legend:

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

    r8687 r8689  
    44import sys
    55import time
    6 import waeup.kofa
     6#import waeup.kofa
    77
    88AVAILABLE_KOFA_PROJECTS = ['waeup.kofa',]
     
    1010kofa_projects = dict()
    1111
    12 for pkg_name in AVAILABLE_KOFA_PROJECTS:
     12root = os.path.dirname(os.path.dirname(os.path.dirname(
     13    os.path.dirname(__file__))))
     14instances_root = os.path.join(root, 'instances')
     15instances = dict()
     16print "ROOT: ", root
     17for pkg_name in os.listdir(instances_root):
    1318    try:
     19        if pkg_name.startswith('.') or '.' not in pkg_name:
     20            continue
     21        path_ = os.path.join(instances_root, pkg_name)
     22        if not os.path.isdir(path_):
     23            continue
    1424        name = pkg_name.split('.')[-1]
    15         mod = sys.modules[pkg_name].__file__
    16         packages[name] = os.path.dirname(mod)
    17         kofa_projects[name] = os.path.dirname(os.path.dirname(os.path.dirname(
    18             packages[name])))
     25        instances[name] = path_
    1926    except:
    2027        # not a package
    2128        pass
    2229
    23 print "PACKAGES: ", packages
    24 print "KOFA PROJECTS: ", kofa_projects
     30print "WAEUP.STRESS.INIT: INSTANCES: ", instances
    2531
    2632def do_foo():
     
    3844    """Run bootstrap and buildout for each of the KOFA instances
    3945    """
    40     for name, path in kofa_projects.items():
     46    for name, path in instances.items():
    4147        bootstrap_instance(name, path)
    4248    return
     
    5763
    5864def remove_zodb(name):
    59     path = kofa_projects[name]
     65    path = instances[name]
    6066    print "WAEUP.STRESS: removing ZODB of %s at %s" % (name, path)
    6167    filestorage_dir = os.path.join(path, 'var', 'filestorage')
     
    7884    instance.
    7985    """
    80     path = kofa_projects[name]
     86    path = instances[name]
    8187    print "WAEUP.STRESS: starting instance %s at %s using %s" % (
    8288        name, path, mode),
     
    121127    use to stop the instance.
    122128    """
    123     path = kofa_projects[name]
     129    path = instances[name]
    124130    print "WAEUP.STRESS: shutting down instance %s at %s using %s" % (
    125131        name, path, mode),
     
    141147
    142148def install_app(name):
    143     path = kofa_projects[name]
     149    """Execute waeup.stress.script in instance context.
     150    """
     151    path = instances[name]
    144152    old_cwd_ = os.getcwd()
    145153    os.chdir(path)
    146     db_file = os.path.join(path, 'var', 'filestorage', 'Data.fs')
    147     config_file = os.path.join(path, 'parts', 'etc', 'site.zcml')
    148     #import waeup.kofa.meta
    149     #import grok.meta
    150     import grok
    151     #print "META: ", grok.meta
    152     import sys
    153     #print "PATHS: ", sys.path
    154     from zope.app.appsetup import database, config
    155     #config(config_file)
    156     #subprocess.call(
    157     #    './bin/python-console -c "import grok.meta"', shell=True)
    158154    script = os.path.join(os.path.dirname(__file__), 'scripts.py')
    159155    subprocess.call(
Note: See TracChangeset for help on using the changeset viewer.