Fix trends in case of failures in contexts

In case when the context fails, there is no start_time timeframe in
workload and we should cover this case and do not fail with the next
error:

  TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

Closes-Bug: #1732193
Change-Id: I95e96bb98fe473e8c0ea910021966ceb203f35cd
This commit is contained in:
Andrey Kurilin 2017-11-25 13:57:50 +02:00
parent 4772d8c410
commit af2b146d24
1 changed files with 6 additions and 1 deletions

View File

@ -309,7 +309,12 @@ class Trends(object):
self._data[key]["sla_failures"] += not workload["pass_sla"]
duration_stats = workload["statistics"]["durations"]
ts = int(workload["start_time"] * 1000)
if not workload["start_time"]:
# NOTE(andreykurilin): The workload didn't start. Probably,
# one of contexts failed.
ts = None
else:
ts = int(workload["start_time"] * 1000)
for action in itertools.chain(duration_stats["atomics"],
[duration_stats["total"]]):