Skip to content

Commit

Permalink
add alert_after_max_retries callback function
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaszanotelli committed Nov 8, 2023
1 parent 15a0424 commit ce25fc2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dags/cleanup_metadata_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
from sqlalchemy import and_, func, text
from sqlalchemy.exc import ProgrammingError
from sqlalchemy.orm import load_only
from stellar_etl_airflow.default import get_default_dag_args, init_sentry
from stellar_etl_airflow.default import (
alert_after_max_retries,
get_default_dag_args,
init_sentry,
)

init_sentry()

Expand Down Expand Up @@ -435,13 +439,18 @@ def analyze_db():


analyze_op = PythonOperator(
task_id="analyze_query", python_callable=analyze_db, provide_context=True, dag=dag
task_id="analyze_query",
python_callable=analyze_db,
provide_context=True,
on_failure_callback=alert_after_max_retries,
dag=dag,
)

cleanup_session_op = PythonOperator(
task_id="cleanup_sessions",
python_callable=cleanup_sessions,
provide_context=True,
on_failure_callback=alert_after_max_retries,
dag=dag,
)

Expand All @@ -453,6 +462,7 @@ def analyze_db():
python_callable=cleanup_function,
params=db_object,
provide_context=True,
on_failure_callback=alert_after_max_retries,
dag=dag,
)

Expand Down

0 comments on commit ce25fc2

Please sign in to comment.