From 1443c542870de8c7186c361306078010f406fa83 Mon Sep 17 00:00:00 2001
From: Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
Date: Mon, 21 Jan 2019 15:53:50 -0500
Subject: [PATCH] _scheduler: Fix dont display a failure for terminated jobs

This fixes a recent regression introduced in c2fc2a5ea
---
 buildstream/_scheduler/jobs/job.py     | 10 ++++++++++
 buildstream/_scheduler/queues/queue.py |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/buildstream/_scheduler/jobs/job.py b/buildstream/_scheduler/jobs/job.py
index 91ed187b08..7f14cf05f6 100644
--- a/buildstream/_scheduler/jobs/job.py
+++ b/buildstream/_scheduler/jobs/job.py
@@ -184,6 +184,16 @@ class Job():
 
         self._terminated = True
 
+    # get_terminated()
+    #
+    # Check if a job has been terminated.
+    #
+    # Returns:
+    #     (bool): True in the main process if Job.terminate() was called.
+    #
+    def get_terminated(self):
+        return self._terminated
+
     # terminate_wait()
     #
     # Wait for terminated jobs to complete
diff --git a/buildstream/_scheduler/queues/queue.py b/buildstream/_scheduler/queues/queue.py
index a20f44eea0..9f0563fa59 100644
--- a/buildstream/_scheduler/queues/queue.py
+++ b/buildstream/_scheduler/queues/queue.py
@@ -305,7 +305,7 @@ class Queue():
             self._done_queue.append(element)
 
             # These lists are for bookkeeping purposes for the UI and logging.
-            if status == JobStatus.SKIPPED:
+            if status == JobStatus.SKIPPED or job.get_terminated():
                 self.skipped_elements.append(element)
             elif status == JobStatus.OK:
                 self.processed_elements.append(element)
-- 
GitLab