Projekt

Obecné

Profil

Stáhnout (1.61 KB) Statistiky
| Větev: | Revize:
1
import os
2
import shutil
3
from Utilities.Database import database_loader
4
from Utilities import configure_functions
5

    
6
# Path to crawled data
7
CRAWLED_DATA_PATH = "CrawledData/"
8
# Path to processed data
9
PROCESSED_DATA_PATH = "ProcessedData/"
10
# Path to crawler logs
11
CRAWLER_LOGS_PATH = "CrawlerLogs/"
12
# Path to dataset configuration files
13
CONFIG_FILES_PATH = "DatasetConfigs"
14
# Path for DatasetCrawlers implementations
15
CRAWLER_PROGRAM_PATH = "DatasetCrawler"
16
# Path for DatasetProcessors implementations
17
PROCESSOR_PROGRAM_PATH = "DatasetProcessing"
18

    
19

    
20
def remove_dataset(dataset_name: str) -> None:
21
    """
22
    Remove dataset
23
    Args:
24
        dataset_name: name of dataset that has existing configuration file
25
    """
26
    shutil.rmtree(CRAWLED_DATA_PATH + dataset_name + "/")
27
    shutil.rmtree(PROCESSED_DATA_PATH + dataset_name + "/")
28

    
29
    os.remove(CRAWLER_PROGRAM_PATH + "/" + dataset_name + "_crawler.py")
30
    os.remove(PROCESSOR_PROGRAM_PATH + "/" + dataset_name + "_processor.py")
31
    os.remove(CONFIG_FILES_PATH + "/" + dataset_name + ".yaml")
32

    
33
    print("Dataset " + dataset_name + " odebrán z architektury")
34

    
35
    database_loader.remove_dataset_database(dataset_name)
36

    
37
    print("Dataset " + dataset_name + " odebrán z databáze")
38

    
39

    
40
def main() -> None:
41
    print("Zadejte jméno Datasetu který chcete odstranit:\n")
42
    dataset_name = input().upper()
43
    test = configure_functions.check_if_there_is_a_config_file(dataset_name)
44

    
45
    if test == True:
46
        remove_dataset(dataset_name)
47
    else:
48
        print("Tento dataset v architektuře neexistuje")
49

    
50

    
51
if __name__ == "__main__":
52
    main()
(10-10/13)