Revision 6ea72e43 lib/jqueue.py

b/lib/jqueue.py
754 754
              op.status = constants.OP_STATUS_SUCCESS
755 755
              op.result = result
756 756
              op.end_timestamp = TimeStampNow()
757
              if idx == count - 1:
758
                job.lock_status = None
759
                job.end_timestamp = TimeStampNow()
757 760
              queue.UpdateJobUnlocked(job)
758 761
            finally:
759 762
              queue.release()
......
778 781
                logging.info("Op %s/%s: Error in opcode %s: %s",
779 782
                             idx + 1, count, op_summary, err)
780 783
              finally:
784
                job.lock_status = None
785
                job.end_timestamp = TimeStampNow()
781 786
                queue.UpdateJobUnlocked(job)
782 787
            finally:
783 788
              queue.release()
......
788 793
        try:
789 794
          job.MarkUnfinishedOps(constants.OP_STATUS_CANCELED,
790 795
                                "Job canceled by request")
796
          job.lock_status = None
797
          job.end_timestamp = TimeStampNow()
798
          queue.UpdateJobUnlocked(job)
791 799
        finally:
792 800
          queue.release()
793 801
      except errors.GenericError, err:
......
795 803
      except:
796 804
        logging.exception("Unhandled exception")
797 805
    finally:
798
      queue.acquire(shared=1)
799
      try:
800
        try:
801
          job.lock_status = None
802
          job.end_timestamp = TimeStampNow()
803
          queue.UpdateJobUnlocked(job)
804
        finally:
805
          job_id = job.id
806
          status = job.CalcStatus()
807
      finally:
808
        queue.release()
809

  
810
      logging.info("Finished job %s, status = %s", job_id, status)
806
      status = job.CalcStatus()
807
      logging.info("Finished job %s, status = %s", job.id, status)
811 808

  
812 809

  
813 810
class _JobQueueWorkerPool(workerpool.WorkerPool):

Also available in: Unified diff