kaxil commented on a change in pull request #15389:
URL: https://github.com/apache/airflow/pull/15389#discussion_r638920862
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1899,3 +1910,17 @@ def adopt_or_reset_orphaned_tasks(self, session: Session
= None):
raise
return len(to_reset)
+
+ @provide_session
+ def check_trigger_timeouts(self, session: Session = None):
+ """
+ Looks at all tasks that are in the "deferred" state and whose trigger
+ timeout has passed, so they can be marked as failed.
+ """
+ timed_out_tasks = session.query(TaskInstance).filter(
+ TaskInstance.state == State.DEFERRED, TaskInstance.trigger_timeout
< timezone.utcnow()
+ )
+ num_tasks = timed_out_tasks.count()
Review comment:
```suggestion
num_tasks = session.query(func.count(TaskInstance.task_id)).filter(
TaskInstance.state == State.DEFERRED,
TaskInstance.trigger_timeout < timezone.utcnow()
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]