-
Notifications
You must be signed in to change notification settings - Fork 0
/
re_scheduler.py
50 lines (39 loc) · 1.72 KB
/
re_scheduler.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
import argparse
import logging
from definitions.processable_entities import Publication, ReSummarise
from run_covid_r_batch import run
LOGGER = logging.getLogger("covid-r-batch")
PUBLISH = "p"
SUMMARISE = "s"
def main(args):
datasets_to_run = []
if args.type == PUBLISH:
ds = Publication(name=args.name)
if args.collated:
args.flags += "c"
elif args.type == SUMMARISE:
ds = ReSummarise(name=args.name)
else:
raise Exception("invalid type")
datasets_to_run.append(ds)
run(datasets_to_run, args)
def setup():
parser = argparse.ArgumentParser("Re_ Scheduler - for reprocessing sub parts of a run")
parser.add_argument("type", type=str,
help=f"Single character to denote thing to redo - {PUBLISH} = publish, "
f"{SUMMARISE} = summarise")
parser.add_argument("name", type=str, help="name for the dataset / collated derivative")
parser.add_argument("-c", "--collated", action="store_true",
help="bool If True will treat the name as a collated derivative rather "
"than a dataset - only applies for publishing")
parser.add_argument("--flags", type=str, default="w",
help="additional flags to pass to the run script. e.g. 'fs' = -f -s. "
"Default value is w")
parser.add_argument("--production", "-p", action="store_true",
help="Runs in production mode. Dataset will be published,"
"runtimes.csv and status.csv will be commited to the repo")
# process arguments
args = parser.parse_args()
return args
if __name__ == '__main__':
main(setup())