buildkite bot status: Ignore jobs that were never started
This happens when earlier parts of the pipeline fail
and it decides not to continue.
Change-Id: I5609caa58b5e05d1cb33d046b664ef084d3ae8f0
diff --git a/monitor/buildkite_status.py b/monitor/buildkite_status.py
index 09c8d3f..d2fbab9 100755
--- a/monitor/buildkite_status.py
+++ b/monitor/buildkite_status.py
@@ -78,9 +78,15 @@
if job.get('name') != job_name:
continue
+ # Some jobs were never started due to failures earlier in the pipeline.
+ # This isn't our fault so ignore these.
+ started_time = job.get('started_at')
+ if started_time is None:
+ continue
+
# We use started because that's when it starts to
# run on the agent (don't want to include waiting time)
- started = dateutil.parser.isoparse(job['started_at'])
+ started = dateutil.parser.isoparse(started_time)
finished = dateutil.parser.isoparse(job['finished_at'])
# Buildkite gives us mS resoloution but we don't need that
duration = timedelta(seconds=int(