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:37 UTC

[1/7] git commit: Fixed Jenkins slave retention strategy.

Updated Branches:
  refs/heads/master f412ea069 -> 8b70fbadb


Fixed Jenkins slave retention strategy.

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


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

Branch: refs/heads/master
Commit: ae40536d5e7e48dcf3e9c02b79d58784b087c058
Parents: e8108ca
Author: Vinod Kone <vi...@twitter.com>
Authored: Sun Jul 21 00:10:45 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:44 2013 -0700

----------------------------------------------------------------------
 .../plugins/mesos/MesosRetentionStrategy.java   | 49 ++++++++++++--------
 1 file changed, 29 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ae40536d/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java
index e02d3c7..17da814 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java
@@ -1,5 +1,7 @@
 package org.jenkinsci.plugins.mesos;
 
+import static hudson.util.TimeUnit2.MINUTES;
+
 import java.util.logging.Logger;
 
 import org.kohsuke.stapler.DataBoundConstructor;
@@ -9,9 +11,7 @@ import hudson.slaves.RetentionStrategy;
 import hudson.util.TimeUnit2;
 
 /**
- * This is basically a copy of the EC2 plugin's retention strategy.
- * https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson
- * /plugins/ec2/EC2RetentionStrategy.java
+ * This is inspired by {@link hudson.slaves.CloudRetentionStrategy}.
  */
 public class MesosRetentionStrategy extends RetentionStrategy<MesosComputer> {
 
@@ -22,16 +22,15 @@ public class MesosRetentionStrategy extends RetentionStrategy<MesosComputer> {
    */
   public final int idleTerminationMinutes;
 
+  // Since a Mesos task is fast to start/stop we use a default value of 1 min.
+  private final int IDLE_TERMINATION_MINUTES = 1;
+
   private static final Logger LOGGER = Logger
       .getLogger(MesosRetentionStrategy.class.getName());
 
-  public static boolean disabled = Boolean
-      .getBoolean(MesosRetentionStrategy.class.getName() + ".disabled");
-
   @DataBoundConstructor
   public MesosRetentionStrategy(String idleTerminationMinutes) {
-    // Since a Mesos node is fast to start/stop we default this value to 3 mins.
-    int value = 3;
+    int value = IDLE_TERMINATION_MINUTES;
     if (idleTerminationMinutes != null && idleTerminationMinutes.trim() != "") {
       try {
         value = Integer.parseInt(idleTerminationMinutes);
@@ -45,23 +44,33 @@ public class MesosRetentionStrategy extends RetentionStrategy<MesosComputer> {
 
   @Override
   public synchronized long check(MesosComputer c) {
-    // If we've been told never to terminate, then we're done.
-    if (idleTerminationMinutes == 0)
+    if (c.getNode() == null) {
       return 1;
+    }
 
-    final long idleMilliseconds1 = System.currentTimeMillis()
-        - c.getIdleStartMilliseconds();
+    // If we just launched this computer, check back after 1 min.
+    // NOTE: 'c.getConnectTime()' refers to when the Jenkins slave was launched.
+    if ((System.currentTimeMillis() - c.getConnectTime()) <
+        MINUTES.toMillis(idleTerminationMinutes)) {
+      return 1;
+    }
 
-    System.out.println(c.getName() + " idle: " + idleMilliseconds1);
+    // If the computer is offline, terminate it.
+    if (c.isOffline()) {
+      LOGGER.info("Disconnecting offline computer " + c.getName());
+      c.getNode().terminate();
+      return 1;
+    }
 
-    if (c.isIdle() && c.isOnline() && !disabled) {
-      final long idleMilliseconds = System.currentTimeMillis()
-          - c.getIdleStartMilliseconds();
+    // Terminate the computer if it is idle for longer than
+    // 'idleTerminationMinutes'.
+    if (c.isIdle()) {
+      final long idleMilliseconds =
+          System.currentTimeMillis() - c.getIdleStartMilliseconds();
 
-      if (idleMilliseconds > TimeUnit2.MINUTES.toMillis(idleTerminationMinutes)) {
-        LOGGER.info("Idle timeout after " + idleTerminationMinutes + "mins: "
-            + c.getName());
-        c.getNode().idleTimeout();
+      if (idleMilliseconds > MINUTES.toMillis(idleTerminationMinutes)) {
+        LOGGER.info("Disconnecting idle computer " + c.getName());
+        c.getNode().terminate();
       }
     }
     return 1;


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

Posted by vi...@apache.org.
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() {


[4/7] git commit: Fixed a log line to show the path of launcher in process isolator.

Posted by vi...@apache.org.
Fixed a log line to show the path of launcher in process isolator.

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


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

Branch: refs/heads/master
Commit: e8108ca8d34f3002b82cd0ea3322ab89c1ee3ef3
Parents: 468ab99
Author: Vinod Kone <vi...@twitter.com>
Authored: Sat Jul 20 22:21:03 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:44 2013 -0700

----------------------------------------------------------------------
 src/slave/process_isolator.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e8108ca8/src/slave/process_isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/process_isolator.cpp b/src/slave/process_isolator.cpp
index 4b65b35..cd794f6 100644
--- a/src/slave/process_isolator.cpp
+++ b/src/slave/process_isolator.cpp
@@ -216,7 +216,9 @@ void ProcessIsolator::launchExecutor(
 
     if (realpath.isError()) {
       EXIT(1) << "Failed to determine the canonical path "
-              << "for the mesos-launcher: " << realpath.error();
+              << "for the mesos-launcher '"
+              << path::join(flags.launcher_dir, "mesos-launcher")
+              << "': " << realpath.error();
     }
 
     // Grab a copy of the path so that we can reliably use 'c_str()'.


[7/7] git commit: Killed unused Task Template in Jenkins.

Posted by vi...@apache.org.
Killed unused Task Template in Jenkins.

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


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

Branch: refs/heads/master
Commit: 8b70fbadbe7c182739eaebf229aaa76e4e9e7dd1
Parents: c1ede59
Author: Vinod Kone <vi...@twitter.com>
Authored: Sun Jul 21 21:39:54 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:45 2013 -0700

----------------------------------------------------------------------
 jenkins/Makefile.am                             |  4 +-
 .../jenkinsci/plugins/mesos/TaskTemplate.java   | 39 --------------------
 .../plugins/mesos/TaskTemplate/config.jelly     | 33 -----------------
 3 files changed, 1 insertion(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8b70fbad/jenkins/Makefile.am
----------------------------------------------------------------------
diff --git a/jenkins/Makefile.am b/jenkins/Makefile.am
index b5be92d..30f3ac5 100644
--- a/jenkins/Makefile.am
+++ b/jenkins/Makefile.am
@@ -22,13 +22,11 @@ EXTRA_DIST = pom.xml										\
 	src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java			\
 	src/main/java/org/jenkinsci/plugins/mesos/MesosRetentionStrategy.java			\
 	src/main/java/org/jenkinsci/plugins/mesos/MesosSlave.java				\
-	src/main/java/org/jenkinsci/plugins/mesos/TaskTemplate.java				\
 	src/main/resources/index.jelly								\
 	src/main/resources/org/jenkinsci/plugins/mesos/MesosCloud/computerSet.jelly		\
 	src/main/resources/org/jenkinsci/plugins/mesos/MesosCloud/config.jelly			\
 	src/main/resources/org/jenkinsci/plugins/mesos/MesosCloud/help-master.html		\
-	src/main/resources/org/jenkinsci/plugins/mesos/MesosSlave/configure-entries.jelly	\
-	src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
+	src/main/resources/org/jenkinsci/plugins/mesos/MesosSlave/configure-entries.jelly
 
 
 if OS_LINUX

http://git-wip-us.apache.org/repos/asf/mesos/blob/8b70fbad/jenkins/src/main/java/org/jenkinsci/plugins/mesos/TaskTemplate.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/TaskTemplate.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/TaskTemplate.java
deleted file mode 100644
index ff42b9f..0000000
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/TaskTemplate.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.jenkinsci.plugins.mesos;
-
-import org.kohsuke.stapler.DataBoundConstructor;
-
-import hudson.Extension;
-import hudson.model.Describable;
-import hudson.model.Descriptor;
-import hudson.model.Hudson;
-
-public class TaskTemplate implements Describable<TaskTemplate> {
-  public final String description;
-  public final String label;
-  public final String idleTerminationMinutes;
-  public final String numExecutors;
-  public final String executorMem;
-  public final String slaveJarMem;
-
-  @DataBoundConstructor
-  public TaskTemplate(String description, String label, String idleTerminationMinutes, String numExecutors, String executorMem, String slaveJarMem) {
-    this.description = description;
-    this.label = label;
-    this.idleTerminationMinutes = idleTerminationMinutes;
-    this.numExecutors = numExecutors;
-    this.executorMem = executorMem;
-    this.slaveJarMem = slaveJarMem;
-  }
-
-  @Override
-  public Descriptor<TaskTemplate> getDescriptor() {
-    return Hudson.getInstance().getDescriptor(getClass());
-  }
-
-  @Extension
-  public static final class DescriptorImpl extends Descriptor<TaskTemplate> {
-    @Override public String getDisplayName() {
-      return null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/mesos/blob/8b70fbad/jenkins/src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
----------------------------------------------------------------------
diff --git a/jenkins/src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly b/jenkins/src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
deleted file mode 100644
index e131673..0000000
--- a/jenkins/src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
+++ /dev/null
@@ -1,33 +0,0 @@
-<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" >
-  <table width="100%">
-
-    <f:entry title="Description" field="description">
-      <f:textbox />
-    </f:entry>
-
-    <f:entry title="Label" field="label">
-      <f:textbox />
-    </f:entry>
-
-    <f:advanced>
-
-      <f:entry title="Idle Termination Time (min)" field="idleTerminationMinutes">
-        <f:textbox default="30" />
-      </f:entry>
-
-      <f:entry title="Number of Jenkins Executors Per Mesos Task" field="numExecutors">
-        <f:textbox />
-      </f:entry>
-
-      <f:entry title="Executor Mem (MB)" field="executorMem">
-        <f:textbox />
-      </f:entry>
-
-      <f:entry title="Slave JVM Max Heap (MB)" field="slaveJarMem">
-        <f:textbox/>
-      </f:entry>
-
-    </f:advanced>
-
-  </table>
-</j:jelly>


[3/7] git commit: Fixed Mesos and Protobuf jar targets to build to java6.

Posted by vi...@apache.org.
Fixed Mesos and Protobuf jar targets to build to java6.

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


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

Branch: refs/heads/master
Commit: 3309e51e3fbe3101c4471eca3fa710c43c4364c0
Parents: f412ea0
Author: Vinod Kone <vi...@twitter.com>
Authored: Fri Jul 19 16:38:22 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:44 2013 -0700

----------------------------------------------------------------------
 src/Makefile.am | 152 +++++++++++++++++++++++++--------------------------
 1 file changed, 76 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3309e51e/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index d997347..15a9c40 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -156,9 +156,9 @@ $(PYTHON_PROTOS): $(MESOS_PROTO)
 # libraries themselves.
 noinst_LTLIBRARIES += libmesos_no_3rdparty.la
 
-nodist_libmesos_no_3rdparty_la_SOURCES = 	\
-  $(CXX_PROTOS) 				\
-  $(MESSAGES_PROTOS) 				\
+nodist_libmesos_no_3rdparty_la_SOURCES =				\
+  $(CXX_PROTOS)								\
+  $(MESSAGES_PROTOS)							\
   $(REGISTRY_PROTOS)
 
 libmesos_no_3rdparty_la_SOURCES =					\
@@ -257,8 +257,8 @@ libbuild_la_CPPFLAGS += -DBUILD_TIME="\"$$(date '+%s')\""
 libbuild_la_CPPFLAGS += -DBUILD_USER="\"$$USER\""
 
 # We need to escape the build flags properly.
-BUILD_FLAGS = $(echo $(MESOS_CPPFLAGS) $(CPPFLAGS) | sed 's/\"/\\\"/g') \
-              $(echo $(AM_CFLAGS) $(CFLAGS) | sed 's/\"/\\\"/g') \
+BUILD_FLAGS = $(echo $(MESOS_CPPFLAGS) $(CPPFLAGS) | sed 's/\"/\\\"/g')	\
+              $(echo $(AM_CFLAGS) $(CFLAGS) | sed 's/\"/\\\"/g')	\
               $(echo $(AM_CXXFLAGS) $(CXXFLAGS) | sed 's/\"/\\\"/g')
 
 # TODO(benh): Provide other build flags.
@@ -284,13 +284,13 @@ libmesos_no_3rdparty_la_LIBADD += liblog.la
 # include the leveldb headers.
 noinst_LTLIBRARIES += libstate.la
 libstate_la_SOURCES = state/leveldb.cpp state/zookeeper.cpp
-libstate_la_SOURCES += 			\
-  state/leveldb.hpp			\
-  state/protobuf.hpp			\
-  state/state.hpp 			\
-  state/storage.hpp 			\
-  state/zookeeper.hpp 			\
-  messages/state.hpp			\
+libstate_la_SOURCES +=							\
+  state/leveldb.hpp							\
+  state/protobuf.hpp							\
+  state/state.hpp							\
+  state/storage.hpp							\
+  state/zookeeper.hpp							\
+  messages/state.hpp							\
   messages/state.proto
 nodist_libstate_la_SOURCES = $(STATE_PROTOS)
 libstate_la_CPPFLAGS = -I../$(LEVELDB)/include $(MESOS_CPPFLAGS)
@@ -367,8 +367,8 @@ mesos_mesos_LDADD = libmesos.la
 
 # Need to distribute/install webui javascript.
 nobase_dist_webui_DATA +=						\
-  webui/master/static/js/controllers.js				\
-  webui/master/static/js/app.js					\
+  webui/master/static/js/controllers.js					\
+  webui/master/static/js/app.js						\
   webui/master/static/js/dashboard.js					\
   webui/master/static/js/jquery.pailer.js
 
@@ -405,7 +405,7 @@ nobase_dist_webui_DATA +=						\
   webui/master/static/js/angular-1.0.7.js				\
   webui/master/static/js/angular-1.0.7.min.js				\
   webui/master/static/js/ui-bootstrap-tpls-0.4.0.js			\
-  webui/master/static/js/ui-bootstrap-tpls-0.4.0.min.js		\
+  webui/master/static/js/ui-bootstrap-tpls-0.4.0.min.js			\
   webui/master/static/js/underscore-1.4.3.js				\
   webui/master/static/js/underscore-1.4.3.min.js			\
   webui/master/static/js/cubism.v1.js					\
@@ -415,24 +415,24 @@ nobase_dist_webui_DATA +=						\
   webui/master/static/js/jquery-1.7.1.js				\
   webui/master/static/js/jquery-1.7.1.min.js				\
   webui/master/static/js/relative-date.js				\
-  webui/master/static/js/zeroclipboard-1.1.7.js			\
+  webui/master/static/js/zeroclipboard-1.1.7.js				\
   webui/master/static/js/zeroclipboard-1.1.7.min.js			\
   webui/master/static/obj/zeroclipboard-1.1.7.swf
 
 # And the deploy related stuff.
-nodist_sbin_SCRIPTS += deploy/mesos-daemon.sh			\
-  deploy/mesos-start-cluster.sh deploy/mesos-start-masters.sh	\
-  deploy/mesos-start-slaves.sh deploy/mesos-stop-cluster.sh	\
+nodist_sbin_SCRIPTS += deploy/mesos-daemon.sh				\
+  deploy/mesos-start-cluster.sh deploy/mesos-start-masters.sh		\
+  deploy/mesos-start-slaves.sh deploy/mesos-stop-cluster.sh		\
   deploy/mesos-stop-masters.sh deploy/mesos-stop-slaves.sh
 
-nobase_pkglocalstate_DATA += deploy/mesos-deploy-env.sh.template \
-                             deploy/mesos-master-env.sh.template \
+nobase_pkglocalstate_DATA += deploy/mesos-deploy-env.sh.template	\
+                             deploy/mesos-master-env.sh.template	\
                              deploy/mesos-slave-env.sh.template
 
 # Need to explicitly add this because by default DATA files are not
 # included in distributions.
-EXTRA_DIST += deploy/mesos-deploy-env.sh.template \
-              deploy/mesos-master-env.sh.template \
+EXTRA_DIST += deploy/mesos-deploy-env.sh.template			\
+              deploy/mesos-master-env.sh.template			\
               deploy/mesos-slave-env.sh.template
 
 # Java related files are listed outside if HAS_JAVA so we can add them
@@ -475,12 +475,12 @@ PROTOBUF_JAR = ../protobuf-$(PROTOBUF_VERSION).jar
 $(PROTOBUF_JAR): # TODO(charles): Specify dependencies for the jar.
 	@echo "Building protobuf-$(PROTOBUF_VERSION).jar ..."
 	$(MKDIR_P) ../$(PROTOBUF)/java/src/main/java
-	$(PROTOC) --java_out=../$(PROTOBUF)/java/src/main/java \
-          -I../$(PROTOBUF)/src \
+	$(PROTOC) --java_out=../$(PROTOBUF)/java/src/main/java		\
+          -I../$(PROTOBUF)/src						\
           ../$(PROTOBUF)/src/google/protobuf/descriptor.proto
-	$(JAVA_HOME)/bin/javac \
-          -d ../$(PROTOBUF)/java/src/main/java \
-          ../$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java \
+	$(JAVA_HOME)/bin/javac -source 1.6 -target 1.6			\
+          -d ../$(PROTOBUF)/java/src/main/java				\
+          ../$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java	\
           ../$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java
 	$(JAVA_HOME)/bin/jar cf $@ -C ../$(PROTOBUF)/java/src/main/java com
 
@@ -491,8 +491,8 @@ $(MESOS_JAR): $(MESOS_JAR_SOURCE) $(MESOS_JAR_GENERATED) $(PROTOBUF_JAR)
 	@echo "Building mesos-$(PACKAGE_VERSION).jar ..."
 	-rm -rf java/classes/org/apache/mesos
 	$(MKDIR_P) java/classes/org/apache/mesos
-	$(JAVA_HOME)/bin/javac \
-          -cp $(PROTOBUF_JAR) \
+	$(JAVA_HOME)/bin/javac -source 1.6 -target 1.6			\
+          -cp $(PROTOBUF_JAR)						\
           -d java/classes $(MESOS_JAR_SOURCE) $(MESOS_JAR_GENERATED)
 	$(JAVA_HOME)/bin/jar cf $@ -C java/classes org
 
@@ -556,11 +556,11 @@ libmesos_la_LIBADD += $(JAVA_LDFLAGS)
 # that should not matter as libjava.la is just a convenience library
 # and should not get exposed.
 
-nodist_libjava_la_SOURCES =					\
-	java/jni/org_apache_mesos_MesosSchedulerDriver.h	\
-	java/jni/org_apache_mesos_MesosExecutorDriver.h		\
-	java/jni/org_apache_mesos_Log.h				\
-	java/jni/org_apache_mesos_state_Variable.h		\
+nodist_libjava_la_SOURCES =						\
+	java/jni/org_apache_mesos_MesosSchedulerDriver.h		\
+	java/jni/org_apache_mesos_MesosExecutorDriver.h			\
+	java/jni/org_apache_mesos_Log.h					\
+	java/jni/org_apache_mesos_state_Variable.h			\
 	java/jni/org_apache_mesos_state_ZooKeeperState.h
 
 BUILT_SOURCES += java/jni/org_apache_mesos_MesosSchedulerDriver.h	\
@@ -571,32 +571,32 @@ BUILT_SOURCES += java/jni/org_apache_mesos_MesosSchedulerDriver.h	\
 
 
 java/jni/org_apache_mesos_MesosSchedulerDriver.h: $(MESOS_JAR)
-	$(JAVA_HOME)/bin/javah -d java/jni -classpath	\
-          $(PROTOBUF_JAR):java/classes			\
+	$(JAVA_HOME)/bin/javah -d java/jni -classpath			\
+          $(PROTOBUF_JAR):java/classes					\
           org.apache.mesos.MesosSchedulerDriver
 
 java/jni/org_apache_mesos_MesosExecutorDriver.h: $(MESOS_JAR)
-	$(JAVA_HOME)/bin/javah -d java/jni -classpath	\
-          $(PROTOBUF_JAR):java/classes			\
+	$(JAVA_HOME)/bin/javah -d java/jni -classpath			\
+          $(PROTOBUF_JAR):java/classes					\
           org.apache.mesos.MesosExecutorDriver
 
 java/jni/org_apache_mesos_Log.h: $(MESOS_JAR)
-	$(JAVA_HOME)/bin/javah -d java/jni -classpath		\
+	$(JAVA_HOME)/bin/javah -d java/jni -classpath			\
           $(PROTOBUF_JAR):java/classes org.apache.mesos.Log
 
 java/jni/org_apache_mesos_state_Variable.h: $(MESOS_JAR)
-	$(JAVA_HOME)/bin/javah -d java/jni -classpath		\
+	$(JAVA_HOME)/bin/javah -d java/jni -classpath			\
           $(PROTOBUF_JAR):java/classes org.apache.mesos.state.Variable
 
 java/jni/org_apache_mesos_state_ZooKeeperState.h: $(MESOS_JAR)
-	$(JAVA_HOME)/bin/javah -d java/jni -classpath		\
+	$(JAVA_HOME)/bin/javah -d java/jni -classpath			\
           $(PROTOBUF_JAR):java/classes org.apache.mesos.state.ZooKeeperState
 
 $(EXAMPLES_JAR): $(EXAMPLES_SOURCE)
 	@echo "Building examples.jar ..."
 	$(MKDIR_P) examples/java
-	$(JAVA_HOME)/bin/javac -cp					\
-          $(PROTOBUF_JAR):$(MESOS_JAR):$(srcdir)/examples/java		\
+	$(JAVA_HOME)/bin/javac -source 1.6 -target 1.6			\
+          -cp $(PROTOBUF_JAR):$(MESOS_JAR):$(srcdir)/examples/java	\
           -sourcepath $(srcdir)/examples/java -d examples/java	        \
           $(srcdir)/examples/java/*.java
 	$(JAVA_HOME)/bin/jar cf $@ -C examples/java .
@@ -604,7 +604,7 @@ $(EXAMPLES_JAR): $(EXAMPLES_SOURCE)
 CLEANFILES += $(EXAMPLES_JAR)
 
 maven-install: $(MESOS_JAR) $(MESOS_SOURCES_JAR) java/mesos.pom
-	mvn install:install-file -Dfile=$(MESOS_JAR)	\
+	mvn install:install-file -Dfile=$(MESOS_JAR)			\
           -Dsources=$(MESOS_SOURCES_JAR) -DpomFile=java/mesos.pom
 
 PHONY_TARGETS += maven-install
@@ -623,15 +623,15 @@ PHONY_TARGETS += clean-java
 
 # Python files listed outside HAS_PYTHON so they are included with the
 # distribution unconditionally.
-EXTRA_DIST += python/src/mesos.py				\
-	      python/native/mesos_executor_driver_impl.cpp	\
-	      python/native/mesos_executor_driver_impl.hpp	\
-	      python/native/mesos_scheduler_driver_impl.cpp	\
-	      python/native/mesos_scheduler_driver_impl.hpp	\
-	      python/native/module.cpp python/native/module.hpp	\
-	      python/native/proxy_executor.cpp			\
-	      python/native/proxy_executor.hpp			\
-	      python/native/proxy_scheduler.cpp			\
+EXTRA_DIST += python/src/mesos.py					\
+	      python/native/mesos_executor_driver_impl.cpp		\
+	      python/native/mesos_executor_driver_impl.hpp		\
+	      python/native/mesos_scheduler_driver_impl.cpp		\
+	      python/native/mesos_scheduler_driver_impl.hpp		\
+	      python/native/module.cpp python/native/module.hpp		\
+	      python/native/proxy_executor.cpp				\
+	      python/native/proxy_executor.hpp				\
+	      python/native/proxy_scheduler.cpp				\
 	      python/native/proxy_scheduler.hpp
 
 if HAS_PYTHON
@@ -668,15 +668,15 @@ CLEANFILES += $(PROTOBUF_EGG)
 
 MESOS_EGG = python/dist/mesos-$(PACKAGE_VERSION)$(PYTHON_EGG_POSTFIX).egg
 
-$(MESOS_EGG): python/setup.py $(srcdir)/python/src/mesos.py	\
-              $(PYTHON_PROTOS) libmesos_no_3rdparty.la	\
+$(MESOS_EGG): python/setup.py $(srcdir)/python/src/mesos.py		\
+              $(PYTHON_PROTOS) libmesos_no_3rdparty.la			\
               $(PROTOBUF_EGG)
 	@echo "Building Mesos Python egg ..."
-	@if test "$(top_srcdir)" != "$(top_builddir)"; then \
-	  $(MKDIR_P) python/src; \
-	  cp -pf $(srcdir)/python/src/mesos.py python/src; \
+	@if test "$(top_srcdir)" != "$(top_builddir)"; then		\
+	  $(MKDIR_P) python/src;					\
+	  cp -pf $(srcdir)/python/src/mesos.py python/src;		\
 	fi
-	@LIBS="$(LIBS)" PYTHONPATH=$(DISTRIBUTE_EGG) \
+	@LIBS="$(LIBS)" PYTHONPATH=$(DISTRIBUTE_EGG)			\
 	  $(PYTHON) python/setup.py bdist_egg
 
 CLEANFILES += $(MESOS_EGG) python/build/temp.*/native/*.o python/build/lib.*/*
@@ -693,8 +693,8 @@ endif # HAS_PYTHON
 # We remove mesos-*.egg here to make sure any older versions of the
 # egg or versions for different architectures are removed.
 clean-python:
-	test "$(top_srcdir)" = "$(top_builddir)" || \
-	  (chmod -R u+w python/native; \
+	test "$(top_srcdir)" = "$(top_builddir)" ||			\
+	  (chmod -R u+w python/native;					\
 	   rm -rf python/src/mesos.py python/native)
 	-rm -rf python/src/mesos.egg-info python/build
 	-rm -f python/dist/mesos-*.egg
@@ -784,10 +784,10 @@ if OS_LINUX
 endif
 
 if HAS_JAVA
-  mesos_tests_SOURCES += tests/zookeeper.cpp			\
-                         tests/zookeeper_test_server.cpp	\
-                         tests/zookeeper_tests.cpp		\
-                         tests/group_tests.cpp			\
+  mesos_tests_SOURCES += tests/zookeeper.cpp				\
+                         tests/zookeeper_test_server.cpp		\
+                         tests/zookeeper_tests.cpp			\
+                         tests/group_tests.cpp				\
                          tests/allocator_zookeeper_tests.cpp
   mesos_tests_CPPFLAGS += $(JAVA_CPPFLAGS)
   mesos_tests_CPPFLAGS += -DZOOKEEPER_VERSION=\"$(ZOOKEEPER_VERSION)\"
@@ -806,25 +806,25 @@ endif
 if HAS_PYTHON
   mesos_tests_DEPENDENCIES += $(MESOS_EGG)
 
-  EXAMPLESCRIPTSPYTHON = examples/python/test_framework.py	\
-			 examples/python/test-framework		\
-			 examples/python/test_executor.py	\
+  EXAMPLESCRIPTSPYTHON = examples/python/test_framework.py		\
+			 examples/python/test-framework			\
+			 examples/python/test_executor.py		\
 			 examples/python/test-executor
 
   check_SCRIPTS += $(EXAMPLESCRIPTSPYTHON)
   mesos_tests_DEPENDENCIES += $(EXAMPLESCRIPTSPYTHON)
 endif
 
-EXTRA_DIST += examples/python/test_framework.py \
+EXTRA_DIST += examples/python/test_framework.py				\
 	      examples/python/test_executor.py
 
 
-dist_check_SCRIPTS +=				\
-  tests/balloon_framework_test.sh		\
-  tests/test_framework_test.sh			\
-  tests/no_executor_framework_test.sh		\
-  tests/java_exception_test.sh			\
-  tests/java_framework_test.sh			\
+dist_check_SCRIPTS +=							\
+  tests/balloon_framework_test.sh					\
+  tests/test_framework_test.sh						\
+  tests/no_executor_framework_test.sh					\
+  tests/java_exception_test.sh						\
+  tests/java_framework_test.sh						\
   tests/python_framework_test.sh
 
 # We use a check-local target for now to avoid the parallel test


[6/7] git commit: Fixed Jenkins to not launch slaves when the scheduler is not running.

Posted by vi...@apache.org.
Fixed Jenkins to not launch slaves when the scheduler is not running.

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


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

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

----------------------------------------------------------------------
 .../jenkinsci/plugins/mesos/MesosComputerLauncher.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c1ede593/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java
index dc3bf8e..ca66ab8 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/MesosComputerLauncher.java
@@ -43,6 +43,17 @@ public class MesosComputerLauncher extends ComputerLauncher {
     // Get a handle to mesos.
     Mesos mesos = Mesos.getInstance();
 
+    // If Jenkins scheduler is not running, terminate the node.
+    // This might happen if the computer was offline when Jenkins was shutdown.
+    // Since Jenkins persists its state, it tries to launch offline slaves when
+    // it restarts.
+    if (!mesos.isSchedulerRunning()) {
+      LOGGER.warning("Not launching " + name +
+                     " because the Mesos Jenkins scheduler is not running");
+      computer.getNode().terminate();
+      return;
+    }
+
     // Create the request.
     int numExecutors = computer.getNode().getNumExecutors();
     Mesos.SlaveRequest request = new Mesos.SlaveRequest(new JenkinsSlave(name), numExecutors);


[2/7] git commit: Fixed Jenkins Scheduler to use the correct plugin resources path.

Posted by vi...@apache.org.
Fixed Jenkins Scheduler to use the correct plugin resources path.

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


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

Branch: refs/heads/master
Commit: 468ab993a547ab72c411adc0ce6716ea8b5c1e46
Parents: 3309e51
Author: Vinod Kone <vi...@twitter.com>
Authored: Fri Jul 19 17:29:15 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Mon Jul 22 21:50:44 2013 -0700

----------------------------------------------------------------------
 .../org/jenkinsci/plugins/mesos/JenkinsScheduler.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/468ab993/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
index b6892c0..ce33d57 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
@@ -1,5 +1,7 @@
 package org.jenkinsci.plugins.mesos;
 
+import java.net.URL;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -66,12 +68,12 @@ public class JenkinsScheduler implements Scheduler {
     // TODO(vinod): Instead of loading the library here, it would
     // be great if the plugin can dynamically set the MESOS_NATIVE_LIBRARY
     // environment variable or java.library.path system property.
-    final String PLUGIN_DIR =
-        Jenkins.getInstance().getRootDir().getPath() + "/plugins/mesos";
+    final URL resourceURL =
+        Jenkins.getInstance().getPlugin("mesos").getWrapper().baseResourceURL;
 
-    String MESOS_NATIVE_LIBRARY = PLUGIN_DIR + "/libmesos.so";
+    String MESOS_NATIVE_LIBRARY = resourceURL.getPath() + "libmesos.so";
     if (System.getProperty("os.name").indexOf("Mac") >= 0) {
-      MESOS_NATIVE_LIBRARY = PLUGIN_DIR + "/libmesos.dylib";
+      MESOS_NATIVE_LIBRARY = resourceURL.getPath() + "libmesos.dylib";
     }
 
     MesosNativeLibrary.load(MESOS_NATIVE_LIBRARY);