Skip to content

Commit

Permalink
[AIRFLOW-919] Running tasks with no start date shouldn't break a DAGs UI
Browse files Browse the repository at this point in the history
Please accept this PR that addresses the following
issues:
-
https://issues.apache.org/jira/browse/AIRFLOW-919

I also made the airflow PR template a little bit
less verbose (requires less edits when creating a
PR).

Testing Done:
- Ran a webserver with this case and made sure
that the DAG page loaded

Closes apache#2110 from
aoen/ddavydov/fix_running_task_with_no_start_date
  • Loading branch information
aoen committed Feb 27, 2017
1 parent 5831652 commit 57e8956
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
Dear Airflow Maintainers,

Please accept this PR that addresses the following issues:
- *(replace with a link to AIRFLOW-X)*

Per Apache guidelines you need to create a [Jira issue](https://issues.apache.org/jira/browse/AIRFLOW/).
- *(MANDATORY - replace with a link to JIRA - e.g. https://issues.apache.org/jira/browse/AIRFLOW-XXX)*

Testing Done:
- Unittests are required, if you do not include new unit tests please
Expand Down
3 changes: 2 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,8 @@ def recurse_nodes(task, visited):
children_key = "_children"

def set_duration(tid):
if isinstance(tid, dict) and tid.get("state") == State.RUNNING:
if (isinstance(tid, dict) and tid.get("state") == State.RUNNING and
tid["start_date"] is not None):
d = datetime.now() - dateutil.parser.parse(tid["start_date"])
tid["duration"] = d.total_seconds()
return tid
Expand Down

0 comments on commit 57e8956

Please sign in to comment.