Projekt

Obecné

Profil

Stáhnout (1.39 KB) Statistiky
| Větev: | Revize:
1
from Utilities import configure_functions
2
import pipeline
3
import os
4
import sys
5

    
6
# Path to configuration files
7
CONFIG_FILES_PATH = "DatasetConfigs/"
8
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

    
11

    
12
def run_pipeline_for_one_datasets(dataset_name: str) -> None:
13
    print("Probíhá update datasetu " + dataset_name)
14
    pipeline.run_full_pipeline(dataset_name)
15

    
16

    
17
def run_pipeline_for_all_datasets() -> None:
18
    """
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
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

    
44

    
45
if __name__ == "__main__":
46
    main()
(5-5/13)