diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 15:12:22 -0400 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 15:12:22 -0400 |
| commit | 7eb34b5312974f601d1117eeaf6393b9648be31c (patch) | |
| tree | 838df63d06886bd3bbec560add8a1ac4ef4dd069 /parse | |
| parent | 09bc409657606a37346d82ab1e4c44a165bd3541 (diff) | |
Improved error handling in parse_ and plot_exps.py.
Diffstat (limited to 'parse')
| -rw-r--r-- | parse/dir_map.py | 5 | ||||
| -rw-r--r-- | parse/ft.py | 1 | ||||
| -rw-r--r-- | parse/point.py | 4 | ||||
| -rw-r--r-- | parse/sched.py | 6 | ||||
| -rw-r--r-- | parse/tuple_table.py | 5 |
5 files changed, 12 insertions, 9 deletions
diff --git a/parse/dir_map.py b/parse/dir_map.py index a8d2a83..231d21a 100644 --- a/parse/dir_map.py +++ b/parse/dir_map.py | |||
| @@ -96,7 +96,10 @@ class DirMap(object): | |||
| 96 | return | 96 | return |
| 97 | 97 | ||
| 98 | with open(path, 'rb') as f: | 98 | with open(path, 'rb') as f: |
| 99 | data = np.loadtxt(f, delimiter=",") | 99 | try: |
| 100 | data = np.loadtxt(f, delimiter=",") | ||
| 101 | except Exception as e: | ||
| 102 | raise IOError("Cannot load '%s': %s" % (path, e.message)) | ||
| 100 | 103 | ||
| 101 | # Convert to tuples of ints if possible, else floats | 104 | # Convert to tuples of ints if possible, else floats |
| 102 | values = [map(lambda a:a if a%1 else int(a), t) for t in data] | 105 | values = [map(lambda a:a if a%1 else int(a), t) for t in data] |
diff --git a/parse/ft.py b/parse/ft.py index 98405f4..1f05323 100644 --- a/parse/ft.py +++ b/parse/ft.py | |||
| @@ -71,7 +71,6 @@ def extract_ft_data(result, data_dir, work_dir, cycles): | |||
| 71 | 71 | ||
| 72 | bin_file = "{}/{}".format(data_dir, bins[0]) | 72 | bin_file = "{}/{}".format(data_dir, bins[0]) |
| 73 | if not os.path.getsize(bin_file): | 73 | if not os.path.getsize(bin_file): |
| 74 | sys.stderr.write("Empty feather trace file %s!" % bin_file) | ||
| 75 | return False | 74 | return False |
| 76 | 75 | ||
| 77 | with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file: | 76 | with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file: |
diff --git a/parse/point.py b/parse/point.py index f2b266a..ac47c70 100644 --- a/parse/point.py +++ b/parse/point.py | |||
| @@ -8,8 +8,8 @@ from enum import Enum | |||
| 8 | from collections import defaultdict | 8 | from collections import defaultdict |
| 9 | 9 | ||
| 10 | Type = Enum(['Min','Max','Avg','Var']) | 10 | Type = Enum(['Min','Max','Avg','Var']) |
| 11 | default_typemap = {Type.Max : {Type.Max : 1, Type.Min : 1, Type.Avg : 1, Type.Var : 1}, | 11 | default_typemap = {Type.Max : {Type.Max : 1, Type.Min : 0, Type.Avg : 0, Type.Var : 0}, |
| 12 | Type.Min : {Type.Max : 1, Type.Min : 1, Type.Avg : 1, Type.Var : 1}, | 12 | Type.Min : {Type.Max : 0, Type.Min : 1, Type.Avg : 0, Type.Var : 0}, |
| 13 | Type.Avg : {Type.Max : 1, Type.Min : 1, Type.Avg : 1, Type.Var : 1}} | 13 | Type.Avg : {Type.Max : 1, Type.Min : 1, Type.Avg : 1, Type.Var : 1}} |
| 14 | 14 | ||
| 15 | def make_typemap(): | 15 | def make_typemap(): |
diff --git a/parse/sched.py b/parse/sched.py index 147a2e5..1213f0d 100644 --- a/parse/sched.py +++ b/parse/sched.py | |||
| @@ -68,7 +68,7 @@ def make_iterator(fname): | |||
| 68 | '''Iterate over (parsed record, processing method) in a | 68 | '''Iterate over (parsed record, processing method) in a |
| 69 | sched-trace file.''' | 69 | sched-trace file.''' |
| 70 | if not os.path.getsize(fname): | 70 | if not os.path.getsize(fname): |
| 71 | sys.stderr.write("Empty sched_trace file %s!" % fname) | 71 | # Likely a release master CPU |
| 72 | return | 72 | return |
| 73 | 73 | ||
| 74 | f = open(fname, 'rb') | 74 | f = open(fname, 'rb') |
| @@ -176,6 +176,10 @@ def extract_sched_data(result, data_dir, work_dir): | |||
| 176 | 176 | ||
| 177 | # Group per-task values | 177 | # Group per-task values |
| 178 | for tdata in task_dict.itervalues(): | 178 | for tdata in task_dict.itervalues(): |
| 179 | if not tdata.params: | ||
| 180 | # Currently unknown where these invalid tasks come from... | ||
| 181 | continue | ||
| 182 | |||
| 179 | miss_ratio = float(tdata.misses.num) / tdata.jobs | 183 | miss_ratio = float(tdata.misses.num) / tdata.jobs |
| 180 | # Scale average down to account for jobs with 0 tardiness | 184 | # Scale average down to account for jobs with 0 tardiness |
| 181 | avg_tard = tdata.misses.avg * miss_ratio | 185 | avg_tard = tdata.misses.avg * miss_ratio |
diff --git a/parse/tuple_table.py b/parse/tuple_table.py index 491ea7b..47fb6b6 100644 --- a/parse/tuple_table.py +++ b/parse/tuple_table.py | |||
| @@ -78,7 +78,7 @@ class ReducedTupleTable(TupleTable): | |||
| 78 | val = kv[col] | 78 | val = kv[col] |
| 79 | 79 | ||
| 80 | try: | 80 | try: |
| 81 | float(val) | 81 | float(str(val)) |
| 82 | except: | 82 | except: |
| 83 | # Only vary numbers. Otherwise, just have seperate files | 83 | # Only vary numbers. Otherwise, just have seperate files |
| 84 | continue | 84 | continue |
| @@ -93,9 +93,6 @@ class ReducedTupleTable(TupleTable): | |||
| 93 | Leaf = namedtuple('Leaf', ['stat', 'variable', 'base', | 93 | Leaf = namedtuple('Leaf', ['stat', 'variable', 'base', |
| 94 | 'summary', 'config', 'values']) | 94 | 'summary', 'config', 'values']) |
| 95 | 95 | ||
| 96 | def next_type(path): | ||
| 97 | return path.pop() if path[-1] in Type else Type.Avg | ||
| 98 | |||
| 99 | def leafs(): | 96 | def leafs(): |
| 100 | for path, node in dir_map.leafs(): | 97 | for path, node in dir_map.leafs(): |
| 101 | # The path will be of at least size 1: the filename | 98 | # The path will be of at least size 1: the filename |
