Skip to content

Commit

Permalink
add email alerts to timeout sensor + increase alert to after 1 day
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Sep 12, 2023
1 parent 172825f commit 6504554
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions open_bus_pipelines/dags_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from open_bus_pipelines.operators.api_bash_operator import ApiBashOperator
from open_bus_pipelines.yaml_loader import yaml_safe_load
from open_bus_pipelines.sensors.dag_time_exceeded_sensor import DagTimeExceededSensor
from open_bus_pipelines import config


def dags_generator(base_url):
Expand Down Expand Up @@ -45,7 +46,8 @@ def dags_generator(base_url):
tasks[task_config['id']].set_upstream(tasks[depends_on_task_id])
if not dag_config.get('disable_alert_after_minutes'):
DagTimeExceededSensor(
alert_after_minutes=dag_config.get('alert_after_minutes') or 360,
task_id='monitor_task', mode='reschedule', poke_interval=60
alert_after_minutes=dag_config.get('alert_after_minutes') or 1440,
task_id='monitor_task', mode='reschedule', poke_interval=60,
**({'email': config.OPEN_BUS_PIPELINES_ALERT_EMAILS} if config.OPEN_BUS_PIPELINES_ALERT_EMAILS else {})
)
yield dag_config['name'].replace('-', '_'), dag

0 comments on commit 6504554

Please sign in to comment.