Commit 45b8c468 by Tobias Langer

Better rewritten in python.

parent 9cdff37a
#!/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()
#/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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment