Tristan Van Berkom pushed to branch bst-1.2 at BuildStream / buildstream
Commits:
-
3f4587ab
by Tristan Van Berkom at 2018-10-03T09:36:34Z
-
a33fd160
by Tristan Van Berkom at 2018-10-03T10:00:50Z
2 changed files:
Changes:
... | ... | @@ -119,6 +119,8 @@ class Job(): |
119 | 119 |
self._result = None # Return value of child action in the parent
|
120 | 120 |
self._tries = 0 # Try count, for retryable jobs
|
121 | 121 |
self._skipped_flag = False # Indicate whether the job was skipped.
|
122 |
+ self._terminated = False # Whether this job has been explicitly terminated
|
|
123 |
+ |
|
122 | 124 |
# If False, a retry will not be attempted regardless of whether _tries is less than _max_retries.
|
123 | 125 |
#
|
124 | 126 |
self._retry_flag = True
|
... | ... | @@ -188,6 +190,8 @@ class Job(): |
188 | 190 |
# Terminate the process using multiprocessing API pathway
|
189 | 191 |
self._process.terminate()
|
190 | 192 |
|
193 |
+ self._terminated = True
|
|
194 |
+ |
|
191 | 195 |
# terminate_wait()
|
192 | 196 |
#
|
193 | 197 |
# Wait for terminated jobs to complete
|
... | ... | @@ -271,18 +275,22 @@ class Job(): |
271 | 275 |
# running the integration commands).
|
272 | 276 |
#
|
273 | 277 |
# Args:
|
274 |
- # (int): The plugin identifier for this task
|
|
278 |
+ # task_id (int): The plugin identifier for this task
|
|
275 | 279 |
#
|
276 | 280 |
def set_task_id(self, task_id):
|
277 | 281 |
self._task_id = task_id
|
278 | 282 |
|
279 | 283 |
# skipped
|
280 | 284 |
#
|
285 |
+ # This will evaluate to True if the job was skipped
|
|
286 |
+ # during processing, or if it was forcefully terminated.
|
|
287 |
+ #
|
|
281 | 288 |
# Returns:
|
282 |
- # bool: True if the job was skipped while processing.
|
|
289 |
+ # (bool): Whether the job should appear as skipped
|
|
290 |
+ #
|
|
283 | 291 |
@property
|
284 | 292 |
def skipped(self):
|
285 |
- return self._skipped_flag
|
|
293 |
+ return self._skipped_flag or self._terminated
|
|
286 | 294 |
|
287 | 295 |
#######################################################
|
288 | 296 |
# Abstract Methods #
|
... | ... | @@ -325,15 +325,22 @@ class Queue(): |
325 | 325 |
detail=traceback.format_exc())
|
326 | 326 |
self.failed_elements.append(element)
|
327 | 327 |
else:
|
328 |
- |
|
329 |
- # No exception occured, handle the success/failure state in the normal way
|
|
330 | 328 |
#
|
329 |
+ # No exception occured in post processing
|
|
330 |
+ #
|
|
331 |
+ |
|
332 |
+ # Only place in the output done queue if the job
|
|
333 |
+ # was considered successful
|
|
331 | 334 |
if success:
|
332 | 335 |
self._done_queue.append(job)
|
333 |
- if not job.skipped:
|
|
334 |
- self.processed_elements.append(element)
|
|
335 |
- else:
|
|
336 |
- self.skipped_elements.append(element)
|
|
336 |
+ |
|
337 |
+ # A Job can be skipped whether or not it has failed,
|
|
338 |
+ # we want to only bookkeep them as processed or failed
|
|
339 |
+ # if they are not skipped.
|
|
340 |
+ if job.skipped:
|
|
341 |
+ self.skipped_elements.append(element)
|
|
342 |
+ elif success:
|
|
343 |
+ self.processed_elements.append(element)
|
|
337 | 344 |
else:
|
338 | 345 |
self.failed_elements.append(element)
|
339 | 346 |
|