Revision dc1e2262

b/lib/jqueue.py
420 420
    self._job = job
421 421
    self._op = op
422 422

  
423
  def _CheckCancel(self):
424
    """Raises an exception to cancel the job if asked to.
425

  
426
    """
427
    # Cancel here if we were asked to
428
    if self._op.status == constants.OP_STATUS_CANCELING:
429
      logging.debug("Canceling opcode")
430
      raise CancelJob()
431

  
423 432
  @locking.ssynchronized(_QUEUE, shared=1)
424 433
  def NotifyStart(self):
425 434
    """Mark the opcode as running, not lock-waiting.
......
437 446
    self._job.lock_status = None
438 447

  
439 448
    # Cancel here if we were asked to
440
    if self._op.status == constants.OP_STATUS_CANCELING:
441
      logging.debug("Canceling opcode")
442
      raise CancelJob()
449
    self._CheckCancel()
443 450

  
444 451
    logging.debug("Opcode is now running")
445 452
    self._op.status = constants.OP_STATUS_RUNNING
......
480 487
    Called whenever the LU processor is waiting for a lock or has acquired one.
481 488

  
482 489
    """
490
    assert self._op.status in (constants.OP_STATUS_WAITLOCK,
491
                               constants.OP_STATUS_CANCELING)
492

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

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

  
486 499

  
487 500
class _JobChangesChecker(object):
488 501
  def __init__(self, fields, prev_job_info, prev_log_serial):

Also available in: Unified diff