Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Log last query_params hit before AirflowTaskTimeout (#1058)

Staci Mullins5c2d707681a9
diff --git a/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py b/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
index 19b83285b..edaf56fb6 100644
--- a/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
+++ b/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
@@ -237,8 +237,13 @@ class ProviderDataIngester(ABC):
should_continue = False
except AirflowException as error:
- # AirflowExceptions should not be caught, as execution should not
- # continue when the task is being stopped by Airflow.
+ # AirflowExceptions should not be caught or reraised as IngestionErrors,
+ # as execution should not continue when the task is being stopped by
+ # Airflow. However, we should still log the last query_params to be
+ # hit before the error was raised.
+ logger.info(
+ f"Last query_params used: {json.dumps(query_params, default=str)}"
+ )
# If errors have already been caught during processing, raise them
# as well.