Skip to content

Commit

Permalink
need to change working assumptions about Data being generated
Browse files Browse the repository at this point in the history
  • Loading branch information
codersquid committed Mar 5, 2014
1 parent 3726c6e commit 156d0b5
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@


def run(demo):
timestamp = datetime.datetime.now().strftime('%Y%m%d-%H%M%S-%f')
results_file = join(abspath(curdir), 'Data', '%s_%s_results.txt' % (demo, timestamp))
#timestamp = datetime.datetime.now().strftime('%Y%m%d-%H%M%S-%f')
#results_file = join(abspath(curdir), 'Data', '%s_%s_results.txt' % (demo, timestamp))

results_file = join(abspath(curdir), 'Data', '%s_results.txt' % demo)
cmd = join(abspath(curdir), 'Demo', demo)
with open(results_file, 'w+') as fh:
subprocess.call(cmd, stdout=fh, stderr=subprocess.PIPE)
Expand All @@ -47,7 +49,7 @@ def setup():
subprocess.call(['make', 'lib', 'fortran'])


def cleanup():
def clean():
subprocess.call(['make', 'clean'])


Expand All @@ -64,23 +66,29 @@ def build_parser():
""")
parser.add_argument('-s', '--setup', action='store_true', help='compiles demos')
parser.add_argument('-c', '--cleanup', action='store_true', help='cleans compiled files')
parser.add_argument('-c', '--clean', action='store_true', help='cleans compiled files')
parser.add_argument('params', default='default.json', nargs='?',
help='json file with parameters: { "demos": %s' % CHOICES)
return parser


def main(paramsfile):
with open(args.params) as fh:
params = json.load(fh)
assert 'demos' in params, "missing 'demos' parameter."
for demo in params['demos']:
assert demo in CHOICES, "invalid demo, choose from %s" % CHOICES
result = run(demo)


if __name__ == "__main__":
parser = build_parser()
args = parser.parse_args()

if args.setup:
setup()

with open(args.params) as fh:
params = json.load(fh)
assert 'demos' in params, "missing 'demos' parameter."
main(args.params)

for demo in params['demos']:
assert demo in CHOICES, "invalid demo, choose from %s" % CHOICES
result = run(demo)
if args.clean:
clean()

0 comments on commit 156d0b5

Please sign in to comment.