Changeset 8749 for main/waeup.stress/trunk/src/waeup/stress
- Timestamp:
- 18 Jun 2012, 10:14:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.stress/trunk/src/waeup/stress/run.py
r8674 r8749 5 5 from optparse import OptionParser 6 6 from ConfigParser import SafeConfigParser 7 8 VALID_MODES = ('paster', 'kofactl', 'zeo', 'profile') 7 9 8 10 def configure_options(): … … 55 57 print name, value 56 58 params.update(dict({name: value})) 57 if params['instance_mode'] not in ('paster', 'kofactl', 'zeo'):59 if params['instance_mode'] not in VALID_MODES: 58 60 print "Warning: invalid instance_mode in config.cfg, picking 'paster'." 61 print " valid would be: %s" % VALID_MODES 59 62 params['instance_mode'] = 'paster' 60 63 params['start_instance'] = config.getboolean( … … 62 65 return params 63 66 64 def main(): 65 # late import as this scripts mangles sys.argv 66 from multimechanize.utilities import run 67 def configure(): 67 68 cmd_opts, args = configure_options() 68 69 project_name = args[0] 69 70 path = os.path.abspath(os.path.join(cmd_opts.projects_dir, project_name)) 70 71 cfg_opts = configure_project(project_name, path) 72 return path, project_name, cmd_opts, cfg_opts 73 74 def main(): 75 path, project_name, cmd_opts, cfg_opts = configure() 71 76 pre_run_path = os.path.join(path, 'pre_run.py') 72 77 post_run_path = os.path.join(path, 'post_run.py') 78 sys.path.append(path) # make project scripts available for import 73 79 if os.path.exists(pre_run_path): 74 80 print "WAEUP.STRESS.RUN: running pre_run %s" % pre_run_path 75 81 execfile(pre_run_path) 82 # late import as this scripts mangles sys.argv 83 from multimechanize.utilities import run 76 84 run.main() 77 85 if os.path.exists(post_run_path):
Note: See TracChangeset for help on using the changeset viewer.