diff --git a/lib/jqueue.py b/lib/jqueue.py index 0c276a977ecccd929af80398865dd79bb122fa80..4dd0b53646e8adb34981b97cff39ef816ae2d01a 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -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") diff --git a/test/ganeti.jqueue_unittest.py b/test/ganeti.jqueue_unittest.py index ce065411cdf0c0fa2852cb3c5100ba30fb415408..d573378c6c16bb4c3774a2ca009230bae63e3443 100755 --- a/test/ganeti.jqueue_unittest.py +++ b/test/ganeti.jqueue_unittest.py @@ -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):