Skip to content

Commit

Permalink
adding: log event for auto pause (#38243)
Browse files Browse the repository at this point in the history
  • Loading branch information
pateash committed Mar 19, 2024
1 parent e671074 commit 99e0d43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions airflow/models/dagrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from airflow.configuration import conf as airflow_conf
from airflow.exceptions import AirflowException, RemovedInAirflow3Warning, TaskNotFound
from airflow.listeners.listener import get_listener_manager
from airflow.models import Log
from airflow.models.abstractoperator import NotMapped
from airflow.models.base import Base, StringID
from airflow.models.expandinput import NotFullyPopulated
Expand Down Expand Up @@ -594,6 +595,15 @@ def _check_last_n_dagruns_failed(self, dag_id, max_consecutive_failed_dag_runs,
.values(is_paused=True)
.execution_options(synchronize_session="fetch")
)
session.add(
Log(
event="paused",
dag_id=self.dag_id,
owner="scheduler",
owner_display_name="Scheduler",
extra=f"[('dag_id', '{self.dag_id}'), ('is_paused', True)]",
)
)
else:
self.log.debug(
"Limit of consecutive DAG failed dag runs is not reached, DAG %s will not be paused.",
Expand Down

0 comments on commit 99e0d43

Please sign in to comment.