You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/01/10 17:30:14 UTC

[GitHub] [airflow] ashb commented on a change in pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries

ashb commented on a change in pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries
URL: https://github.com/apache/airflow/pull/6792#discussion_r365346852
 
 

 ##########
 File path: airflow/ti_deps/deps/trigger_rule_dep.py
 ##########
 @@ -34,9 +35,38 @@ class TriggerRuleDep(BaseTIDep):
     IGNOREABLE = True
     IS_TASK_DEP = True
 
+    @staticmethod
+    def bake_dep_status_query():
+        TI = airflow.models.TaskInstance
+        # TODO(unknown): this query becomes quite expensive with dags that have many
+        # tasks. It should be refactored to let the task report to the dag run and get the
+        # aggregates from there.
+        q = BAKED_QUERIES(lambda session: session.query(
+            func.coalesce(func.sum(case([(TI.state == State.SUCCESS, 1)], else_=0)), 0),
 
 Review comment:
   May not be needed after #4751 anyway.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services