aboutsummaryrefslogtreecommitdiffstats
path: root/run_exps.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_exps.py')
-rwxr-xr-xrun_exps.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/run_exps.py b/run_exps.py
index 825ad5b..8f72adb 100755
--- a/run_exps.py
+++ b/run_exps.py
@@ -1,5 +1,9 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2from __future__ import print_function 2from __future__ import print_function
3"""
4TODO: no -f flag, instead allow individual schedules to be passed in.
5 -f flag now forced, which removes old data directories
6"""
3 7
4import config.config as conf 8import config.config as conf
5import experiment.litmus_util as lu 9import experiment.litmus_util as lu
@@ -39,11 +43,11 @@ def convert_data(data):
39 """Convert a non-python schedule file into the python format""" 43 """Convert a non-python schedule file into the python format"""
40 regex = re.compile( 44 regex = re.compile(
41 r"(?P<PROC>^" 45 r"(?P<PROC>^"
42 r"(?P<HEADER>/proc/\w+?/)?" 46 r"(?P<HEADER>/proc/[\w\-]+?/)?"
43 r"(?P<ENTRY>[\w\/]+)" 47 r"(?P<ENTRY>[\w\-\/]+)"
44 r"\s*{\s*(?P<CONTENT>.*?)\s*?}$)|" 48 r"\s*{\s*(?P<CONTENT>.*?)\s*?}$)|"
45 r"(?P<SPIN>^" 49 r"(?P<SPIN>^"
46 r"(?P<TYPE>\w+?spin)?\s+" 50 r"(?P<TYPE>\w+?spin)?\s*"
47 r"(?P<ARGS>[\w\-_\d\. ]+)\s*$)", 51 r"(?P<ARGS>[\w\-_\d\. ]+)\s*$)",
48 re.S|re.I|re.M) 52 re.S|re.I|re.M)
49 53
@@ -70,6 +74,7 @@ def fix_paths(schedule, exp_dir):
70 abspath = "%s/%s" % (exp_dir, arg) 74 abspath = "%s/%s" % (exp_dir, arg)
71 if os.path.exists(abspath): 75 if os.path.exists(abspath):
72 args = args.replace(arg, abspath) 76 args = args.replace(arg, abspath)
77 break
73 78
74 schedule['spin'][idx] = (spin, args) 79 schedule['spin'][idx] = (spin, args)
75 80
@@ -96,7 +101,7 @@ def load_experiment(sched_file, scheduler, duration, param_file, out_base):
96 101
97 params = {} 102 params = {}
98 kernel = "" 103 kernel = ""
99 104
100 param_file = param_file or \ 105 param_file = param_file or \
101 "%s/%s" % (dirname, conf.DEFAULTS['params_file']) 106 "%s/%s" % (dirname, conf.DEFAULTS['params_file'])
102 107
@@ -181,7 +186,6 @@ def run_exp(name, schedule, scheduler, kernel, duration, work_dir, out_dir):
181 proc_entries, executables) 186 proc_entries, executables)
182 187
183 exp.run_exp() 188 exp.run_exp()
184
185 189
186def main(): 190def main():
187 opts, args = parse_args() 191 opts, args = parse_args()
@@ -193,14 +197,16 @@ def main():
193 197
194 args = args or [opts.sched_file] 198 args = args or [opts.sched_file]
195 199
200 created = False
196 if not os.path.exists(out_base): 201 if not os.path.exists(out_base):
202 created = True
197 os.mkdir(out_base) 203 os.mkdir(out_base)
198 204
199 done = 0 205 done = 0
200 succ = 0 206 succ = 0
201 failed = 0 207 failed = 0
202 invalid = 0 208 invalid = 0
203 209
204 for exp in args: 210 for exp in args:
205 path = "%s/%s" % (os.getcwd(), exp) 211 path = "%s/%s" % (os.getcwd(), exp)
206 212
@@ -223,7 +229,9 @@ def main():
223 traceback.print_exc() 229 traceback.print_exc()
224 failed += 1 230 failed += 1
225 231
226 232 if not os.listdir(out_base) and created and not succ:
233 os.rmdir(out_base)
234
227 print("Experiments run:\t%d" % len(args)) 235 print("Experiments run:\t%d" % len(args))
228 print(" Successful:\t\t%d" % succ) 236 print(" Successful:\t\t%d" % succ)
229 print(" Failed:\t\t%d" % failed) 237 print(" Failed:\t\t%d" % failed)