andriisoldatenko commented on a change in pull request #5083: [AIRFLOW-4292]
Cleanup and improve SLA code
URL: https://github.com/apache/airflow/pull/5083#discussion_r280068209
##########
File path: airflow/jobs.py
##########
@@ -660,86 +660,88 @@ def manage_slas(self, dag, session=None):
dttm = dag.following_schedule(dttm)
session.commit()
+ # Identify tasks should send notification
slas = (
session
.query(SlaMiss)
.filter(SlaMiss.notification_sent == False, SlaMiss.dag_id ==
dag.dag_id) # noqa: E712
.all()
)
- if slas:
- sla_dates = [sla.execution_date for sla in slas]
- qry = (
- session
- .query(TI)
- .filter(
- TI.state != State.SUCCESS,
- TI.execution_date.in_(sla_dates),
- TI.dag_id == dag.dag_id
- ).all()
- )
- blocking_tis = []
- for ti in qry:
- if ti.task_id in dag.task_ids:
- ti.task = dag.get_task(ti.task_id)
- blocking_tis.append(ti)
- else:
- session.delete(ti)
- session.commit()
+ if not slas:
Review comment:
what are the purpose of this 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:
[email protected]
With regards,
Apache Git Services