You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/07/23 06:51:41 UTC

[5/7] git commit: Fixed Jenkins to only launch a slave when the label matches "mesos".

Fixed Jenkins to only launch a slave when the label matches "mesos".

Review: https://reviews.apache.org/r/12799


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/14283f11
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/14283f11
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/14283f11

Branch: refs/heads/master
Commit: 14283f114332ec2d8e005e3e2cefd10c9908f18d
Parents: ae40536
Author: Vinod Kone <vi...@twitter.com>
Authored: Sun Jul 21 01:12:43 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:45 2013 -0700

----------------------------------------------------------------------
 .../org/jenkinsci/plugins/mesos/MesosCloud.java     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/14283f11/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosCloud.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosCloud.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosCloud.java
index 340f75f..63f218b 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosCloud.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosCloud.java
@@ -39,7 +39,7 @@ public class MesosCloud extends Cloud {
 
   private String master;
   private String description;
-
+  private String labelString = "mesos";
   private static String staticMaster;
 
   private static final Logger LOGGER = Logger.getLogger(MesosCloud.class.getName());
@@ -108,11 +108,10 @@ public class MesosCloud extends Cloud {
   }
 
   private MesosSlave doProvision(int numExecutors) throws Descriptor.FormException, IOException {
-    String name = "mesos-" + UUID.randomUUID().toString();
-    String nodeDescription = "mesos";
+    String name = "mesos-jenkins-" + UUID.randomUUID().toString();
+    String nodeDescription = labelString;
     String remoteFS = "jenkins";
     Mode mode = Mode.NORMAL;
-    String labelString = "mesos";
     List<? extends NodeProperty<?>> nodeProperties = null;
 
     return new MesosSlave(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
@@ -122,10 +121,11 @@ public class MesosCloud extends Cloud {
   @Override
   public boolean canProvision(Label label) {
     // Provisioning is simply creating a task for a jenkins slave.
-    // Therefore, we can always provision, however the framework may
-    // not have the resources necessary to start a task when it comes
-    // time to launch the slave.
-    return true;
+    // Therefore, we can always provision as long as the label
+    // matches "mesos".
+    // TODO(vinod): The framework may not have the resources necessary
+    // to start a task when it comes time to launch the slave.
+    return label.matches(Label.parse(labelString));
   }
 
   public String getMaster() {