From 96e3be79e5708834bac6e2288ebba67afabca1f9 Mon Sep 17 00:00:00 2001 From: David Betancur Date: Tue, 7 Feb 2023 12:08:31 -0500 Subject: [PATCH] adding small enhancement for handling exceptions on HttpHook adding env variables requirement for future use --- src/ingest-pipeline/airflow/dags/trigger_file_reindex.py | 5 +++++ src/ingest-pipeline/airflow/plugins/hubmap_api/endpoint.py | 1 + src/ingest-pipeline/misc/tools/airflow_wrapper.sh | 1 + 3 files changed, 7 insertions(+) diff --git a/src/ingest-pipeline/airflow/dags/trigger_file_reindex.py b/src/ingest-pipeline/airflow/dags/trigger_file_reindex.py index 05d12737..ef49fbb1 100644 --- a/src/ingest-pipeline/airflow/dags/trigger_file_reindex.py +++ b/src/ingest-pipeline/airflow/dags/trigger_file_reindex.py @@ -7,6 +7,7 @@ from airflow.operators.python import PythonOperator from airflow.providers.http.hooks.http import HttpHook from airflow.configuration import conf as airflow_conf +from airflow.exceptions import AirflowException import utils from utils import ( @@ -60,6 +61,10 @@ def launch_file_reindex(**kwargs): response.raise_for_status() except http.client.HTTPException as he: print(f'Error {he}') + except AirflowException as ae: + print(f'Error {ae}') + except Exception as e: + print(f'Broad Exception {e}') t_launch_file_reindex = PythonOperator( task_id='launch_file_reindex', diff --git a/src/ingest-pipeline/airflow/plugins/hubmap_api/endpoint.py b/src/ingest-pipeline/airflow/plugins/hubmap_api/endpoint.py index 98785043..4e8933ce 100644 --- a/src/ingest-pipeline/airflow/plugins/hubmap_api/endpoint.py +++ b/src/ingest-pipeline/airflow/plugins/hubmap_api/endpoint.py @@ -35,6 +35,7 @@ NEEDED_ENV_VARS = [ 'AIRFLOW_CONN_INGEST_API_CONNECTION', 'AIRFLOW_CONN_UUID_API_CONNECTION', + 'AIRFLOW_CONN_FILES_API_CONNECTION', 'AIRFLOW_CONN_SEARCH_API_CONNECTION', 'AIRFLOW_CONN_ENTITY_API_CONNECTION' ] diff --git a/src/ingest-pipeline/misc/tools/airflow_wrapper.sh b/src/ingest-pipeline/misc/tools/airflow_wrapper.sh index 499fbef1..ad0b3b39 100755 --- a/src/ingest-pipeline/misc/tools/airflow_wrapper.sh +++ b/src/ingest-pipeline/misc/tools/airflow_wrapper.sh @@ -53,6 +53,7 @@ source source_platform_file.sh envvars=( CONFIG HOME \ CONN_INGEST_API_CONNECTION \ CONN_UUID_API_CONNECTION \ + CONN_FILES_API_CONNECTION \ CONN_CELLS_API_CONNECTION \ CONN_SEARCH_API_CONNECTION \ CONN_ENTITY_API_CONNECTION \