Skip to content

Commit

Permalink
[AIRFLOW-1186] Sort dag.get_task_instances by execution_date
Browse files Browse the repository at this point in the history
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 apache#2284 from OpringaoDoTurno/fix-duration
  • Loading branch information
OpringaoDoTurno authored and bolkedebruin committed May 16, 2017
1 parent 8e69005 commit b87d3a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions airflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ def get_task_instances(
)
if state:
tis = tis.filter(TI.state == state)
tis = tis.all()
tis = tis.order_by(TI.execution_date).all()
return tis

@property
Expand Down Expand Up @@ -3887,7 +3887,7 @@ def set_dirty(dag_id, session=None):
"""
:param dag_id: the dag_id to mark dirty
:param session: database session
:return:
:return:
"""
DagStat.create(dag_id=dag_id, session=session)

Expand Down Expand Up @@ -3964,11 +3964,11 @@ def update(dag_ids=None, dirty_only=True, session=None):
@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()
Expand Down Expand Up @@ -4078,7 +4078,7 @@ def find(dag_id=None, run_id=None, execution_date=None,
: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
Expand Down

0 comments on commit b87d3a4

Please sign in to comment.