jqueue: Rename current_op to better reflect what it actually is
authorMichael Hanselmann <hansmi@google.com>
Mon, 20 Sep 2010 17:30:19 +0000 (19:30 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 23 Sep 2010 09:07:24 +0000 (11:07 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/jqueue.py
test/ganeti.jqueue_unittest.py

index 0c276a9..4dd0b53 100644 (file)
@@ -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")
 
index ce06541..d573378 100755 (executable)
@@ -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):