andrewgodwin commented on a change in pull request #15389:
URL: https://github.com/apache/airflow/pull/15389#discussion_r638976812
##########
File path: airflow/models/dag.py
##########
@@ -1232,23 +1253,13 @@ def clear(
)
)
- if start_date:
- tis = tis.filter(TI.execution_date >= start_date)
- if end_date:
- tis = tis.filter(TI.execution_date <= end_date)
- if only_failed:
- tis = tis.filter(or_(TI.state == State.FAILED, TI.state ==
State.UPSTREAM_FAILED))
- if only_running:
- tis = tis.filter(TI.state == State.RUNNING)
- if task_ids:
- tis = tis.filter(TI.task_id.in_(task_ids))
-
if include_subdags:
from airflow.sensors.external_task import ExternalTaskMarker
# Recursively find external tasks indicated by ExternalTaskMarker
- instances = tis.all()
- for ti in instances:
+ for ti in (
+ session.query(TI).filter(tuple_(TI.dag_id, TI.task_id,
TI.execution_date).in_(tis)).all()
Review comment:
But it's OK for now? The alternative is an entire refactor of
`DAG.clear` and I'm not sure we want to do that here if we can help it.
--
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]