Merge "Fixed error on attempt to delete job execution several times"

This commit is contained in:
Jenkins 2014-11-28 11:58:34 +00:00 committed by Gerrit Code Review
commit a8a28ebbfe
2 changed files with 9 additions and 1 deletions

View File

@ -165,6 +165,11 @@ def cancel_job(job_execution_id):
context.sleep(3)
job_execution = conductor.job_execution_get(
ctx, job_execution_id)
if not job_execution:
LOG.info(_LI("Job execution %(job_exec_id)s was deleted. "
"Canceling current operation."),
{'job_exec_id': job_execution_id})
return job_execution
else:
LOG.info(_LI("Job execution status %(job)s: %(status)s"),
{'job': job_execution.id,

View File

@ -300,7 +300,10 @@ def _cancel_job_execution(job_execution_id):
def _delete_job_execution(job_execution_id):
try:
_cancel_job_execution(job_execution_id)
job_execution = job_manager.cancel_job(job_execution_id)
if not job_execution:
# job_execution was deleted already, nothing to do
return
except exceptions.CancelingFailed:
LOG.error(_LE("Job execution %s can't be cancelled in time. "
"Deleting it anyway."), job_execution_id)