[AIRFLOW-919] Running tasks with no start date shouldn't break a DAGs UI 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 #2110 from aoen/ddavydov/fix_running_task_with_no_start_date Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/ab37f8d3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/ab37f8d3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/ab37f8d3 Branch: refs/heads/v1-8-test Commit: ab37f8d32ef9dcf3163a037b53ca749f2f99f22e Parents: 01494fd Author: Dan Davydov <[email protected]> Authored: Mon Feb 27 13:43:25 2017 -0800 Committer: Bolke de Bruin <[email protected]> Committed: Sun Mar 12 08:20:00 2017 -0700 ---------------------------------------------------------------------- .github/PULL_REQUEST_TEMPLATE.md | 6 +----- airflow/www/views.py | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ab37f8d3/.github/PULL_REQUEST_TEMPLATE.md ---------------------------------------------------------------------- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5681a89..b92e29a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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 http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ab37f8d3/airflow/www/views.py ---------------------------------------------------------------------- diff --git a/airflow/www/views.py b/airflow/www/views.py index bda4921..86b1291 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -1205,7 +1205,8 @@ class Airflow(BaseView): 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
