Repository: incubator-airflow Updated Branches: refs/heads/master 0f8507ae3 -> 3fa55db90
[AIRFLOW-2309] Fix duration calculation on TaskFail Closes #3208 from johnarnold/duration Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/3fa55db9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/3fa55db9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/3fa55db9 Branch: refs/heads/master Commit: 3fa55db90cbeee3746220d0ac0cdfa3db52c0753 Parents: 0f8507a Author: John Arnold (AZURE) <[email protected]> Authored: Wed Apr 18 10:28:13 2018 +0200 Committer: Fokko Driesprong <[email protected]> Committed: Wed Apr 18 10:28:13 2018 +0200 ---------------------------------------------------------------------- airflow/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3fa55db9/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 9635460..ee92689 100755 --- a/airflow/models.py +++ b/airflow/models.py @@ -1988,7 +1988,10 @@ class TaskFail(Base): self.execution_date = execution_date self.start_date = start_date self.end_date = end_date - self.duration = (self.end_date - self.start_date).total_seconds() + if self.end_date and self.start_date: + self.duration = (self.end_date - self.start_date).total_seconds() + else: + self.duration = None class Log(Base):
