Revision d25c1d6a
b/lib/jqueue.py | ||
---|---|---|
145 | 145 |
@ivar id: the job ID |
146 | 146 |
@type ops: list |
147 | 147 |
@ivar ops: the list of _QueuedOpCode that constitute the job |
148 |
@type run_op_index: int |
|
149 |
@ivar run_op_index: the currently executing opcode, or -1 if |
|
150 |
we didn't yet start executing |
|
151 | 148 |
@type log_serial: int |
152 | 149 |
@ivar log_serial: holds the index for the next log entry |
153 | 150 |
@ivar received_timestamp: the timestamp for when the job was received |
... | ... | |
157 | 154 |
@ivar change: a Condition variable we use for waiting for job changes |
158 | 155 |
|
159 | 156 |
""" |
160 |
__slots__ = ["queue", "id", "ops", "run_op_index", "log_serial",
|
|
157 |
__slots__ = ["queue", "id", "ops", "log_serial", |
|
161 | 158 |
"received_timestamp", "start_timestamp", "end_timestamp", |
162 | 159 |
"lock_status", "change", |
163 | 160 |
"__weakref__"] |
... | ... | |
181 | 178 |
self.queue = queue |
182 | 179 |
self.id = job_id |
183 | 180 |
self.ops = [_QueuedOpCode(op) for op in ops] |
184 |
self.run_op_index = -1 |
|
185 | 181 |
self.log_serial = 0 |
186 | 182 |
self.received_timestamp = TimeStampNow() |
187 | 183 |
self.start_timestamp = None |
... | ... | |
208 | 204 |
obj = _QueuedJob.__new__(cls) |
209 | 205 |
obj.queue = queue |
210 | 206 |
obj.id = state["id"] |
211 |
obj.run_op_index = state["run_op_index"] |
|
212 | 207 |
obj.received_timestamp = state.get("received_timestamp", None) |
213 | 208 |
obj.start_timestamp = state.get("start_timestamp", None) |
214 | 209 |
obj.end_timestamp = state.get("end_timestamp", None) |
... | ... | |
239 | 234 |
return { |
240 | 235 |
"id": self.id, |
241 | 236 |
"ops": [op.Serialize() for op in self.ops], |
242 |
"run_op_index": self.run_op_index, |
|
243 | 237 |
"start_timestamp": self.start_timestamp, |
244 | 238 |
"end_timestamp": self.end_timestamp, |
245 | 239 |
"received_timestamp": self.received_timestamp, |
... | ... | |
462 | 456 |
if op.status == constants.OP_STATUS_CANCELED: |
463 | 457 |
raise CancelJob() |
464 | 458 |
assert op.status == constants.OP_STATUS_QUEUED |
465 |
job.run_op_index = idx |
|
466 | 459 |
op.status = constants.OP_STATUS_WAITLOCK |
467 | 460 |
op.result = None |
468 | 461 |
op.start_timestamp = TimeStampNow() |
... | ... | |
525 | 518 |
try: |
526 | 519 |
try: |
527 | 520 |
job.lock_status = None |
528 |
job.run_op_index = -1 |
|
529 | 521 |
job.end_timestamp = TimeStampNow() |
530 | 522 |
queue.UpdateJobUnlocked(job) |
531 | 523 |
finally: |
Also available in: Unified diff