-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (23 loc) · 994 Bytes
/
main.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
# TODO: Build Services that Trigger Data Factory and ETL process
# TODO: Build Services that Trigger Stored Proceduers
import logging
import subprocess
import os
logging.basicConfig(filename='logs/main.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# Trigger APIs
current_directory = os.path.dirname(os.path.abspath(__file__))
api_trigger = os.path.join(current_directory, 'extraction_scripts/api_extraction.py')
db_trigger = os.path.join(current_directory, 'data_factory/data_factory.py')
try:
print('Starting program.')
try:
subprocess.run(['python', api_trigger])
except Exception as e:
logging.error(f'One or more subprocesses failed: {e}')
try:
subprocess.run(['python', db_trigger])
except Exception as e:
logging.error(f"One or more subprocesses failed: {e}")
print('Program complete. Check logs for details.')
except Exception as e:
print('Program failed. Check logs for details. {e}.')