This is an automated email from the ASF dual-hosted git repository. kaxilnaik pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push: new 8c9a7b2 Remove redundant count query in BaseOperator.clear() (#9362) 8c9a7b2 is described below commit 8c9a7b2b0069425c7bb9eff4d25313f436e78307 Author: Kaxil Naik <kaxiln...@gmail.com> AuthorDate: Thu Jun 18 01:47:16 2020 +0100 Remove redundant count query in BaseOperator.clear() (#9362) We already fetch the results using `qry.all()` so running `qry.count()` is just redundant. --- airflow/models/baseoperator.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/airflow/models/baseoperator.py b/airflow/models/baseoperator.py index 7101f85..426a342 100644 --- a/airflow/models/baseoperator.py +++ b/airflow/models/baseoperator.py @@ -1027,13 +1027,10 @@ class BaseOperator(Operator, LoggingMixin, metaclass=BaseOperatorMeta): t.task_id for t in self.get_flat_relatives(upstream=False)] qry = qry.filter(TaskInstance.task_id.in_(tasks)) - - count = qry.count() - - clear_task_instances(qry.all(), session, dag=self.dag) - + results = qry.all() + count = len(results) + clear_task_instances(results, session, dag=self.dag) session.commit() - return count @provide_session