[AIRFLOW-938] Use test for True in task_stats queries

Fix a bug with the task_stats query on postgres which doesn't support
== 1.

https://issues.apache.org/jira/browse/AIRFLOW-938

I've seen the other PR but I'll try to see if this
method works because I believe `__eq__(True)` is
just `== True`, and it is how it is down here http
://docs.sqlalchemy.org/en/latest/core/sqlelement.h
tml#sqlalchemy.sql.expression.and_ (underscore is
part of link)

Closes #2123 from saguziel/aguziel-fix-task-
stats-2


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/157054e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/157054e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/157054e2

Branch: refs/heads/v1-8-test
Commit: 157054e2c9967e48fb3f3157081baf686dcee5e8
Parents: 66f39ca
Author: Alex Guziel <alex.guz...@airbnb.com>
Authored: Fri Mar 3 13:52:03 2017 -0800
Committer: Bolke de Bruin <bolke@Bolkes-MacBook-Pro.local>
Committed: Sun Mar 12 08:21:23 2017 -0700

----------------------------------------------------------------------
 airflow/www/views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/157054e2/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index d1a1f9a..962c1f0 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -506,7 +506,7 @@ class Airflow(BaseView):
             session.query(DagRun.dag_id, 
sqla.func.max(DagRun.execution_date).label('execution_date'))
             .join(Dag, Dag.dag_id == DagRun.dag_id)
             .filter(DagRun.state != State.RUNNING)
-            .filter(Dag.is_active == 1)
+            .filter(Dag.is_active == True)
             .group_by(DagRun.dag_id)
             .subquery('last_dag_run')
         )
@@ -514,7 +514,7 @@ class Airflow(BaseView):
             session.query(DagRun.dag_id, DagRun.execution_date)
             .join(Dag, Dag.dag_id == DagRun.dag_id)
             .filter(DagRun.state == State.RUNNING)
-            .filter(Dag.is_active == 1)
+            .filter(Dag.is_active == True)
             .subquery('running_dag_run')
         )
 

Reply via email to