aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-10-19 02:58:19 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-10-19 02:58:19 -0400
commit6d830d55ccae53dca6f0338dfee1274312c93161 (patch)
tree9bef529065ed8f0c5446606279e8d6928bcbdf9d
parentd66aa52d719cf7edad8cac20b711e4c16d2899de (diff)
Better error handling.
-rw-r--r--experiment/executable/executable.py3
-rw-r--r--experiment/experiment.py4
-rwxr-xr-xrun_exps.py10
3 files changed, 11 insertions, 6 deletions
diff --git a/experiment/executable/executable.py b/experiment/executable/executable.py
index 09b7370..b964699 100644
--- a/experiment/executable/executable.py
+++ b/experiment/executable/executable.py
@@ -72,3 +72,6 @@ class Executable(object):
72 self.sp.wait() 72 self.sp.wait()
73 if self.sp.returncode != 0: 73 if self.sp.returncode != 0:
74 print >>sys.stderr, "Non-zero return: %s %s" % (self.exec_file, " ".join(self.extra_args)) 74 print >>sys.stderr, "Non-zero return: %s %s" % (self.exec_file, " ".join(self.extra_args))
75 return 0
76 else:
77 return 1
diff --git a/experiment/experiment.py b/experiment/experiment.py
index f0c201d..8c88799 100644
--- a/experiment/experiment.py
+++ b/experiment/experiment.py
@@ -136,7 +136,9 @@ class Experiment(object):
136 ret = False 136 ret = False
137 137
138 self.log("Waiting for program to finish...") 138 self.log("Waiting for program to finish...")
139 map(methodcaller('wait'), self.executables) 139 for e in self.executables:
140 if not e.wait():
141 ret = False
140 142
141 # And it must be stopped here for the same reason 143 # And it must be stopped here for the same reason
142 if self.overhead_trace: 144 if self.overhead_trace:
diff --git a/run_exps.py b/run_exps.py
index 19dbad1..8812bc6 100755
--- a/run_exps.py
+++ b/run_exps.py
@@ -26,7 +26,7 @@ def parse_args():
26 parser.add_option('-d', '--duration', dest='duration', type='int', 26 parser.add_option('-d', '--duration', dest='duration', type='int',
27 help='duration (seconds) of tasks') 27 help='duration (seconds) of tasks')
28 parser.add_option('-o', '--out-dir', dest='out_dir', 28 parser.add_option('-o', '--out-dir', dest='out_dir',
29 help='directory for data output', default="run-data") 29 help='directory for data output', default=("%s/run-data"%os.getcwd()))
30 parser.add_option('-p', '--params', dest='param_file', 30 parser.add_option('-p', '--params', dest='param_file',
31 help='file with experiment parameters') 31 help='file with experiment parameters')
32 parser.add_option('-c', '--schedule-file', dest='sched_file', 32 parser.add_option('-c', '--schedule-file', dest='sched_file',
@@ -47,7 +47,7 @@ def convert_data(data):
47 r"\s*{\s*(?P<CONTENT>.*?)\s*?}$)|" 47 r"\s*{\s*(?P<CONTENT>.*?)\s*?}$)|"
48 r"(?P<SPIN>^" 48 r"(?P<SPIN>^"
49 r"(?P<TYPE>\w+?spin)?\s*" 49 r"(?P<TYPE>\w+?spin)?\s*"
50 r"(?P<ARGS>[\w\-_\d\. ]+)\s*$)", 50 r"(?P<ARGS>[\w\-_\d\. \=]+)\s*$)",
51 re.S|re.I|re.M) 51 re.S|re.I|re.M)
52 52
53 procs = [] 53 procs = []
@@ -134,8 +134,8 @@ def run_exp(name, schedule, scheduler, kernel, duration, work_dir, out_dir):
134 proc_entries = [] 134 proc_entries = []
135 executables = [] 135 executables = []
136 136
137 if kernel and not lu.uname_matches(kernel): 137 # if kernel and not lu.uname_matches(kernel):
138 raise InvalidKernel(kernel) 138 # raise InvalidKernel(kernel)
139 139
140 # Parse values for proc entries 140 # Parse values for proc entries
141 for entry_conf in schedule['proc']: 141 for entry_conf in schedule['proc']:
@@ -196,7 +196,7 @@ def main():
196 196
197 for exp in args: 197 for exp in args:
198 path = "%s/%s" % (os.getcwd(), exp) 198 path = "%s/%s" % (os.getcwd(), exp)
199 out_dir = "%s/%s" % (out_base, exp) 199 out_dir = "%s/%s" % (out_base, os.path.split(exp.strip('/'))[1])
200 200
201 if not os.path.exists(path): 201 if not os.path.exists(path):
202 raise IOError("Invalid experiment: %s" % path) 202 raise IOError("Invalid experiment: %s" % path)