-
Notifications
You must be signed in to change notification settings - Fork 6
/
launch.py
36 lines (26 loc) · 1.26 KB
/
launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import importlib
import pandas as pd
from aidb_utilities.command_line_setup.command_line_setup import command_line_utility
from aidb_utilities.aidb_setup.aidb_factory import AIDB
from aidb_utilities.db_setup.blob_table import BaseTablesSetup
from aidb_utilities.db_setup.create_tables import create_output_tables
from aidb.utils.asyncio import asyncio_run
def setup_blob_tables(config):
input_blobs = pd.read_csv(config.blobs_csv_file)
base_table_setup = BaseTablesSetup(f"{config.DB_URL}/{config.DB_NAME}")
base_table_setup.insert_blob_meta_data(config.blob_table_name, input_blobs, config.blobs_keys_columns)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--config", type=str)
parser.add_argument("--setup-blob-table", action='store_true')
parser.add_argument("--setup-output-tables", action='store_true')
parser.add_argument("--verbose", action='store_true')
args = parser.parse_args()
config = importlib.import_module(args.config)
if args.setup_blob_table:
setup_blob_tables(config)
if args.setup_output_tables:
asyncio_run(create_output_tables(config.DB_URL, config.DB_NAME, config.tables))
aidb_engine = AIDB.from_config(args.config, args.verbose)
command_line_utility(aidb_engine)