Tristan Van Berkom pushed to branch master at BuildStream / buildstream
Commits:
-
11320fe2
by Tristan Van Berkom at 2018-10-03T09:33:39Z
-
91271964
by Tristan Van Berkom at 2018-10-03T09:59:40Z
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
|
| ... | ... | @@ -190,6 +192,8 @@ class Job(): |
| 190 | 192 |
# Terminate the process using multiprocessing API pathway
|
| 191 | 193 |
self._process.terminate()
|
| 192 | 194 |
|
| 195 |
+ self._terminated = True
|
|
| 196 |
+ |
|
| 193 | 197 |
# terminate_wait()
|
| 194 | 198 |
#
|
| 195 | 199 |
# Wait for terminated jobs to complete
|
| ... | ... | @@ -273,18 +277,22 @@ class Job(): |
| 273 | 277 |
# running the integration commands).
|
| 274 | 278 |
#
|
| 275 | 279 |
# Args:
|
| 276 |
- # (int): The plugin identifier for this task
|
|
| 280 |
+ # task_id (int): The plugin identifier for this task
|
|
| 277 | 281 |
#
|
| 278 | 282 |
def set_task_id(self, task_id):
|
| 279 | 283 |
self._task_id = task_id
|
| 280 | 284 |
|
| 281 | 285 |
# skipped
|
| 282 | 286 |
#
|
| 287 |
+ # This will evaluate to True if the job was skipped
|
|
| 288 |
+ # during processing, or if it was forcefully terminated.
|
|
| 289 |
+ #
|
|
| 283 | 290 |
# Returns:
|
| 284 |
- # bool: True if the job was skipped while processing.
|
|
| 291 |
+ # (bool): Whether the job should appear as skipped
|
|
| 292 |
+ #
|
|
| 285 | 293 |
@property
|
| 286 | 294 |
def skipped(self):
|
| 287 |
- return self._skipped_flag
|
|
| 295 |
+ return self._skipped_flag or self._terminated
|
|
| 288 | 296 |
|
| 289 | 297 |
#######################################################
|
| 290 | 298 |
# Abstract Methods #
|
| ... | ... | @@ -326,16 +326,20 @@ class Queue(): |
| 326 | 326 |
detail=traceback.format_exc())
|
| 327 | 327 |
self.failed_elements.append(element)
|
| 328 | 328 |
else:
|
| 329 |
- |
|
| 330 |
- # No exception occured, handle the success/failure state in the normal way
|
|
| 331 | 329 |
#
|
| 330 |
+ # No exception occured in post processing
|
|
| 331 |
+ #
|
|
| 332 |
+ |
|
| 333 |
+ # All jobs get placed on the done queue for later processing.
|
|
| 332 | 334 |
self._done_queue.append(job)
|
| 333 | 335 |
|
| 334 |
- if success:
|
|
| 335 |
- if not job.skipped:
|
|
| 336 |
- self.processed_elements.append(element)
|
|
| 337 |
- else:
|
|
| 338 |
- self.skipped_elements.append(element)
|
|
| 336 |
+ # A Job can be skipped whether or not it has failed,
|
|
| 337 |
+ # we want to only bookkeep them as processed or failed
|
|
| 338 |
+ # if they are not skipped.
|
|
| 339 |
+ if job.skipped:
|
|
| 340 |
+ self.skipped_elements.append(element)
|
|
| 341 |
+ elif success:
|
|
| 342 |
+ self.processed_elements.append(element)
|
|
| 339 | 343 |
else:
|
| 340 | 344 |
self.failed_elements.append(element)
|
| 341 | 345 |
|
