Projekt

Obecné

Profil

« Předchozí | Další » 

Revize af7609b5

Přidáno uživatelem Tomáš Ballák před více než 3 roky(ů)

Re #8193 - refactoring crawler

Zobrazit rozdíly:

modules/crawler/force_update_datasets.py
1
from Utilities import configure_functions
1 2
import pipeline
2 3
import os
3
from Utilities import configure_functions
4
import sys
4 5

  
5 6
# Path to configuration files
6 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"
7 10

  
8 11

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

  
13 16

  
14
def run_pipeline_for_all_datasets():
17
def run_pipeline_for_all_datasets() -> None:
15 18
    """
16 19
    Runs whole DataScript pipeline for every dataset that has existing configuration file
17 20
    """
......
23 26
        pipeline.run_full_pipeline(name)
24 27

  
25 28

  
26
print("Zadejte jméno Datasetu který chcete updatovat (pokud všechny zadejte '-ALL'):\n")
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)
27 43

  
28
dataset_name = input().upper()
29 44

  
30
if dataset_name == '-ALL':
31
    run_pipeline_for_all_datasets()
32
else:
33
    test = configure_functions.check_if_there_is_a_config_file(dataset_name)
34
    if test == True:
35
        run_pipeline_for_one_datasets(dataset_name)
36
    else:
37
        print("Tento dataset v architektuře neexistuje")
45
if __name__ == "__main__":
46
    main()

Také k dispozici: Unified diff