Only append scheduled and important slaves to the scheduled_slaves.

Only save the important slaves in the 'scheduled_slaves' metadata in the
master-paladin. The master-paladin completion stage should just keep
track of the statues of the important slaves.

BUG=chromium:655295
TEST=run_tests

Change-Id: I1e6292bd7bf4a110ac40f475e6a5cec09b421408
Reviewed-on: https://chromium-review.googlesource.com/412049
Commit-Ready: Ningning Xia <nxia@chromium.org>
Tested-by: Ningning Xia <nxia@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/cbuildbot/stages/sync_stages.py b/cbuildbot/stages/sync_stages.py
index fb4f886..1a60479 100644
--- a/cbuildbot/stages/sync_stages.py
+++ b/cbuildbot/stages/sync_stages.py
@@ -566,7 +566,9 @@
         buildbucket_id, created_ts = self.PostSlaveBuildToBuildbucket(
             slave_name, slave_config, build_id, buildset_tag, dryrun)
 
-        scheduled_slave_builds.append((slave_name, buildbucket_id, created_ts))
+        if slave_config.important:
+          scheduled_slave_builds.append(
+              (slave_name, buildbucket_id, created_ts))
       except buildbucket_lib.BuildbucketResponseException as e:
         # Use 16-digit ts to be consistent with the created_ts from Buildbucket
         current_ts = int(round(time.time() * 1000000))
diff --git a/cbuildbot/stages/sync_stages_unittest.py b/cbuildbot/stages/sync_stages_unittest.py
index 1e59c65..31d00fd 100644
--- a/cbuildbot/stages/sync_stages_unittest.py
+++ b/cbuildbot/stages/sync_stages_unittest.py
@@ -491,7 +491,7 @@
     stage.ScheduleSlaveBuildsViaBuildbucket(important_only=False, dryrun=True)
 
     scheduled_slaves = self._run.attrs.metadata.GetValue('scheduled_slaves')
-    self.assertEqual(len(scheduled_slaves), 2)
+    self.assertEqual(len(scheduled_slaves), 1)
     unscheduled_slaves = self._run.attrs.metadata.GetValue('unscheduled_slaves')
     self.assertEqual(len(unscheduled_slaves), 0)