This code is scheduled to be removed any way (for a single job, there is no point in managing a job queue) and the assertion does not hold true any more in the new design. The problem with the assertion is that it does not kill the process, so the job will never be cleaned up. Hence remove the assertion and do a best effort to get the job in an error state.
Signed-off-by: Klaus Aehlig <aeh...@google.com> --- lib/jqueue/__init__.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/jqueue/__init__.py b/lib/jqueue/__init__.py index b381f52..dce3fed 100644 --- a/lib/jqueue/__init__.py +++ b/lib/jqueue/__init__.py @@ -1081,19 +1081,14 @@ class _JobProcessor(object): finalize = False elif op.status == constants.OP_STATUS_ERROR: - # Ensure failed opcode has an exception as its result - assert errors.GetEncodedError(job.ops[opctx.index].result) - + # If we get here, we cannot afford to check for any consistency + # any more, we just want to clean up. + # TODO: Actually, it wouldn't be a bad idea to start a timer + # here to kill the whole process. to_encode = errors.OpExecError("Preceding opcode failed") job.MarkUnfinishedOps(constants.OP_STATUS_ERROR, _EncodeOpError(to_encode)) finalize = True - - # Consistency check - assert compat.all(i.status == constants.OP_STATUS_ERROR and - errors.GetEncodedError(i.result) - for i in job.ops[opctx.index:]) - elif op.status == constants.OP_STATUS_CANCELING: job.MarkUnfinishedOps(constants.OP_STATUS_CANCELED, "Job canceled by request") -- 2.0.0.526.g5318336