serkef commented on a change in pull request #5517: [AIRFLOW-4292] Cleanup and improve SLA code URL: https://github.com/apache/airflow/pull/5517#discussion_r302276684
########## File path: airflow/jobs/scheduler_job.py ########## @@ -389,34 +389,34 @@ def manage_slas(self, dag, session=None): Finding all tasks that have SLAs defined, and sending alert emails where needed. New SLA misses are also recorded in the database. - Where assuming that the scheduler runs often, so we only check for + We are assuming that the scheduler runs often, so we only check for tasks that should have succeeded in the past hour. """ - if not any([isinstance(ti.sla, timedelta) for ti in dag.tasks]): + if not any(isinstance(ti.sla, timedelta) for ti in dag.tasks): self.log.info("Skipping SLA check for %s because no tasks in DAG have SLAs", dag) return + # Find the last executed tasks TI = models.TaskInstance sq = ( Review comment: Thanks, didn't know about this one. Will change. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services