Revision e0f2bf1e

b/lib/jqueue.py
222 222
               "received_timestamp", "start_timestamp", "end_timestamp",
223 223
               "__weakref__", "processor_lock", "writable", "archived"]
224 224

  
225
  def _AddReasons(self):
226
    """Extend the reason trail
227

  
228
    Add the reason for all the opcodes of this job to be executed.
229

  
230
    """
231
    count = 0
232
    for queued_op in self.ops:
233
      op = queued_op.input
234
      reason_src = opcodes.NameToReasonSrc(op.__class__.__name__)
235
      reason_text = "job=%d;index=%d" % (self.id, count)
236
      reason = getattr(op, "reason", [])
237
      reason.append((reason_src, reason_text, utils.EpochNano()))
238
      op.reason = reason
239
      count = count + 1
240

  
225 241
  def __init__(self, queue, job_id, ops, writable):
226 242
    """Constructor for the _QueuedJob.
227 243

  
......
242 258
    self.queue = queue
243 259
    self.id = int(job_id)
244 260
    self.ops = [_QueuedOpCode(op) for op in ops]
261
    self._AddReasons()
245 262
    self.log_serial = 0
246 263
    self.received_timestamp = TimeStampNow()
247 264
    self.start_timestamp = None

Also available in: Unified diff