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):
|
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
|
print("Zadejte jméno Datasetu který chcete odstranit:\n")
|
40
|
|
41
|
dataset_name = input().upper()
|
42
|
test = configure_functions.check_if_there_is_a_config_file(dataset_name)
|
43
|
|
44
|
if test == True:
|
45
|
remove_dataset(dataset_name)
|
46
|
else:
|
47
|
print("Tento dataset v architektuře neexistuje")
|
48
|
|
49
|
|