diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-10-03 10:00:50 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-10-03 10:00:50 +0000 |
commit | a33fd160ab68e79e60c7a4981d102a63baea8f94 (patch) | |
tree | 6828993a9e71450c6d0a9be14016a6d096cb8f7c | |
parent | 244e3c7c5992fc863f0b363f86c4d3e32be894fb (diff) | |
parent | 3f4587ab0be3c976659259892caa0e3e1fee1f4e (diff) | |
download | buildstream-a33fd160ab68e79e60c7a4981d102a63baea8f94.tar.gz |
Merge branch 'tristan/fix-terminated-jobs-1.2' into 'bst-1.2'
_scheduler: Fix bookkeeping of terminated jobs
See merge request BuildStream/buildstream!851
-rw-r--r-- | buildstream/_scheduler/jobs/job.py | 14 | ||||
-rw-r--r-- | buildstream/_scheduler/queues/queue.py | 19 |
2 files changed, 24 insertions, 9 deletions
diff --git a/buildstream/_scheduler/jobs/job.py b/buildstream/_scheduler/jobs/job.py index d77fa0c82..d2f5f6536 100644 --- a/buildstream/_scheduler/jobs/job.py +++ b/buildstream/_scheduler/jobs/job.py @@ -119,6 +119,8 @@ class Job(): self._result = None # Return value of child action in the parent self._tries = 0 # Try count, for retryable jobs self._skipped_flag = False # Indicate whether the job was skipped. + self._terminated = False # Whether this job has been explicitly terminated + # If False, a retry will not be attempted regardless of whether _tries is less than _max_retries. # self._retry_flag = True @@ -188,6 +190,8 @@ class Job(): # Terminate the process using multiprocessing API pathway self._process.terminate() + self._terminated = True + # terminate_wait() # # Wait for terminated jobs to complete @@ -271,18 +275,22 @@ class Job(): # running the integration commands). # # Args: - # (int): The plugin identifier for this task + # task_id (int): The plugin identifier for this task # def set_task_id(self, task_id): self._task_id = task_id # skipped # + # This will evaluate to True if the job was skipped + # during processing, or if it was forcefully terminated. + # # Returns: - # bool: True if the job was skipped while processing. + # (bool): Whether the job should appear as skipped + # @property def skipped(self): - return self._skipped_flag + return self._skipped_flag or self._terminated ####################################################### # Abstract Methods # diff --git a/buildstream/_scheduler/queues/queue.py b/buildstream/_scheduler/queues/queue.py index 15467ca67..af4698350 100644 --- a/buildstream/_scheduler/queues/queue.py +++ b/buildstream/_scheduler/queues/queue.py @@ -325,15 +325,22 @@ class Queue(): detail=traceback.format_exc()) self.failed_elements.append(element) else: - - # No exception occured, handle the success/failure state in the normal way # + # No exception occured in post processing + # + + # Only place in the output done queue if the job + # was considered successful if success: self._done_queue.append(job) - if not job.skipped: - self.processed_elements.append(element) - else: - self.skipped_elements.append(element) + + # A Job can be skipped whether or not it has failed, + # we want to only bookkeep them as processed or failed + # if they are not skipped. + if job.skipped: + self.skipped_elements.append(element) + elif success: + self.processed_elements.append(element) else: self.failed_elements.append(element) |