Revision 41593f6b lib/jqueue.py

b/lib/jqueue.py
162 162
  @ivar start_timestmap: the timestamp for start of execution
163 163
  @ivar end_timestamp: the timestamp for end of execution
164 164
  @ivar lock_status: In-memory locking information for debugging
165
  @ivar change: a Condition variable we use for waiting for job changes
166 165

  
167 166
  """
168 167
  # pylint: disable-msg=W0212
......
197 196
    # In-memory attributes
198 197
    self.lock_status = None
199 198

  
200
    # Condition to wait for changes
201
    self.change = threading.Condition(self.queue._lock)
202

  
203 199
  def __repr__(self):
204 200
    status = ["%s.%s" % (self.__class__.__module__, self.__class__.__name__),
205 201
              "id=%s" % self.id,
......
237 233
        obj.log_serial = max(obj.log_serial, log_entry[0])
238 234
      obj.ops.append(op)
239 235

  
240
    # Condition to wait for changes
241
    obj.change = threading.Condition(obj.queue._lock)
242

  
243 236
    return obj
244 237

  
245 238
  def Serialize(self):
......
465 458
      self._job.log_serial += 1
466 459
      self._op.log.append((self._job.log_serial, timestamp, log_type, log_msg))
467 460
      self._queue.UpdateJobUnlocked(self._job, replicate=False)
468

  
469
      self._job.change.notifyAll()
470 461
    finally:
471 462
      self._queue.release()
472 463

  
......
1297 1288
    logging.debug("Writing job %s to %s", job.id, filename)
1298 1289
    self._UpdateJobQueueFile(filename, data, replicate)
1299 1290

  
1300
    # Notify waiters about potential changes
1301
    job.change.notifyAll()
1302

  
1303 1291
  def WaitForJobChanges(self, job_id, fields, prev_job_info, prev_log_serial,
1304 1292
                        timeout):
1305 1293
    """Waits for changes in a job.

Also available in: Unified diff