Changeset 8689 for main/waeup.stress/trunk/src
- Timestamp:
- 12 Jun 2012, 10:00:07 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.stress/trunk/src/waeup/stress/__init__.py
r8687 r8689 4 4 import sys 5 5 import time 6 import waeup.kofa6 #import waeup.kofa 7 7 8 8 AVAILABLE_KOFA_PROJECTS = ['waeup.kofa',] … … 10 10 kofa_projects = dict() 11 11 12 for pkg_name in AVAILABLE_KOFA_PROJECTS: 12 root = os.path.dirname(os.path.dirname(os.path.dirname( 13 os.path.dirname(__file__)))) 14 instances_root = os.path.join(root, 'instances') 15 instances = dict() 16 print "ROOT: ", root 17 for pkg_name in os.listdir(instances_root): 13 18 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 14 24 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_ 19 26 except: 20 27 # not a package 21 28 pass 22 29 23 print "PACKAGES: ", packages 24 print "KOFA PROJECTS: ", kofa_projects 30 print "WAEUP.STRESS.INIT: INSTANCES: ", instances 25 31 26 32 def do_foo(): … … 38 44 """Run bootstrap and buildout for each of the KOFA instances 39 45 """ 40 for name, path in kofa_projects.items():46 for name, path in instances.items(): 41 47 bootstrap_instance(name, path) 42 48 return … … 57 63 58 64 def remove_zodb(name): 59 path = kofa_projects[name]65 path = instances[name] 60 66 print "WAEUP.STRESS: removing ZODB of %s at %s" % (name, path) 61 67 filestorage_dir = os.path.join(path, 'var', 'filestorage') … … 78 84 instance. 79 85 """ 80 path = kofa_projects[name]86 path = instances[name] 81 87 print "WAEUP.STRESS: starting instance %s at %s using %s" % ( 82 88 name, path, mode), … … 121 127 use to stop the instance. 122 128 """ 123 path = kofa_projects[name]129 path = instances[name] 124 130 print "WAEUP.STRESS: shutting down instance %s at %s using %s" % ( 125 131 name, path, mode), … … 141 147 142 148 def install_app(name): 143 path = kofa_projects[name] 149 """Execute waeup.stress.script in instance context. 150 """ 151 path = instances[name] 144 152 old_cwd_ = os.getcwd() 145 153 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.meta149 #import grok.meta150 import grok151 #print "META: ", grok.meta152 import sys153 #print "PATHS: ", sys.path154 from zope.app.appsetup import database, config155 #config(config_file)156 #subprocess.call(157 # './bin/python-console -c "import grok.meta"', shell=True)158 154 script = os.path.join(os.path.dirname(__file__), 'scripts.py') 159 155 subprocess.call(
Note: See TracChangeset for help on using the changeset viewer.