Repository: incubator-airflow Updated Branches: refs/heads/v1-8-test 9e6dfcbdb -> 17233ea77
[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 (cherry picked from commit b87d3a49054f3890cf6714e7c4920973754b810e) Signed-off-by: Bolke de Bruin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/17233ea7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/17233ea7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/17233ea7 Branch: refs/heads/v1-8-test Commit: 17233ea77998ddf587bd2269487b73ad80d75b84 Parents: 9e6dfcb Author: Ignasi Peiró <[email protected]> Authored: Tue May 16 10:30:21 2017 +0200 Committer: Bolke de Bruin <[email protected]> Committed: Tue May 16 10:30:52 2017 +0200 ---------------------------------------------------------------------- airflow/models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/17233ea7/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 646f74b..484cb8c 100755 --- a/airflow/models.py +++ b/airflow/models.py @@ -3026,7 +3026,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 @@ -3817,7 +3817,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) @@ -3894,11 +3894,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() @@ -4008,7 +4008,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
