diff --git a/run.py b/run.py new file mode 100755 index 0000000..436a722 --- /dev/null +++ b/run.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +import sys +import os +import argparse +import shutil +import subprocess + +def get_exp_cnt(path): + try: + return len([name for name in os.listdir(path) if os.path.isfile(path + '/' + name)]) + except Exception: + return 0 + +def main(): + parser = argparse.ArgumentParser('Run all the scripts so everything works fine.') + parser.add_argument('experiments', type=int, nargs='?', default=1, + help='The number of experiments to be run.') + + args = parser.parse_args() + cwd = os.getcwd() + + try: + shutil.rmtree('./experiment_data') + except FileNotFoundError: + pass + os.makedirs('./experiment_data') + + cnt = 0 + remain = args.experiments + while remain > 0: + subprocess.call(['./tasksetgen.py', '--microseconds', '--uniform', '5', + str(remain), 'experiments/ese2016_{}'.format(cnt), + 'experiment_data']) + for experiment in os.listdir('experiments/ese2016_{}'.format(cnt)): + subprocess.call(['./generate.py', + 'experiments/ese2016_{}'.format(cnt) + '/' + experiment]) + shutil.copyfile('Makefile', './experiment_data/Makefile') + subprocess.call(['./runner.py', './experiment_data']) + + os.makedirs('./experiment_data/{}'.format(cnt)) + for experiment in os.listdir('./experiment_data'): + if experiment.isdigit() or experiment == 'results' or experiment == 'Makefile': + continue + try: + shutil.move('./experiment_data/' + experiment, './experiment_data/' + str(cnt)) + except Exception: + pass + + cnt += 1 + remain = args.experiments - get_exp_cnt('./experiment_data/results') + print('remain:', remain, 'experiments: ', args.experiments, get_exp_cnt('./experiment_data/results')) + +if __name__ == '__main__': + main() diff --git a/run.sh b/run.sh deleted file mode 100755 index 8701ddf..0000000 --- a/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#/bin/bash - -rm -fr experiment_data && mkdir experiment_data -./tasksetgen.py --microseconds --uniform 5 333 experiments/ese2016 experiment_data -./generate.py experiments/ese2016/* -cp Makefile experiment_data -./runner.py experiment_data