Revision 9bdab621 lib/jqueue.py

b/lib/jqueue.py
167 167
  @ivar received_timestamp: the timestamp for when the job was received
168 168
  @ivar start_timestmap: the timestamp for start of execution
169 169
  @ivar end_timestamp: the timestamp for end of execution
170
  @ivar lock_status: In-memory locking information for debugging
171 170

  
172 171
  """
173 172
  # pylint: disable-msg=W0212
174 173
  __slots__ = ["queue", "id", "ops", "log_serial",
175 174
               "received_timestamp", "start_timestamp", "end_timestamp",
176
               "lock_status", "change",
177 175
               "__weakref__"]
178 176

  
179 177
  def __init__(self, queue, job_id, ops):
......
199 197
    self.start_timestamp = None
200 198
    self.end_timestamp = None
201 199

  
202
    # In-memory attributes
203
    self.lock_status = None
204

  
205 200
  def __repr__(self):
206 201
    status = ["%s.%s" % (self.__class__.__module__, self.__class__.__name__),
207 202
              "id=%s" % self.id,
......
228 223
    obj.start_timestamp = state.get("start_timestamp", None)
229 224
    obj.end_timestamp = state.get("end_timestamp", None)
230 225

  
231
    # In-memory attributes
232
    obj.lock_status = None
233

  
234 226
    obj.ops = []
235 227
    obj.log_serial = 0
236 228
    for op_state in state["ops"]:
......
368 360
        row.append(self.start_timestamp)
369 361
      elif fname == "end_ts":
370 362
        row.append(self.end_timestamp)
371
      elif fname == "lock_status":
372
        row.append(self.lock_status)
373 363
      elif fname == "summary":
374 364
        row.append([op.input.Summary() for op in self.ops])
375 365
      else:
......
439 429
    Processor.ExecOpCode) set to OP_STATUS_WAITLOCK.
440 430

  
441 431
    """
432
    assert self._op in self._job.ops
442 433
    assert self._op.status in (constants.OP_STATUS_WAITLOCK,
443 434
                               constants.OP_STATUS_CANCELING)
444 435

  
445
    # All locks are acquired by now
446
    self._job.lock_status = None
447

  
448 436
    # Cancel here if we were asked to
449 437
    self._CheckCancel()
450 438

  
451 439
    logging.debug("Opcode is now running")
440

  
452 441
    self._op.status = constants.OP_STATUS_RUNNING
453 442
    self._op.exec_timestamp = TimeStampNow()
454 443

  
......
490 479
    assert self._op.status in (constants.OP_STATUS_WAITLOCK,
491 480
                               constants.OP_STATUS_CANCELING)
492 481

  
493
    # Not getting the queue lock because this is a single assignment
494
    self._job.lock_status = msg
495

  
496 482
    # Cancel here if we were asked to
497 483
    self._CheckCancel()
498 484

  
......
755 741
              op.result = result
756 742
              op.end_timestamp = TimeStampNow()
757 743
              if idx == count - 1:
758
                job.lock_status = None
759 744
                job.end_timestamp = TimeStampNow()
760 745

  
761 746
                # Consistency check
......
797 782
                                  errors.GetEncodedError(i.result)
798 783
                                  for i in job.ops[idx:])
799 784
              finally:
800
                job.lock_status = None
801 785
                job.end_timestamp = TimeStampNow()
802 786
                queue.UpdateJobUnlocked(job)
803 787
            finally:
......
809 793
        try:
810 794
          job.MarkUnfinishedOps(constants.OP_STATUS_CANCELED,
811 795
                                "Job canceled by request")
812
          job.lock_status = None
813 796
          job.end_timestamp = TimeStampNow()
814 797
          queue.UpdateJobUnlocked(job)
815 798
        finally:

Also available in: Unified diff