Skip to content

Commit

Permalink
[AIRFLOW-619] Fix exception in Gannt chart
Browse files Browse the repository at this point in the history
If a TaskInstance has no end_date, use
datetime.now()

Closes apache#1874 from dgies/master
  • Loading branch information
dgies-pandora authored and msumit committed Nov 11, 2016
1 parent f192770 commit 868bc83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,13 +1694,14 @@ def gantt(self):

tasks = []
for ti in tis:
end_date = ti.end_date if ti.end_date else datetime.now()
tasks.append({
'startDate': wwwutils.epoch(ti.start_date),
'endDate': wwwutils.epoch(ti.end_date or datetime.now()),
'endDate': wwwutils.epoch(end_date),
'isoStart': ti.start_date.isoformat()[:-4],
'isoEnd': ti.end_date.isoformat()[:-4],
'isoEnd': end_date.isoformat()[:-4],
'taskName': ti.task_id,
'duration': "{}".format(ti.end_date - ti.start_date)[:-4],
'duration': "{}".format(end_date - ti.start_date)[:-4],
'status': ti.state,
'executionDate': ti.execution_date.isoformat(),
})
Expand Down

0 comments on commit 868bc83

Please sign in to comment.