-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun_algorithm.py
More file actions
54 lines (52 loc) · 1.69 KB
/
run_algorithm.py
File metadata and controls
54 lines (52 loc) · 1.69 KB
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
from src.algorithms.run import run_algo_locally, run_algo_docker, run_pipeline_locally
import argparse
if __name__ == "__main__":
#Set up argument parser
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'--algorithm',
help='Algorithm name',
required=True
)
parser.add_argument(
'--algorithm_params',
help='Algorithm configuration parameters',
required=False
)
parser.add_argument(
'--dataset',
help='Dataset name',
required=True
)
parser.add_argument(
'--pipeline',
help='flag for execute function in pipeline mode',
action="store_true"
)
parser.add_argument(
'--pipeline-step',
help='flag for execute function i pipiple divided by step',
action="store_true"
)
parser.add_argument(
'--locally',
help='Runs the algorithm locally instead of on docker',
action="store_true"
)
parser.add_argument(
'--mem-limit',
help='Memory limit for docker container (default maximum available memory)',
default=None
)
parser.add_argument(
'--cpu-limit',
help='CPU limit for docker container (number of CPUs)',
default=1,
type=int
)
args = parser.parse_args()
#If locally is set to true the algorithm will run locally
if args.locally:
run_pipeline_locally(args.algorithm, args.dataset, args.cpu_limit, args.mem_limit, args.algorithm_params, args.pipeline, args.pipeline_step)
else:
run_algo_docker(args.algorithm, args.dataset, args.cpu_limit, args.mem_limit, args.pipeline)