airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject incubator-airflow git commit: [AIRFLOW-1186] Sort dag.get_task_instances by execution_date
Date Tue, 16 May 2017 08:30:45 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master 8e69005a3 -> b87d3a490


[AIRFLOW-1186] Sort dag.get_task_instances by execution_date

task.get_task_instances is sorted by
execution_date, so we sort
dag.get_task_instances by execution_date so it
doesn't break
duration chart

Closes #2284 from OpringaoDoTurno/fix-duration


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

Branch: refs/heads/master
Commit: b87d3a49054f3890cf6714e7c4920973754b810e
Parents: 8e69005
Author: Ignasi Peiró <ignasi.peiro@gmail.com>
Authored: Tue May 16 10:30:21 2017 +0200
Committer: Bolke de Bruin <bolke@xs4all.nl>
Committed: Tue May 16 10:30:21 2017 +0200

----------------------------------------------------------------------
 airflow/models.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b87d3a49/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 90060d5..9a075a8 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -3079,7 +3079,7 @@ class DAG(BaseDag, LoggingMixin):
         )
         if state:
             tis = tis.filter(TI.state == state)
-        tis = tis.all()
+        tis = tis.order_by(TI.execution_date).all()
         return tis
 
     @property
@@ -3887,7 +3887,7 @@ class DagStat(Base):
         """
         :param dag_id: the dag_id to mark dirty
         :param session: database session
-        :return: 
+        :return:
         """
         DagStat.create(dag_id=dag_id, session=session)
 
@@ -3964,11 +3964,11 @@ class DagStat(Base):
     @provide_session
     def create(dag_id, session=None):
         """
-        Creates the missing states the stats table for the dag specified 
-        
+        Creates the missing states the stats table for the dag specified
+
         :param dag_id: dag id of the dag to create stats for
         :param session: database session
-        :return: 
+        :return:
         """
         # unfortunately sqlalchemy does not know upsert
         qry = session.query(DagStat).filter(DagStat.dag_id == dag_id).all()
@@ -4078,7 +4078,7 @@ class DagRun(Base):
         :type state: State
         :param external_trigger: whether this dag run is externally triggered
         :type external_trigger: bool
-        :param no_backfills: return no backfills (True), return all (False). 
+        :param no_backfills: return no backfills (True), return all (False).
         Defaults to False
         :type no_backfills: bool
         :param session: database session


Mime
View raw message