diff options
| -rwxr-xr-x | assemble_files.py | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/assemble_files.py b/assemble_files.py index f4be48f..75c6c07 100755 --- a/assemble_files.py +++ b/assemble_files.py | |||
| @@ -8,6 +8,22 @@ from os.path import splitext, basename | |||
| 8 | from glob import glob | 8 | from glob import glob |
| 9 | from collections import defaultdict | 9 | from collections import defaultdict |
| 10 | 10 | ||
| 11 | import optparse | ||
| 12 | |||
| 13 | o = optparse.make_option | ||
| 14 | |||
| 15 | opts = [ | ||
| 16 | o('-s', '--split', action='store_true', dest='split_files', | ||
| 17 | help='split out files into individual per-wss files'), | ||
| 18 | ] | ||
| 19 | |||
| 20 | |||
| 21 | defaults = { | ||
| 22 | 'split_files' : False, | ||
| 23 | } | ||
| 24 | |||
| 25 | options = None | ||
| 26 | |||
| 11 | #G-EDF/testpoint_ucap=13.75_wss=1792_dist=exp-10-10-100_deadlines=implicit_host=ludwig_scheduler=G-EDF.csv | 27 | #G-EDF/testpoint_ucap=13.75_wss=1792_dist=exp-10-10-100_deadlines=implicit_host=ludwig_scheduler=G-EDF.csv |
| 12 | 28 | ||
| 13 | def key(fname): | 29 | def key(fname): |
| @@ -22,7 +38,12 @@ def key(fname): | |||
| 22 | dl = 'deadlines=%s' % conf['deadlines'] | 38 | dl = 'deadlines=%s' % conf['deadlines'] |
| 23 | h = 'host=%s' % conf['host'] | 39 | h = 'host=%s' % conf['host'] |
| 24 | 40 | ||
| 25 | return '_'.join([d, dl, s, h]) + q | 41 | if options.split_files: |
| 42 | w = '_wss=%s' % conf['wss'] | ||
| 43 | else: | ||
| 44 | w = '' | ||
| 45 | |||
| 46 | return '_'.join([d, dl, s, h]) + q + w | ||
| 26 | 47 | ||
| 27 | def assemble_results(dir): | 48 | def assemble_results(dir): |
| 28 | files = glob(dir + '/*.csv') | 49 | files = glob(dir + '/*.csv') |
| @@ -33,10 +54,15 @@ def assemble_results(dir): | |||
| 33 | k = key(f) | 54 | k = key(f) |
| 34 | parts[k].append(f) | 55 | parts[k].append(f) |
| 35 | 56 | ||
| 57 | if options.split_files: | ||
| 58 | nametag = 'dwss' | ||
| 59 | else: | ||
| 60 | nametag = 'dall' | ||
| 61 | |||
| 36 | for i, k in enumerate(parts): | 62 | for i, k in enumerate(parts): |
| 37 | comment = 1 | 63 | comment = 1 |
| 38 | print '[%d/%d] Processing %s' % (i+ 1, len(parts), k) | 64 | print '[%d/%d] Processing %s' % (i+ 1, len(parts), k) |
| 39 | out = open('sched_%s.csv' % k, 'w') | 65 | out = open('%s_%s.csv' % (nametag, k), 'w') |
| 40 | for f in sorted(parts[k]): | 66 | for f in sorted(parts[k]): |
| 41 | for line in open(f): | 67 | for line in open(f): |
| 42 | if line[0] != '#' or comment: | 68 | if line[0] != '#' or comment: |
| @@ -48,6 +74,10 @@ def assemble_results(dir): | |||
| 48 | 74 | ||
| 49 | 75 | ||
| 50 | if __name__ == '__main__': | 76 | if __name__ == '__main__': |
| 51 | for d in sys.argv[1:]: | 77 | parser = optparse.OptionParser(option_list=opts) |
| 78 | parser.set_defaults(**defaults) | ||
| 79 | (options, dirs) = parser.parse_args() | ||
| 80 | |||
| 81 | for d in dirs: | ||
| 52 | assemble_results(d) | 82 | assemble_results(d) |
| 53 | 83 | ||
