1 |
af7609b5
|
Tomáš Ballák
|
from Utilities import configure_functions
|
2 |
d6ca840d
|
petrh
|
import pipeline
|
3 |
|
|
import os
|
4 |
af7609b5
|
Tomáš Ballák
|
import sys
|
5 |
d6ca840d
|
petrh
|
|
6 |
|
|
# Path to configuration files
|
7 |
|
|
CONFIG_FILES_PATH = "DatasetConfigs/"
|
8 |
af7609b5
|
Tomáš Ballák
|
WRONG_ARG_MSG = "Do argumentu funkce dejte jméno Datasetu, který chcete aktualizovat (pokud všechny zadejte 'ALL'):\n"
|
9 |
|
|
DATASET_NOT_FOUND_MSG = "Tento dataset v architektuře neexistuje"
|
10 |
d6ca840d
|
petrh
|
|
11 |
|
|
|
12 |
af7609b5
|
Tomáš Ballák
|
def run_pipeline_for_one_datasets(dataset_name: str) -> None:
|
13 |
d6ca840d
|
petrh
|
print("Probíhá update datasetu " + dataset_name)
|
14 |
|
|
pipeline.run_full_pipeline(dataset_name)
|
15 |
|
|
|
16 |
|
|
|
17 |
af7609b5
|
Tomáš Ballák
|
def run_pipeline_for_all_datasets() -> None:
|
18 |
d6ca840d
|
petrh
|
"""
|
19 |
|
|
Runs whole DataScript pipeline for every dataset that has existing configuration file
|
20 |
|
|
"""
|
21 |
|
|
files_in_dir = os.listdir(CONFIG_FILES_PATH)
|
22 |
|
|
|
23 |
|
|
for file in files_in_dir:
|
24 |
|
|
name = file.split('.')[0]
|
25 |
|
|
print("Probíhá update datasetu " + name)
|
26 |
|
|
pipeline.run_full_pipeline(name)
|
27 |
|
|
|
28 |
|
|
|
29 |
af7609b5
|
Tomáš Ballák
|
def main() -> None:
|
30 |
|
|
if len(sys.argv) > 1:
|
31 |
|
|
dataset_name = sys.argv[1].upper()
|
32 |
|
|
if dataset_name == "ALL":
|
33 |
|
|
run_pipeline_for_all_datasets()
|
34 |
|
|
else:
|
35 |
|
|
test = configure_functions.check_if_there_is_a_config_file(
|
36 |
|
|
dataset_name)
|
37 |
|
|
if test == True:
|
38 |
|
|
run_pipeline_for_one_datasets(dataset_name)
|
39 |
|
|
else:
|
40 |
|
|
print(DATASET_NOT_FOUND_MSG)
|
41 |
|
|
else:
|
42 |
|
|
print(WRONG_ARG_MSG)
|
43 |
d6ca840d
|
petrh
|
|
44 |
|
|
|
45 |
af7609b5
|
Tomáš Ballák
|
if __name__ == "__main__":
|
46 |
|
|
main()
|