-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrunner.py
55 lines (44 loc) · 1.6 KB
/
runner.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
import argparse
from typing import Tuple, cast
from lab_share_lib.config_readers import get_config
from crawler import main
from crawler.config.centres import get_centres_config
from crawler.constants import CENTRE_KEY_PREFIX
from crawler.types import Config
def centre_prefix_choices():
config, _ = cast(Tuple[Config, str], get_config(""))
centres = get_centres_config(config, "SFTP")
return [centre[CENTRE_KEY_PREFIX] for centre in centres]
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Parse CSV files from the Lighthouse Labs and store the sample information in MongoDB"
)
parser.add_argument(
"--sftp",
dest="sftp",
action="store_true",
help="use SFTP to download CSV files, defaults to using local files",
)
parser.add_argument(
"--keep-files",
dest="keep_files",
action="store_true",
help="keeps the CSV files after the runner has been executed",
)
parser.add_argument(
"--add-to-dart",
dest="add_to_dart",
action="store_true",
help="on processing samples, also add them to DART",
)
parser.add_argument(
"--centre-prefix",
dest="centre_prefix",
choices=centre_prefix_choices(),
help="process only this centre's plate map files",
)
parser.set_defaults(sftp=False)
parser.set_defaults(keep_files=False)
parser.set_defaults(add_to_dart=False)
args = parser.parse_args()
main.run(sftp=args.sftp, keep_files=args.keep_files, add_to_dart=args.add_to_dart, centre_prefix=args.centre_prefix)