Commit 03b63608 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

jqueue: Rename current_op to better reflect what it actually is


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent fa4aa6b4
......@@ -176,7 +176,7 @@ class _QueuedJob(object):
"""
# pylint: disable-msg=W0212
__slots__ = ["queue", "id", "ops", "log_serial", "current_op",
__slots__ = ["queue", "id", "ops", "log_serial", "ops_iter",
"received_timestamp", "start_timestamp", "end_timestamp",
"__weakref__"]
......@@ -210,7 +210,7 @@ class _QueuedJob(object):
"""Initializes in-memory variables.
"""
obj.current_op = None
obj.ops_iter = None
def __repr__(self):
status = ["%s.%s" % (self.__class__.__module__, self.__class__.__name__),
......@@ -766,13 +766,13 @@ class _JobProcessor(object):
# lookups
# TODO: Consider splitting _QueuedJob.ops into two separate lists, one for
# pending and one for processed ops.
if job.current_op is None:
job.current_op = enumerate(job.ops)
if job.ops_iter is None:
job.ops_iter = enumerate(job.ops)
# Find next opcode to run
while True:
try:
(idx, op) = job.current_op.next()
(idx, op) = job.ops_iter.next()
except StopIteration:
raise errors.ProgrammerError("Called for a finished job")
......
......@@ -756,11 +756,11 @@ class TestJobProcessor(unittest.TestCase):
[constants.OP_STATUS_QUEUED
for _ in range(len(ops) - successcount)]])
self.assert_(job.current_op)
self.assert_(job.ops_iter)
# Serialize and restore (simulates program restart)
newjob = jqueue._QueuedJob.Restore(queue, job.Serialize())
self.assertFalse(newjob.current_op)
self.assertFalse(newjob.ops_iter)
self._TestPartial(newjob, successcount)
def _TestPartial(self, job, successcount):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment