lkgm/sync: Tweak comments/naming.

Just improve readability of the code slightly after trying to read it.

BUG=None
TEST=cbuildbot/run_tests

Change-Id: I9cec3fcacf7c686033e21a0c8aa2278a6711ce2f
Reviewed-on: https://chromium-review.googlesource.com/310543
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/cbuildbot/lkgm_manager.py b/cbuildbot/lkgm_manager.py
index 05e4eb3..5f2d50b 100644
--- a/cbuildbot/lkgm_manager.py
+++ b/cbuildbot/lkgm_manager.py
@@ -326,6 +326,9 @@
       build_id: Optional integer cidb build id of the build publishing the
                 manifest.
 
+    Returns:
+      Path to the manifest version file to use.
+
     Raises:
       GenerateBuildSpecException in case of failure to check-in the new
         manifest because of a git error or the manifest is already checked-in.
diff --git a/cbuildbot/stages/completion_stages.py b/cbuildbot/stages/completion_stages.py
index b77b2f0..e1467d3 100644
--- a/cbuildbot/stages/completion_stages.py
+++ b/cbuildbot/stages/completion_stages.py
@@ -180,8 +180,8 @@
         timeout = 3 * 60
 
       manager = self._run.attrs.manifest_manager
-      if sync_stages.MasterSlaveLKGMSyncStage.sub_manager:
-        manager = sync_stages.MasterSlaveLKGMSyncStage.sub_manager
+      if sync_stages.MasterSlaveLKGMSyncStage.external_manager:
+        manager = sync_stages.MasterSlaveLKGMSyncStage.external_manager
       slave_statuses.update(manager.GetBuildersStatus(
           self._run.attrs.metadata.GetValue('build_id'),
           builder_names,
@@ -221,8 +221,8 @@
         self._run.manifest_branch == 'master' and
         self._run.config.build_type != constants.CHROME_PFQ_TYPE):
       self._run.attrs.manifest_manager.PromoteCandidate()
-      if sync_stages.MasterSlaveLKGMSyncStage.sub_manager:
-        sync_stages.MasterSlaveLKGMSyncStage.sub_manager.PromoteCandidate()
+      if sync_stages.MasterSlaveLKGMSyncStage.external_manager:
+        sync_stages.MasterSlaveLKGMSyncStage.external_manager.PromoteCandidate()
 
   def HandleFailure(self, failing, inflight, no_stat):
     """Handle a build failure.
diff --git a/cbuildbot/stages/sync_stages.py b/cbuildbot/stages/sync_stages.py
index 0f9015e..8eb6ce7 100644
--- a/cbuildbot/stages/sync_stages.py
+++ b/cbuildbot/stages/sync_stages.py
@@ -733,10 +733,9 @@
   This stage uses an LKGM manifest manager that handles LKGM
   candidates and their states.
   """
-
-  # TODO(mtennant): Turn this into self._run.attrs.sub_manager or similar.
-  # An instance of lkgm_manager.LKGMManager for slave builds.
-  sub_manager = None
+  # If we are using an internal manifest, but need to be able to create an
+  # external manifest, we create a second manager for that manifest.
+  external_manager = None
   MAX_BUILD_HISTORY_LENGTH = 10
   MilestoneVersion = collections.namedtuple(
       'MilestoneVersion', ['milestone', 'platform'])
@@ -775,12 +774,13 @@
     self.RegisterManifestManager(self._GetInitializedManager(self.internal))
     if self._run.config.master and self._GetSlaveConfigs():
       assert self.internal, 'Unified masters must use an internal checkout.'
-      MasterSlaveLKGMSyncStage.sub_manager = self._GetInitializedManager(False)
+      MasterSlaveLKGMSyncStage.external_manager = \
+          self._GetInitializedManager(False)
 
   def ForceVersion(self, version):
     manifest = super(MasterSlaveLKGMSyncStage, self).ForceVersion(version)
-    if MasterSlaveLKGMSyncStage.sub_manager:
-      MasterSlaveLKGMSyncStage.sub_manager.BootstrapFromVersion(version)
+    if MasterSlaveLKGMSyncStage.external_manager:
+      MasterSlaveLKGMSyncStage.external_manager.BootstrapFromVersion(version)
 
     return manifest
 
@@ -806,8 +806,8 @@
     manifest = self.manifest_manager.CreateNewCandidate(
         chrome_version=self._chrome_version,
         build_id=build_id)
-    if MasterSlaveLKGMSyncStage.sub_manager:
-      MasterSlaveLKGMSyncStage.sub_manager.CreateFromManifest(
+    if MasterSlaveLKGMSyncStage.external_manager:
+      MasterSlaveLKGMSyncStage.external_manager.CreateFromManifest(
           manifest, build_id=build_id)
 
     return manifest
@@ -981,7 +981,7 @@
       if self._run.options.cq_gerrit_override:
         query = (self._run.options.cq_gerrit_override, None)
 
-      self.pool = pool = validation_pool.ValidationPool.AcquirePool(
+      self.pool = validation_pool.ValidationPool.AcquirePool(
           self._run.config.overlays, self.repo,
           self._run.buildnumber, self._run.GetBuilderName(),
           query,
@@ -1004,10 +1004,10 @@
       db.ExtendDeadline(build_id, timeout)
 
     logging.info('Creating new candidate manifest.')
-    manifest = self.manifest_manager.CreateNewCandidate(validation_pool=pool,
-                                                        build_id=build_id)
-    if MasterSlaveLKGMSyncStage.sub_manager:
-      MasterSlaveLKGMSyncStage.sub_manager.CreateFromManifest(
+    manifest = self.manifest_manager.CreateNewCandidate(
+        validation_pool=self.pool, build_id=build_id)
+    if MasterSlaveLKGMSyncStage.external_manager:
+      MasterSlaveLKGMSyncStage.external_manager.CreateFromManifest(
           manifest, build_id=build_id)
 
     return manifest