-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiments.py
68 lines (50 loc) · 1.86 KB
/
experiments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/python3
import argparse
import const
from results_structure import checkFiles
from quality import exportQualityResult
from performance import exportPerformanceResult
experiments = {
'quality': True,
'performance': True
}
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output-dir', type=str, required=True)
parser.add_argument('-n', '--services', nargs=1, help='set the number of services for the experiments')
parser.add_argument('-d', '--servicedata', nargs=1, help='set the number of service data for the experiments')
parser.add_argument('-s', '--skip', nargs='*', help='skip experiments',
choices=['quality', 'performance'], )
args = parser.parse_args()
destDir = args.output_dir
if args.services is not None:
if ',' in args.services[0]:
const.SERVICES_NUM = []
for s in args.services[0].split(','):
const.SERVICES_NUM.append(int(s))
else:
const.SERVICES_NUM = [int(args.services[0])]
if args.servicedata is not None:
if ',' in args.servicedata[0]:
const.SDS_NUM = []
for s in args.servicedata[0].split(','):
const.SDS_NUM.append(int(s))
else:
const.SDS_NUM = [int(args.servicedata[0])]
if args.skip is not None:
for e in args.skip:
if e in experiments.keys():
experiments[e] = False
if checkFiles(destDir):
choice = input(
f'Will be generated: {len(const.getSettings()) * len(const.SERVICES_NUM) * len(const.SDS_NUM) * const.EXECUTION} datasets, continue? (y/n): ')
if choice != 'y':
print('Exit.')
quit(1)
print('Running quality experiments... ', end='')
exportQualityResult(experiments['quality'], destDir)
print('ok.\nRunning performance experiments... ', end='')
if experiments['performance']:
exportPerformanceResult(destDir)
print('ok.')
else:
quit(1)