starting a fresh tidy

This commit is contained in:
2026-07-26 10:34:18 +01:00
parent 5af82e5753
commit 33cbc5c6ed
14 changed files with 985 additions and 186 deletions
+13 -11
View File
@@ -1,15 +1,17 @@
import os
import dotenv
import logging
import yaml
import sys
import atexit
import logging
import logging.config
import logging.handlers
import os
import sys
import dotenv
import yaml
import config.exit_codes as ec
from pipeline.pipeline_main import pipeline_main
def set_up_logging():
try:
with open('config/logging_config.yaml', 'r') as f:
@@ -47,7 +49,7 @@ API_TOKEN = os.getenv('API_TOKEN')
BUDGET_ID = os.getenv('BUDGET_ID')
if not API_TOKEN or not BUDGET_ID:
logging.error('API_TOKEN or BUDGET_ID is not set in .env file')
logger.error('API_TOKEN or BUDGET_ID is not set in .env file')
sys.exit(ec.MISSING_ENV_VARS)
if __name__ == '__main__':
@@ -55,20 +57,20 @@ if __name__ == '__main__':
config['API_TOKEN'] = API_TOKEN
config['BUDGET_ID'] = BUDGET_ID
try:
pipeline_main(config)
pipeline_main(config, logger)
# Check if the data was successfully created
data_exists = os.path.exists('data/processed') and os.listdir('data/processed')
if data_exists:
from dash_app import app
app.run() # debug=True
else:
logging.error('Data pipeline did not produce any data. Dash app will not run.')
logger.error('Data pipeline did not produce any data. Dash app will not run.')
sys.exit(ec.NO_DATA_PRODUCED)
except SystemExit as e:
exit_code = e.code
if exit_code == ec.SUCCESS:
logging.info('Program exited successfully')
logger.info('Program exited successfully')
else:
logging.error(f'Program exited with code {exit_code}')
logger.error(f'Program exited with code {exit_code}')
raise