Revision 747f6113
b/lib/jqueue.py | ||
---|---|---|
377 | 377 |
@param result: the opcode result |
378 | 378 |
|
379 | 379 |
""" |
380 |
try: |
|
381 |
not_marked = True |
|
382 |
for op in self.ops: |
|
383 |
if op.status in constants.OPS_FINALIZED: |
|
384 |
assert not_marked, "Finalized opcodes found after non-finalized ones" |
|
385 |
continue |
|
386 |
op.status = status |
|
387 |
op.result = result |
|
388 |
not_marked = False |
|
389 |
finally: |
|
390 |
self.queue.UpdateJobUnlocked(self) |
|
380 |
not_marked = True |
|
381 |
for op in self.ops: |
|
382 |
if op.status in constants.OPS_FINALIZED: |
|
383 |
assert not_marked, "Finalized opcodes found after non-finalized ones" |
|
384 |
continue |
|
385 |
op.status = status |
|
386 |
op.result = result |
|
387 |
not_marked = False |
|
391 | 388 |
|
392 | 389 |
|
393 | 390 |
class _OpExecCallbacks(mcpu.OpExecCbBase): |
... | ... | |
947 | 944 |
logging.warning("Unfinished job %s found: %s", job.id, job) |
948 | 945 |
job.MarkUnfinishedOps(constants.OP_STATUS_ERROR, |
949 | 946 |
"Unclean master daemon shutdown") |
947 |
self.UpdateJobUnlocked(job) |
|
950 | 948 |
|
951 | 949 |
logging.info("Job queue inspection finished") |
952 | 950 |
finally: |
... | ... | |
1474 | 1472 |
if job_status == constants.JOB_STATUS_QUEUED: |
1475 | 1473 |
job.MarkUnfinishedOps(constants.OP_STATUS_CANCELED, |
1476 | 1474 |
"Job canceled by request") |
1477 |
return (True, "Job %s canceled" % job.id)
|
|
1475 |
msg = "Job %s canceled" % job.id
|
|
1478 | 1476 |
|
1479 | 1477 |
elif job_status == constants.JOB_STATUS_WAITLOCK: |
1480 | 1478 |
# The worker will notice the new status and cancel the job |
1481 | 1479 |
job.MarkUnfinishedOps(constants.OP_STATUS_CANCELING, None) |
1482 |
return (True, "Job %s will be canceled" % job.id) |
|
1480 |
msg = "Job %s will be canceled" % job.id |
|
1481 |
|
|
1482 |
self.UpdateJobUnlocked(job) |
|
1483 |
|
|
1484 |
return (True, msg) |
|
1483 | 1485 |
|
1484 | 1486 |
@_RequireOpenQueue |
1485 | 1487 |
def _ArchiveJobsUnlocked(self, jobs): |
Also available in: Unified diff