mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1233580 [2/3] - in /incubator/mesos/trunk: ./ bin/ include/mesos/ m4/ src/ src/common/ src/config/ src/detector/ src/examples/ src/examples/java/ src/examples/python/ src/exec/ src/java/ src/java/src/org/apache/mesos/ src/jvm/ src/launcher...
Date Thu, 19 Jan 2012 21:34:05 GMT
Modified: incubator/mesos/trunk/src/detector/detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/detector/detector.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/detector/detector.cpp (original)
+++ incubator/mesos/trunk/src/detector/detector.cpp Thu Jan 19 21:34:02 2012
@@ -29,15 +29,13 @@
 #include "common/fatal.hpp"
 #include "common/foreach.hpp"
 
-#ifdef WITH_ZOOKEEPER
-#include "zookeeper/zookeeper.hpp"
-#include "zookeeper/authentication.hpp"
-#endif
+#include "detector/detector.hpp"
+#include "detector/url_processor.hpp"
 
 #include "messages/messages.hpp"
 
-#include "detector.hpp"
-#include "url_processor.hpp"
+#include "zookeeper/authentication.hpp"
+#include "zookeeper/zookeeper.hpp"
 
 using namespace mesos;
 using namespace mesos::internal;
@@ -52,7 +50,6 @@ using std::string;
 using std::vector;
 
 
-#ifdef WITH_ZOOKEEPER
 class ZooKeeperMasterDetector : public MasterDetector, public Watcher
 {
 public:
@@ -136,7 +133,6 @@ private:
   string currentMasterSeq;
   UPID currentMasterPID;
 };
-#endif // WITH_ZOOKEEPER
 
 
 MasterDetector::~MasterDetector() {}
@@ -162,7 +158,6 @@ MasterDetector* MasterDetector::create(c
   switch (urlPair.first) {
     // ZooKeeper URL.
     case UrlProcessor::ZOO: {
-#ifdef WITH_ZOOKEEPER
       // TODO(benh): Consider actually using the chroot feature of
       // ZooKeeper, rather than just using it's syntax.
       size_t index = urlPair.second.find("/");
@@ -193,10 +188,6 @@ MasterDetector* MasterDetector::create(c
         detector = new ZooKeeperMasterDetector(username, password, endpoints,
             znode, pid, contend, quiet);
       }
-#else
-      fatal("Cannot detect masters with 'zoo://', "
-            "ZooKeeper is not supported in this build");
-#endif // WITH_ZOOKEEPER
       break;
     }
 
@@ -310,7 +301,6 @@ BasicMasterDetector::BasicMasterDetector
 BasicMasterDetector::~BasicMasterDetector() {}
 
 
-#ifdef WITH_ZOOKEEPER
 ZooKeeperMasterDetector::ZooKeeperMasterDetector(const string& servers,
                                                  const string& znode,
                                                  const UPID& pid,
@@ -344,7 +334,9 @@ void ZooKeeperMasterDetector::initialize
 
   credentials = _credentials;
 
-  acl = credentials != NULL ? zookeeper::EVERYONE_READ_CREATOR_ALL : ZOO_OPEN_ACL_UNSAFE;
+  acl = credentials != NULL
+    ? zookeeper::EVERYONE_READ_CREATOR_ALL
+    : ZOO_OPEN_ACL_UNSAFE;
 
   // Start up the ZooKeeper connection!
   zk = new ZooKeeper(servers, milliseconds(10000), this);
@@ -601,5 +593,3 @@ void ZooKeeperMasterDetector::detectMast
     }
   }
 }
-
-#endif // WITH_ZOOKEEPER

Modified: incubator/mesos/trunk/src/examples/java/TestExceptionFramework.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/TestExceptionFramework.java?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/java/TestExceptionFramework.java (original)
+++ incubator/mesos/trunk/src/examples/java/TestExceptionFramework.java Thu Jan 19 21:34:02 2012
@@ -54,15 +54,28 @@ public class TestExceptionFramework {
     public void error(SchedulerDriver driver, int code, String message) {}
   }
 
+  private static void usage() {
+    String name = TestExceptionFramework.class.getName();
+    System.err.println("Usage: " + name + " master");
+  }
+
   public static void main(String[] args) throws Exception {
-    ExecutorInfo executorInfo;
+    if (args.length != 1) {
+      usage();
+      System.exit(1);
+    }
+
+    ExecutorInfo executorInfo = ExecutorInfo.newBuilder()
+      .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
+      .setUri(new File("./test-executor").getCanonicalPath())
+      .build();
 
-    File file = new File("./test_executor");
-    executorInfo = ExecutorInfo.newBuilder()
-                     .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
-                     .setUri(file.getCanonicalPath())
-                     .build();
+    MesosSchedulerDriver driver = new MesosSchedulerDriver(
+        new MyScheduler(),
+        "Exception Framework",
+        executorInfo,
+        args[0]);
 
-    new MesosSchedulerDriver(new MyScheduler(), "Exception Framework", executorInfo, args[0]).run();
+    System.exit(driver.run() == Status.OK ? 0 : 1);
   }
 }

Modified: incubator/mesos/trunk/src/examples/java/TestFramework.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/TestFramework.java?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/java/TestFramework.java (original)
+++ incubator/mesos/trunk/src/examples/java/TestFramework.java Thu Jan 19 21:34:02 2012
@@ -111,29 +111,38 @@ public class TestFramework {
     }
   }
 
+  private static void usage() {
+    String name = TestMultipleExecutorsFramework.class.getName();
+    System.err.println("Usage: " + name + " master <tasks>");
+  }
+
   public static void main(String[] args) throws Exception {
     if (args.length < 1 || args.length > 2) {
-      System.out.println("Invalid use: please specify a master");
-    } else {
-      ExecutorInfo executorInfo;
+      usage();
+      System.exit(1);
+    }
 
-      File file = new File("./test_executor");
-      executorInfo = ExecutorInfo.newBuilder()
-                       .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
-                       .setUri(file.getCanonicalPath())
-                       .build();
-
-      if (args.length == 1) {
-        new MesosSchedulerDriver(new MyScheduler(),
-                                 "Java test framework",
-                                 executorInfo,
-                                 args[0]).run();
-      } else {
-        new MesosSchedulerDriver(new MyScheduler(Integer.parseInt(args[1])),
-                                 "Java test framework",
-                                 executorInfo,
-                                 args[0]).run();
-      }
+    ExecutorInfo executorInfo = ExecutorInfo.newBuilder()
+      .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
+      .setUri(new File("./test-executor").getCanonicalPath())
+      .build();
+
+    MesosSchedulerDriver driver;
+
+    if (args.length == 1) {
+      driver = new MesosSchedulerDriver(
+          new MyScheduler(),
+          "Java test framework",
+          executorInfo,
+          args[0]);
+    } else {
+      driver = new MesosSchedulerDriver(
+          new MyScheduler(Integer.parseInt(args[1])),
+          "Java test framework",
+          executorInfo,
+          args[0]);
     }
+
+    System.exit(driver.run() == Status.OK ? 0 : 1);
   }
 }

Modified: incubator/mesos/trunk/src/examples/java/TestMultipleExecutorsFramework.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/TestMultipleExecutorsFramework.java?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/java/TestMultipleExecutorsFramework.java (original)
+++ incubator/mesos/trunk/src/examples/java/TestMultipleExecutorsFramework.java Thu Jan 19 21:34:02 2012
@@ -53,7 +53,7 @@ public class TestMultipleExecutorsFramew
     public void resourceOffers(SchedulerDriver driver,
                                List<Offer> offers) {
       try {
-        File file = new File("./test_executor");
+        File file = new File("./test-executor");
 
         for (Offer offer : offers) {
           List<TaskDescription> tasks = new ArrayList<TaskDescription>();
@@ -172,24 +172,38 @@ public class TestMultipleExecutorsFramew
     private boolean barLaunched = false;
   }
 
+  private static void usage() {
+    String name = TestMultipleExecutorsFramework.class.getName();
+    System.err.println("Usage: " + name + " master <tasks>");
+  }
+
   public static void main(String[] args) throws Exception {
     if (args.length < 1 || args.length > 2) {
-      System.out.println("Invalid use: please specify a master");
-    } else {
-      ExecutorInfo executorInfo;
+      usage();
+      System.exit(1);
+    }
 
-      File file = new File("./test_executor");
-      executorInfo = ExecutorInfo.newBuilder()
-                       .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
-                       .setUri(file.getCanonicalPath())
-                       .build();
-
-      if (args.length == 1) {
-        new MesosSchedulerDriver(new MyScheduler(), "Java test framework", executorInfo, args[0]).run();
-      } else {
-        new MesosSchedulerDriver(new MyScheduler(Integer.parseInt(args[1])),
-                                 "Java test framework", executorInfo, args[0]).run();
-      }
+    ExecutorInfo executorInfo = ExecutorInfo.newBuilder()
+      .setExecutorId(ExecutorID.newBuilder().setValue("default").build())
+      .setUri(new File("./test-executor").getCanonicalPath())
+      .build();
+
+    MesosSchedulerDriver driver;
+
+    if (args.length == 1) {
+      driver = new MesosSchedulerDriver(
+          new MyScheduler(),
+          "Java test framework",
+          executorInfo,
+          args[0]);
+    } else {
+      driver = new MesosSchedulerDriver(
+          new MyScheduler(Integer.parseInt(args[1])),
+          "Java test framework",
+          executorInfo,
+          args[0]);
     }
+
+    System.exit(driver.run() == Status.OK ? 0 : 1);
   }
 }

Added: incubator/mesos/trunk/src/examples/java/test-exception-framework.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/test-exception-framework.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/java/test-exception-framework.in (added)
+++ incubator/mesos/trunk/src/examples/java/test-exception-framework.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF_JAR=${MESOS_BUILD_DIR}/protobuf.jar
+
+test ! -e ${PROTOBUF_JAR} && \
+  echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \
+  exit 1
+
+MESOS_JAR=${MESOS_BUILD_DIR}/src/mesos.jar
+
+test ! -e ${MESOS_JAR} && \
+  echo "${RED}Failed to find ${MESOS_JAR}${NORMAL}" && \
+  exit 1
+
+EXAMPLES_JAR=${MESOS_BUILD_DIR}/src/examples.jar
+
+test ! -e ${EXAMPLES_JAR} && \
+  echo "${RED}Failed to find ${EXAMPLES_JAR}${NORMAL}" && \
+  exit 1
+
+# Need to run in the directory containing this script so that the
+# framework is able to find the executor.
+cd `dirname ${0}`
+
+exec java -cp ${PROTOBUF_JAR}:${MESOS_JAR}:${EXAMPLES_JAR} \
+  -Djava.library.path=${MESOS_BUILD_DIR}/src/.libs \
+  TestExceptionFramework "${@}"

Added: incubator/mesos/trunk/src/examples/java/test-executor.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/test-executor.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/java/test-executor.in (added)
+++ incubator/mesos/trunk/src/examples/java/test-executor.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF_JAR=${MESOS_BUILD_DIR}/protobuf.jar
+
+test ! -e ${PROTOBUF_JAR} && \
+  echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \
+  exit 1
+
+MESOS_JAR=${MESOS_BUILD_DIR}/src/mesos.jar
+
+test ! -e ${MESOS_JAR} && \
+  echo "${RED}Failed to find ${MESOS_JAR}${NORMAL}" && \
+  exit 1
+
+EXAMPLES_JAR=${MESOS_BUILD_DIR}/src/examples.jar
+
+test ! -e ${EXAMPLES_JAR} && \
+  echo "${RED}Failed to find ${EXAMPLES_JAR}${NORMAL}" && \
+  exit 1
+
+exec java -cp ${PROTOBUF_JAR}:${MESOS_JAR}:${EXAMPLES_JAR} \
+  -Djava.library.path=${MESOS_BUILD_DIR}/src/.libs \
+  TestExecutor "${@}"

Added: incubator/mesos/trunk/src/examples/java/test-framework.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/test-framework.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/java/test-framework.in (added)
+++ incubator/mesos/trunk/src/examples/java/test-framework.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF_JAR=${MESOS_BUILD_DIR}/protobuf.jar
+
+test ! -e ${PROTOBUF_JAR} && \
+  echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \
+  exit 1
+
+MESOS_JAR=${MESOS_BUILD_DIR}/src/mesos.jar
+
+test ! -e ${MESOS_JAR} && \
+  echo "${RED}Failed to find ${MESOS_JAR}${NORMAL}" && \
+  exit 1
+
+EXAMPLES_JAR=${MESOS_BUILD_DIR}/src/examples.jar
+
+test ! -e ${EXAMPLES_JAR} && \
+  echo "${RED}Failed to find ${EXAMPLES_JAR}${NORMAL}" && \
+  exit 1
+
+# Need to run in the directory containing this script so that the
+# framework is able to find the executor.
+cd `dirname ${0}`
+
+exec java -cp ${PROTOBUF_JAR}:${MESOS_JAR}:${EXAMPLES_JAR} \
+  -Djava.library.path=${MESOS_BUILD_DIR}/src/.libs \
+  TestFramework "${@}"

Added: incubator/mesos/trunk/src/examples/java/test-multiple-executors-framework.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/test-multiple-executors-framework.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/java/test-multiple-executors-framework.in (added)
+++ incubator/mesos/trunk/src/examples/java/test-multiple-executors-framework.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF_JAR=${MESOS_BUILD_DIR}/protobuf.jar
+
+test ! -e ${PROTOBUF_JAR} && \
+  echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \
+  exit 1
+
+MESOS_JAR=${MESOS_BUILD_DIR}/src/mesos.jar
+
+test ! -e ${MESOS_JAR} && \
+  echo "${RED}Failed to find ${MESOS_JAR}${NORMAL}" && \
+  exit 1
+
+EXAMPLES_JAR=${MESOS_BUILD_DIR}/src/examples.jar
+
+test ! -e ${EXAMPLES_JAR} && \
+  echo "${RED}Failed to find ${EXAMPLES_JAR}${NORMAL}" && \
+  exit 1
+
+# Need to run in the directory containing this script so that the
+# framework is able to find the executor.
+cd `dirname ${0}`
+
+exec java -cp ${PROTOBUF_JAR}:${MESOS_JAR}:${EXAMPLES_JAR} \
+  -Djava.library.path=${MESOS_BUILD_DIR}/src/.libs \
+  TestMultipleExecutorsFramework "${@}"

Added: incubator/mesos/trunk/src/examples/python/test-executor.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/python/test-executor.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/python/test-executor.in (added)
+++ incubator/mesos/trunk/src/examples/python/test-executor.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Force the use of the Python interpreter configured during building.
+test ! -z "${PYTHON}" && \
+  echo "${RED}Ignoring PYTHON environment variable (using @PYTHON@)${NORMAL}"
+
+PYTHON=@PYTHON@
+
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF=${MESOS_BUILD_DIR}/third_party/protobuf-2.3.0
+PROTOBUF_EGG=`ls ${PROTOBUF}/python/dist/protobuf*.egg`
+
+test ! -e ${PROTOBUF_EGG} && \
+  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
+  exit 1
+
+MESOS_EGG=`ls ${MESOS_BUILD_DIR}/src/python/dist/mesos*.egg`
+
+test ! -e ${MESOS_EGG} && \
+  echo "${RED}Failed to find ${MESOS_EGG}${NORMAL}" && \
+  exit 1
+
+SCRIPT=${MESOS_SOURCE_DIR}/src/examples/python/test_executor.py
+
+test ! -e ${SCRIPT} && \
+  echo "${RED}Failed to find ${SCRIPT}${NORMAL}" && \
+  exit 1
+
+PYTHONPATH=${MESOS_EGG}:${PROTOBUF_EGG} exec ${PYTHON} ${SCRIPT} "${@}"

Added: incubator/mesos/trunk/src/examples/python/test-framework.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/python/test-framework.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/examples/python/test-framework.in (added)
+++ incubator/mesos/trunk/src/examples/python/test-framework.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# This script uses MESOS_SOURCE_DIR and MESOS_BUILD_DIR which come
+# from configuration substitutions.
+MESOS_SOURCE_DIR=@abs_top_srcdir@
+MESOS_BUILD_DIR=@abs_top_builddir@
+
+# Force the use of the Python interpreter configured during building.
+test ! -z "${PYTHON}" && \
+  echo "${RED}Ignoring PYTHON environment variable (using @PYTHON@)${NORMAL}"
+
+PYTHON=@PYTHON@
+
+# Use colors for errors.
+source ${MESOS_SOURCE_DIR}/support/colors.sh
+
+PROTOBUF=${MESOS_BUILD_DIR}/third_party/protobuf-2.3.0
+PROTOBUF_EGG=`ls ${PROTOBUF}/python/dist/protobuf*.egg`
+
+test ! -e ${PROTOBUF_EGG} && \
+  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
+  exit 1
+
+MESOS_EGG=`ls ${MESOS_BUILD_DIR}/src/python/dist/mesos*.egg`
+
+test ! -e ${MESOS_EGG} && \
+  echo "${RED}Failed to find ${MESOS_EGG}${NORMAL}" && \
+  exit 1
+
+SCRIPT=${MESOS_SOURCE_DIR}/src/examples/python/test_framework.py
+
+test ! -e ${SCRIPT} && \
+  echo "${RED}Failed to find ${SCRIPT}${NORMAL}" && \
+  exit 1
+
+# Need to run in the directory containing this script so that the
+# framework is able to find the executor.
+cd `dirname ${0}`
+
+PYTHONPATH=${MESOS_EGG}:${PROTOBUF_EGG} exec ${PYTHON} ${SCRIPT} "${@}"

Modified: incubator/mesos/trunk/src/examples/python/test_framework.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/python/test_framework.py?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/python/test_framework.py (original)
+++ incubator/mesos/trunk/src/examples/python/test_framework.py Thu Jan 19 21:34:02 2012
@@ -54,12 +54,12 @@ class MyScheduler(mesos.Scheduler):
 
         cpus = task.resources.add()
         cpus.name = "cpus"
-        cpus.type = mesos_pb2.Resource.SCALAR
+        cpus.type = mesos_pb2.Value.SCALAR
         cpus.scalar.value = TASK_CPUS
 
         mem = task.resources.add()
         mem.name = "mem"
-        mem.type = mesos_pb2.Resource.SCALAR
+        mem.type = mesos_pb2.Value.SCALAR
         mem.scalar.value = TASK_MEM
 
         tasks.append(task)
@@ -74,13 +74,18 @@ class MyScheduler(mesos.Scheduler):
         driver.stop()
 
 if __name__ == "__main__":
-  print "Connecting to %s" % sys.argv[1]
+  if len(sys.argv) != 2:
+    print "Usage: %s master" % sys.argv[0]
+    sys.exit(1)
 
-  frameworkDir = os.path.abspath(os.path.dirname(sys.argv[0]))
-  execPath = os.path.join(frameworkDir, "test_executor")
   execInfo = mesos_pb2.ExecutorInfo()
   execInfo.executor_id.value = "default"
-  execInfo.uri = execPath
+  execInfo.uri = os.path.abspath("./test-executor")
 
-  sys.exit(mesos.MesosSchedulerDriver(MyScheduler(), "Python test framework",
-                                      execInfo, sys.argv[1]).run())
+  driver = mesos.MesosSchedulerDriver(
+    MyScheduler(),
+    "Python test framework",
+    execInfo,
+    sys.argv[1])
+
+  sys.exit(driver.run())

Copied: incubator/mesos/trunk/src/examples/test_executor.cpp (from r1230293, incubator/mesos/trunk/src/examples/cpp_test_executor.cpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/test_executor.cpp?p2=incubator/mesos/trunk/src/examples/test_executor.cpp&p1=incubator/mesos/trunk/src/examples/cpp_test_executor.cpp&r1=1230293&r2=1233580&rev=1233580&view=diff
==============================================================================
    (empty)

Copied: incubator/mesos/trunk/src/examples/test_framework.cpp (from r1230293, incubator/mesos/trunk/src/examples/cpp_test_framework.cpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/test_framework.cpp?p2=incubator/mesos/trunk/src/examples/test_framework.cpp&p1=incubator/mesos/trunk/src/examples/cpp_test_framework.cpp&r1=1230293&r2=1233580&rev=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/cpp_test_framework.cpp (original)
+++ incubator/mesos/trunk/src/examples/test_framework.cpp Thu Jan 19 21:34:02 2012
@@ -153,7 +153,10 @@ int main(int argc, char** argv)
   // Find this executable's directory to locate executor
   char buf[4096];
   realpath(dirname(argv[0]), buf);
-  string uri = string(buf) + "/cpp-test-executor";
+  string uri = string(buf) + "/test-executor";
+  if (getenv("MESOS_BUILD_DIR")) {
+    uri = string(getenv("MESOS_BUILD_DIR")) + "/src/test-executor";
+  }
   // Run a Mesos scheduler
   MyScheduler sched;
 

Modified: incubator/mesos/trunk/src/exec/exec.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/exec/exec.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/exec/exec.cpp (original)
+++ incubator/mesos/trunk/src/exec/exec.cpp Thu Jan 19 21:34:02 2012
@@ -263,6 +263,8 @@ private:
 MesosExecutorDriver::MesosExecutorDriver(Executor* _executor)
   : executor(_executor), state(INITIALIZED), process(NULL)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   // Create mutex and condition variable
   pthread_mutexattr_t attr;
   pthread_mutexattr_init(&attr);

Copied: incubator/mesos/trunk/src/java/mesos.pom.in (from r1230293, incubator/mesos/trunk/src/java/mesos.pom)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/mesos.pom.in?p2=incubator/mesos/trunk/src/java/mesos.pom.in&p1=incubator/mesos/trunk/src/java/mesos.pom&r1=1230293&r2=1233580&rev=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/mesos.pom (original)
+++ incubator/mesos/trunk/src/java/mesos.pom.in Thu Jan 19 21:34:02 2012
@@ -4,7 +4,7 @@
   <artifactId>mesos</artifactId>
   <name>Mesos</name>
   <groupId>org.mesosproject</groupId>
-  <version>%MESOS_VERSION%</version>
+  <version>@PACKAGE_VERSION@</version>
   <dependencies>
     <dependency>
       <artifactId>protobuf-java</artifactId>

Modified: incubator/mesos/trunk/src/java/src/org/apache/mesos/MesosSchedulerDriver.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/src/org/apache/mesos/MesosSchedulerDriver.java?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/src/org/apache/mesos/MesosSchedulerDriver.java (original)
+++ incubator/mesos/trunk/src/java/src/org/apache/mesos/MesosSchedulerDriver.java Thu Jan 19 21:34:02 2012
@@ -39,6 +39,14 @@ public class MesosSchedulerDriver implem
                               ExecutorInfo executorInfo,
                               String url,
                               FrameworkID frameworkId) {
+    if (sched == null) {
+      throw new NullPointerException("Not expecting a null scheduler");
+    }
+
+    if (frameworkName == null) {
+      throw new NullPointerException("Not expecting a null scheduler");
+    }
+
     this.sched = sched;
     this.url = url;
     this.frameworkId = frameworkId;

Added: incubator/mesos/trunk/src/jvm/jvm.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/jvm/jvm.cpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/jvm/jvm.cpp (added)
+++ incubator/mesos/trunk/src/jvm/jvm.cpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1,579 @@
+#include <jni.h>
+#include <stdarg.h>
+
+#include <glog/logging.h>
+
+#include <map>
+#include <memory>
+#include <sstream>
+#include <vector>
+
+#include "common/hashmap.hpp"
+#include "common/foreach.hpp"
+#include "common/utils.hpp"
+
+#include "jvm/jvm.hpp"
+
+
+namespace mesos {
+namespace internal {
+
+jmethodID Jvm::findMethod(const Jvm::JClass& clazz,
+                          const std::string& name,
+                          const Jvm::JClass& returnType,
+                          const std::vector<Jvm::JClass> argTypes,
+                          bool isStatic)
+{
+  std::ostringstream signature;
+  signature << "(";
+  std::vector<Jvm::JClass>::iterator args;
+  foreach (Jvm::JClass type, argTypes) {
+    signature << type.signature();
+  }
+  signature << ")" << returnType.signature();
+
+  LOG(INFO) << "looking up" << (isStatic ? " static " : " ") << "method "
+            << name << signature.str();
+
+  jmethodID id = NULL;
+  if (isStatic) {
+    id = env->GetStaticMethodID(findClass(clazz),
+                                name.c_str(),
+                                signature.str().c_str());
+  } else {
+    id = env->GetMethodID(findClass(clazz),
+                          name.c_str(),
+                          signature.str().c_str());
+  }
+
+  // TODO(John Sirois): consider CHECK -> return Option if re-purposing this
+  // code outside of tests.
+  CHECK(id != NULL);
+  return id;
+}
+
+
+Jvm::ConstructorFinder::ConstructorFinder(
+    const Jvm::JClass& _type)
+    : type(_type),
+      parameters() {}
+
+
+Jvm::ConstructorFinder&
+Jvm::ConstructorFinder::parameter(const Jvm::JClass& type)
+{
+  parameters.push_back(type);
+  return *this;
+}
+
+
+Jvm::JConstructor Jvm::findConstructor(const ConstructorFinder& signature)
+{
+  jmethodID id =
+      findMethod(signature.type,
+                 "<init>",
+                 voidClass,
+                 signature.parameters,
+                 false);
+  return Jvm::JConstructor(signature.type, id);
+}
+
+
+Jvm::JConstructor::JConstructor(const JConstructor& other) : clazz(other.clazz),
+                                                             id(other.id) {}
+
+
+Jvm::JConstructor::JConstructor(const JClass& _clazz,
+                                const jmethodID _id) : clazz(_clazz),
+                                                       id(_id) {}
+
+
+jobject Jvm::invoke(const JConstructor& ctor, ...)
+{
+  va_list args;
+  va_start(args, ctor);
+  jobject result = env->NewObjectV(findClass(ctor.clazz), ctor.id, args);
+  va_end(args);
+  CHECK(result != NULL);
+  return result;
+}
+
+
+Jvm::MethodFinder::MethodFinder(
+    const Jvm::JClass& _clazz,
+    const std::string& _name)
+    : clazz(_clazz),
+      name(_name),
+      parameters() {}
+
+
+Jvm::MethodFinder& Jvm::MethodFinder::parameter(const JClass& type)
+{
+  parameters.push_back(type);
+  return *this;
+}
+
+
+Jvm::MethodSignature Jvm::MethodFinder::returns(const JClass& returnType) const
+{
+  return Jvm::MethodSignature(clazz, name, returnType, parameters);
+}
+
+
+Jvm::JMethod Jvm::findMethod(const MethodSignature& signature)
+{
+  jmethodID id = findMethod(signature.clazz,
+                            signature.name,
+                            signature.returnType,
+                            signature.parameters,
+                            false);
+  return Jvm::JMethod(signature.clazz, id);
+}
+
+
+Jvm::JMethod Jvm::findStaticMethod(const MethodSignature& signature)
+{
+  jmethodID id = findMethod(signature.clazz,
+                            signature.name,
+                            signature.returnType,
+                            signature.parameters,
+                            true);
+  return Jvm::JMethod(signature.clazz, id);
+}
+
+
+Jvm::MethodSignature::MethodSignature(const MethodSignature& other) :
+    clazz(other.clazz),
+    name(other.name),
+    returnType(other.returnType),
+    parameters(other.parameters) {}
+
+
+Jvm::MethodSignature::MethodSignature(const JClass& _clazz,
+                                      const std::string& _name,
+                                      const JClass& _returnType,
+                                      const std::vector<JClass>& _parameters) :
+    clazz(_clazz),
+    name(_name),
+    returnType(_returnType),
+    parameters(_parameters) {}
+
+
+Jvm::JMethod::JMethod(const JMethod& other)
+    : clazz(other.clazz), id(other.id) {}
+
+
+Jvm::JMethod::JMethod(const JClass& _clazz, const jmethodID _id)
+    : clazz(_clazz), id(_id) {}
+
+
+template <>
+jobject Jvm::invokeV<jobject>(const jobject receiver,
+                              const jmethodID id,
+                              va_list args)
+{
+  jobject result = env->CallObjectMethodV(receiver, id, args);
+  CHECK(result != NULL);
+  return result;
+}
+
+
+template<>
+void Jvm::invokeV<void>(const jobject receiver,
+                        const jmethodID id,
+                        va_list args)
+{
+  env->CallVoidMethodV(receiver, id, args);
+}
+
+
+template <>
+bool Jvm::invokeV<bool>(const jobject receiver,
+                        const jmethodID id,
+                        va_list args)
+{
+  return env->CallBooleanMethodV(receiver, id, args);
+}
+
+
+template <>
+char Jvm::invokeV<char>(const jobject receiver,
+                        const jmethodID id,
+                        va_list args)
+{
+  return env->CallCharMethodV(receiver, id, args);
+}
+
+
+template <>
+short Jvm::invokeV<short>(const jobject receiver,
+                          const jmethodID id,
+                          va_list args)
+{
+  return env->CallShortMethodV(receiver, id, args);
+}
+
+
+template <>
+int Jvm::invokeV<int>(const jobject receiver,
+                      const jmethodID id,
+                      va_list args)
+{
+  return env->CallIntMethodV(receiver, id, args);
+}
+
+
+template <>
+long Jvm::invokeV<long>(const jobject receiver,
+                        const jmethodID id,
+                        va_list args)
+{
+  return env->CallLongMethodV(receiver, id, args);
+}
+
+
+template <>
+float Jvm::invokeV<float>(const jobject receiver,
+                          const jmethodID id,
+                          va_list args)
+{
+  return env->CallFloatMethodV(receiver, id, args);
+}
+
+
+template <>
+double Jvm::invokeV<double>(const jobject receiver,
+                            const jmethodID id,
+                            va_list args)
+{
+  return env->CallDoubleMethodV(receiver, id, args);
+}
+
+
+template <>
+void Jvm::invoke<void>(const jobject receiver, const JMethod& method, ...)
+{
+  va_list args;
+  va_start(args, method);
+  invokeV<void>(receiver, method.id, args);
+  va_end(args);
+}
+
+
+template <>
+jobject Jvm::invokeStaticV<jobject>(const JClass& receiver,
+                                    const jmethodID id,
+                                    va_list args)
+{
+  jobject result = env->CallStaticObjectMethodV(findClass(receiver), id, args);
+  CHECK(result != NULL);
+  return result;
+}
+
+
+template<>
+void Jvm::invokeStaticV<void>(const JClass& receiver,
+                              const jmethodID id,
+                              va_list args)
+{
+  env->CallStaticVoidMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+bool Jvm::invokeStaticV<bool>(const JClass& receiver,
+                              const jmethodID id,
+                              va_list args)
+{
+  return env->CallStaticBooleanMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+char Jvm::invokeStaticV<char>(const JClass& receiver,
+                              const jmethodID id,
+                              va_list args)
+{
+  return env->CallStaticCharMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+short Jvm::invokeStaticV<short>(const JClass& receiver,
+                                const jmethodID id,
+                                va_list args)
+{
+  return env->CallStaticShortMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+int Jvm::invokeStaticV<int>(const JClass& receiver,
+                            const jmethodID id,
+                            va_list args)
+{
+  return env->CallStaticIntMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+long Jvm::invokeStaticV<long>(const JClass& receiver,
+                              const jmethodID id,
+                              va_list args)
+{
+  return env->CallStaticLongMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+float Jvm::invokeStaticV<float>(const JClass& receiver,
+                                const jmethodID id,
+                                va_list args)
+{
+  return env->CallStaticFloatMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+double Jvm::invokeStaticV<double>(const JClass& receiver,
+                                  const jmethodID id,
+                                  va_list args)
+{
+  return env->CallStaticDoubleMethodV(findClass(receiver), id, args);
+}
+
+
+template <>
+void Jvm::invokeStatic<void>(const JMethod& method, ...)
+{
+  va_list args;
+  va_start(args, method);
+  invokeStaticV<void>(method.clazz, method.id, args);
+  va_end(args);
+}
+
+
+const Jvm::JClass Jvm::JClass::forName(const std::string& nativeName)
+{
+  return Jvm::JClass(nativeName, false /* not a native type */);
+}
+
+
+Jvm::JClass::JClass(const JClass& other) : nativeName(other.nativeName),
+                                           isNative(other.isNative) {}
+
+
+Jvm::JClass::JClass(const std::string& _nativeName,
+                    bool _isNative) : nativeName(_nativeName),
+                                      isNative(_isNative) {}
+
+
+const Jvm::JClass Jvm::JClass::arrayOf() const
+{
+  return Jvm::JClass("[" + nativeName, isNative);
+}
+
+
+Jvm::ConstructorFinder Jvm::JClass::constructor() const
+{
+  return Jvm::ConstructorFinder(*this);
+}
+
+
+Jvm::MethodFinder Jvm::JClass::method(const std::string& name) const
+{
+  return Jvm::MethodFinder(*this, name);
+}
+
+
+std::string Jvm::JClass::signature() const
+{
+  return isNative ? nativeName : "L" + nativeName + ";";
+}
+
+
+Jvm::JField::JField(const JField& other) : clazz(other.clazz), id(other.id) {}
+
+
+Jvm::JField::JField(const JClass& _clazz, const jfieldID _id)
+    : clazz(_clazz), id(_id) {}
+
+
+Jvm::JField Jvm::findStaticField(const JClass& clazz, const std::string& name)
+{
+  jfieldID id =
+      env->GetStaticFieldID(findClass(clazz),
+                            name.c_str(),
+                            clazz.signature().c_str());
+  return Jvm::JField(clazz, id);
+}
+
+
+template <>
+jobject Jvm::getStaticField<jobject>(const JField& field)
+{
+  jobject result = env->GetStaticObjectField(findClass(field.clazz), field.id);
+  CHECK(result != NULL);
+  return result;
+}
+
+
+template <>
+bool Jvm::getStaticField<bool>(const JField& field)
+{
+  return env->GetStaticBooleanField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+char Jvm::getStaticField<char>(const JField& field)
+{
+  return env->GetStaticCharField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+short Jvm::getStaticField<short>(const JField& field)
+{
+  return env->GetStaticShortField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+int Jvm::getStaticField<int>(const JField& field)
+{
+  return env->GetStaticIntField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+long Jvm::getStaticField<long>(const JField& field)
+{
+  return env->GetStaticLongField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+float Jvm::getStaticField<float>(const JField& field)
+{
+  return env->GetStaticFloatField(findClass(field.clazz), field.id);
+}
+
+
+template <>
+double Jvm::getStaticField<double>(const JField& field)
+{
+  return env->GetStaticDoubleField(findClass(field.clazz), field.id);
+}
+
+
+Jvm::Jvm(const std::vector<std::string>& options, JNIVersion jniVersion)
+  : jvm(NULL),
+    env(NULL),
+    voidClass("V"),
+    booleanClass("Z"),
+    byteClass("B"),
+    charClass("C"),
+    shortClass("S"),
+    intClass("I"),
+    longClass("J"),
+    floatClass("F"),
+    doubleClass("D"),
+    stringClass(JClass::forName("java/lang/String"))
+{
+  JavaVMInitArgs vmArgs;
+  vmArgs.version = jniVersion;
+  vmArgs.ignoreUnrecognized = false;
+
+  JavaVMOption* opts = new JavaVMOption[options.size()];
+  for (int i = 0; i < options.size(); i++) {
+    opts[i].optionString = const_cast<char*>(options[i].c_str());
+  }
+  vmArgs.nOptions = options.size();
+  vmArgs.options = opts;
+
+  int result = JNI_CreateJavaVM(&jvm, (void**) &env, &vmArgs);
+  CHECK(result != JNI_ERR) << "Failed to create JVM!";
+
+  delete[] opts;
+}
+
+
+Jvm::~Jvm()
+{
+  CHECK(0 == jvm->DestroyJavaVM()) << "Failed to destroy JVM";
+}
+
+
+void Jvm::attachDaemon()
+{
+  jvm->AttachCurrentThreadAsDaemon((void**) &env, NULL);
+}
+
+
+void Jvm::attach()
+{
+  jvm->AttachCurrentThread((void**) &env, NULL);
+}
+
+
+void Jvm::detach()
+{
+  jvm->DetachCurrentThread();
+}
+
+
+jclass Jvm::findClass(const JClass& clazz)
+{
+  jclass cls = env->FindClass(clazz.nativeName.c_str());
+  // TODO(John Sirois): consider CHECK -> return Option if re-purposing this
+  // code outside of tests.
+  CHECK(cls != NULL);
+  return cls;
+}
+
+
+jobject Jvm::string(const std::string& str)
+{
+  return env->NewStringUTF(str.c_str());
+}
+
+
+jobject Jvm::newGlobalRef(const jobject object)
+{
+  return env->NewGlobalRef(object);
+}
+
+
+void Jvm::deleteGlobalRef(const jobject object)
+{
+  env->DeleteGlobalRef(object);
+}
+
+
+void Jvm::deleteGlobalRefSafe(const jobject object)
+{
+  if (object != NULL) {
+    deleteGlobalRef(object);
+  }
+}
+
+Jvm::Attach::Attach(Jvm* jvm, bool daemon) : _jvm(jvm)
+{
+  if (daemon) {
+    _jvm->attachDaemon();
+  } else {
+    _jvm->attach();
+  }
+}
+
+
+Jvm::Attach::~Attach()
+{
+  // TODO(John Sirois): this detaches too early under nested use, attach by a
+  // given thread should incr, this should decr and only detach on 0
+  _jvm->detach();
+}
+
+} // namespace internal
+} // namespace mesos

Added: incubator/mesos/trunk/src/jvm/jvm.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/jvm/jvm.hpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/jvm/jvm.hpp (added)
+++ incubator/mesos/trunk/src/jvm/jvm.hpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1,302 @@
+#ifndef __JVM_HPP__
+#define __JVM_HPP__
+
+#include <jni.h>
+
+#include <glog/logging.h>
+
+#include <vector>
+
+namespace mesos {
+namespace internal {
+
+// Facilitates embedding a jvm and calling into it.
+//
+// TODO(John Sirois): Fix variadic methods.  Possibly a way to do this with
+// typelists, type concatenation and unwinding builder inheritance
+//
+// TODO(John Sirois): Support finding static methods.
+class Jvm
+{
+public:
+  // Forward declarations.
+  class ConstructorFinder;
+  class MethodFinder;
+  class JConstructor;
+  class MethodSignature;
+  class JMethod;
+
+  // An opaque class descriptor that can be used to find constructors, methods
+  // and fields.
+  class JClass
+  {
+  public:
+    // A factory for new java reference type class descriptors given the native
+    // name.  To obtain class descriptors for native types, use the fields in
+    // Jvm.
+    static const JClass forName(const std::string& nativeName);
+
+    JClass(const JClass& other);
+
+    // Returns the class of an array of the current class.
+    const JClass arrayOf() const;
+
+    // Creates a builder that can be used to locate a constructor of this
+    // class with Jvm::findConstructor.
+    ConstructorFinder constructor() const;
+
+    // Creates a builder that can be used to locate an instance method of this
+    // class with Jvm::findMethod.
+    MethodFinder method(const std::string& name) const;
+
+  private:
+    friend class Jvm;
+
+    JClass(const std::string& nativeName,
+           bool isNative = true);
+
+    std::string signature() const;
+
+    std::string nativeName;
+    bool isNative;
+  };
+
+
+  // A builder that is used to specify a constructor by specifying its parameter
+  // list with zero or more calls to ConstructorFinder::parameter.
+  class ConstructorFinder
+  {
+  public:
+    // Adds a parameter to the constructor parameter list.
+    ConstructorFinder& parameter(const JClass& type);
+
+  private:
+    friend class JClass;
+    friend class Jvm;
+
+    ConstructorFinder(const JClass& type);
+
+    const JClass type;
+    std::vector<JClass> parameters;
+  };
+
+
+  // An opaque constructor descriptor that can be used to create new instances
+  // of a class using Jvm::invokeConstructor.
+  class JConstructor
+  {
+  public:
+    JConstructor(const JConstructor& other);
+
+  private:
+    friend class Jvm;
+
+    JConstructor(const JClass& clazz, const jmethodID id);
+
+    const JClass clazz;
+    const jmethodID id;
+  };
+
+
+  // A builder that is used to specify an instance method by specifying its
+  // parameter list with zero or more calls to MethodFinder::parameter and a
+  // final call to MethodFinder::returns to get an opaque specification of the
+  // method for use with Jvm::findMethod.
+  class MethodFinder
+  {
+  public:
+    // Adds a parameter to the method parameter list.
+    MethodFinder& parameter(const JClass& type);
+
+    // Terminates description of a method by specifying its return type.
+    MethodSignature returns(const JClass& type) const;
+
+  private:
+    friend class JClass;
+
+    MethodFinder(const JClass& clazz, const std::string& name);
+
+    const JClass clazz;
+    const std::string name;
+    std::vector<JClass> parameters;
+  };
+
+
+  // An opaque method specification for use with Jvm::findMethod.
+  class MethodSignature
+  {
+  public:
+    MethodSignature(const MethodSignature& other);
+
+  private:
+    friend class Jvm;
+    friend class MethodFinder;
+
+    MethodSignature(const JClass& clazz,
+                    const std::string& name,
+                    const JClass& returnType,
+                    const std::vector<JClass>& parameters);
+
+    const JClass clazz;
+    const std::string name;
+    const JClass returnType;
+    std::vector<JClass> parameters;
+  };
+
+
+  // An opaque method descriptor that can be used to invoke instance methods
+  // using Jvm::invokeMethod.
+  class JMethod
+  {
+  public:
+    JMethod(const JMethod& other);
+
+  private:
+    friend class Jvm;
+    friend class MethodSignature;
+
+    JMethod(const JClass& clazz, const jmethodID id);
+
+    const JClass clazz;
+    const jmethodID id;
+  };
+
+
+  // An opaque field descriptor that can be used to access fields using
+  // methods like Jvm::getStaticField.
+  class JField
+  {
+  public:
+    JField(const JField& other);
+
+  private:
+    friend class Jvm;
+
+    JField(const JClass& clazz, const jfieldID id);
+
+    const JClass clazz;
+    const jfieldID id;
+  };
+
+
+  // RAII container for c++/jvm thread binding management.
+  class Attach
+  {
+  public:
+    Attach(Jvm* jvm, bool daemon = true);
+    ~Attach();
+
+  private:
+      Jvm* _jvm;
+  };
+
+  friend class Attach;
+
+  enum JNIVersion
+  {
+    v_1_1 = JNI_VERSION_1_1,
+    v_1_2 = JNI_VERSION_1_2,
+    v_1_4 = JNI_VERSION_1_4,
+    v_1_6 = JNI_VERSION_1_6
+  };
+
+  // Starts a new embedded jvm with the given -D options.  Each option supplied
+  // should be of the standard form: '-Dproperty=value'.
+  //
+  // TODO(John Sirois): Consider elevating classpath as a top level jvm
+  // configuration parameter since it will likely always need to be specified.
+  // Ditto for and non -X java option.
+  Jvm(const std::vector<std::string>& options,
+      JNIVersion jniVersion = Jvm::v_1_6);
+  ~Jvm();
+
+  const JClass voidClass;
+  const JClass booleanClass;
+  const JClass byteClass;
+  const JClass charClass;
+  const JClass shortClass;
+  const JClass intClass;
+  const JClass longClass;
+  const JClass floatClass;
+  const JClass doubleClass;
+  const JClass stringClass;
+
+  jobject string(const std::string& str);
+
+  JConstructor findConstructor(const ConstructorFinder& constructor);
+  JMethod findMethod(const MethodSignature& signature);
+  JMethod findStaticMethod(const MethodSignature& signature);
+  JField findStaticField(const JClass& clazz, const std::string& name);
+
+  jobject invoke(const JConstructor& ctor, ...);
+
+  template <typename T>
+  T invoke(const jobject receiver, const JMethod& method, ...);
+
+  template <typename T>
+  T invokeStatic(const JMethod& method, ...);
+
+  template <typename T>
+  T getStaticField(const JField& field);
+
+  jobject newGlobalRef(const jobject object);
+  void deleteGlobalRef(const jobject object);
+  void deleteGlobalRefSafe(const jobject object);
+
+private:
+  jclass findClass(const JClass& clazz);
+
+  jmethodID findMethod(const Jvm::JClass& clazz,
+                       const std::string& name,
+                       const Jvm::JClass& returnType,
+                       const std::vector<Jvm::JClass> argTypes,
+                       bool isStatic);
+
+  template <typename T>
+  T invokeV(const jobject receiver, const jmethodID id, va_list args);
+
+  template <typename T>
+  T invokeStaticV(const JClass& receiver, const jmethodID id, va_list args);
+
+  void attachDaemon();
+  void attach();
+  void detach();
+
+  JavaVM* jvm;
+  JNIEnv* env;
+};
+
+
+template <>
+void Jvm::invoke<void>(const jobject receiver, const JMethod& method, ...);
+
+
+template <typename T>
+T Jvm::invoke(const jobject receiver, const JMethod& method, ...)
+{
+  va_list args;
+  va_start(args, method);
+  const T result = invokeV<T>(receiver, method.id, args);
+  va_end(args);
+  return result;
+}
+
+
+template <>
+void Jvm::invokeStatic<void>(const JMethod& method, ...);
+
+
+template <typename T>
+T Jvm::invokeStatic(const JMethod& method, ...)
+{
+  va_list args;
+  va_start(args, method);
+  const T result = invokeStaticV<T>(method.clazz, method.id, args);
+  va_end(args);
+  return result;
+}
+
+} // namespace internal
+} // namespace mesos
+
+#endif // __JVM_HPP__

Modified: incubator/mesos/trunk/src/launcher/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/launcher/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/launcher/main.cpp (original)
+++ incubator/mesos/trunk/src/launcher/main.cpp Thu Jan 19 21:34:02 2012
@@ -49,6 +49,8 @@ const char * getenvOrEmpty(const char *v
 
 int main(int argc, char **argv)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   FrameworkID frameworkId;
   frameworkId.set_value(getenvOrFail("MESOS_FRAMEWORK_ID"));
 

Modified: incubator/mesos/trunk/src/local/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/local/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/local/main.cpp (original)
+++ incubator/mesos/trunk/src/local/main.cpp Thu Jan 19 21:34:02 2012
@@ -57,6 +57,8 @@ void usage(const char* programName, cons
 
 int main(int argc, char **argv)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   Configurator configurator;
   local::registerOptions(&configurator);
   configurator.addOption<int>("port", 'p', "Port to listen on", 5050);

Modified: incubator/mesos/trunk/src/log/log.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/log/log.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/log/log.hpp (original)
+++ incubator/mesos/trunk/src/log/log.hpp Thu Jan 19 21:34:02 2012
@@ -34,9 +34,7 @@
 #include "log/coordinator.hpp"
 #include "log/replica.hpp"
 
-#ifdef WITH_ZOOKEEPER
 #include "zookeeper/group.hpp"
-#endif // WITH_ZOOKEEPER
 
 namespace mesos {
 namespace internal {
@@ -175,10 +173,10 @@ public:
   Log(int _quorum,
       const std::string& path,
       const std::set<process::UPID>& pids)
-#ifdef WITH_ZOOKEEPER
     : group(NULL)
-#endif // WITH_ZOOKEEPER
   {
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+
     quorum = _quorum;
 
     replica = new Replica(path);
@@ -189,7 +187,6 @@ public:
     network->add(replica->pid());
   }
 
-#ifdef WITH_ZOOKEEPER
   // Creates a new replicated log that assumes the specified quorum
   // size, is backed by a file at the specified path, and coordiantes
   // with other replicas associated with the specified ZooKeeper
@@ -202,6 +199,8 @@ public:
       const Option<zookeeper::Authentication>& auth
         = Option<zookeeper::Authentication>::none())
   {
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+
     quorum = _quorum;
 
     replica = new Replica(path);
@@ -221,14 +220,11 @@ public:
       .onFailed(dispatch(lambda::bind(&Log::failed, this, lambda::_1)))
       .onDiscarded(dispatch(lambda::bind(&Log::discarded, this)));
   }
-#endif // WITH_ZOOKEEPER
 
   ~Log()
   {
     delete network;
-#ifdef WITH_ZOOKEEPER
     delete group;
-#endif // WITH_ZOOKEEPER
     delete replica;
   }
 
@@ -253,7 +249,6 @@ private:
   friend class Reader;
   friend class Writer;
 
-#ifdef WITH_ZOOKEEPER
   // TODO(benh): Factor this out into some sort of "membership renewer".
   void watch(const std::set<zookeeper::Group::Membership>& memberships);
   void failed(const std::string& message) const;
@@ -262,7 +257,6 @@ private:
   zookeeper::Group* group;
   process::Future<zookeeper::Group::Membership> membership;
   async::Dispatch dispatch;
-#endif // WITH_ZOOKEEPER
 
   int quorum;
 
@@ -418,7 +412,6 @@ Result<Log::Position> Log::Writer::trunc
 }
 
 
-#ifdef WITH_ZOOKEEPER
 void Log::watch(const std::set<zookeeper::Group::Membership>& memberships)
 {
   if (membership.isReady() && memberships.count(membership.get()) == 0) {
@@ -446,7 +439,6 @@ void Log::discarded() const
 {
   LOG(FATAL) << "Not expecting future to get discarded!";
 }
-#endif // WITH_ZOOKEEPER
 
 } // namespace log {
 } // namespace internal {

Modified: incubator/mesos/trunk/src/log/network.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/log/network.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/log/network.hpp (original)
+++ incubator/mesos/trunk/src/log/network.hpp Thu Jan 19 21:34:02 2012
@@ -38,9 +38,7 @@
 #include "common/seconds.hpp"
 #include "common/utils.hpp"
 
-#ifdef WITH_ZOOKEEPER
 #include "zookeeper/group.hpp"
-#endif
 
 // Forward declaration.
 class NetworkProcess;
@@ -88,7 +86,6 @@ private:
 };
 
 
-#ifdef WITH_ZOOKEEPER
 class ZooKeeperNetwork : public Network
 {
 public:
@@ -112,7 +109,6 @@ private:
 
   async::Dispatch dispatch;
 };
-#endif // WITH_ZOOKEEPER
 
 
 class NetworkProcess : public ProtobufProcess<NetworkProcess>
@@ -250,7 +246,6 @@ void Network::broadcast(
   process::dispatch(process, broadcast, m, filter);
 }
 
-#ifdef WITH_ZOOKEEPER
 inline ZooKeeperNetwork::ZooKeeperNetwork(zookeeper::Group* _group)
   : group(_group)
 {
@@ -321,6 +316,5 @@ inline void ZooKeeperNetwork::discarded(
 {
   LOG(FATAL) << "Unexpected discarded future while watching ZooKeeper group";
 }
-#endif // WITH_ZOOKEEPER
 
 #endif // __NETWORK_HPP__

Modified: incubator/mesos/trunk/src/master/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/main.cpp (original)
+++ incubator/mesos/trunk/src/master/main.cpp Thu Jan 19 21:34:02 2012
@@ -54,6 +54,8 @@ void usage(const char* progName, const C
 
 int main(int argc, char **argv)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   Configurator configurator;
   Logging::registerOptions(&configurator);
   Master::registerOptions(&configurator);

Modified: incubator/mesos/trunk/src/master/slaves_manager.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/slaves_manager.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/slaves_manager.cpp (original)
+++ incubator/mesos/trunk/src/master/slaves_manager.cpp Thu Jan 19 21:34:02 2012
@@ -30,9 +30,7 @@
 #include "common/fatal.hpp"
 #include "common/strings.hpp"
 
-#ifdef WITH_ZOOKEEPER
 #include "zookeeper/zookeeper.hpp"
-#endif
 
 #include "master.hpp"
 #include "slaves_manager.hpp"
@@ -60,8 +58,6 @@ using std::string;
 using std::vector;
 
 
-#ifdef WITH_ZOOKEEPER
-
 // Forward declaration of watcher.
 class ZooKeeperSlavesManagerStorageWatcher;
 
@@ -588,8 +584,6 @@ bool ZooKeeperSlavesManagerStorage::pars
   return true;
 }
 
-#endif // WITH_ZOOKEEPER
-
 
 SlavesManager::SlavesManager(const Configuration& conf,
                              const PID<Master>& _master)
@@ -603,7 +597,6 @@ SlavesManager::SlavesManager(const Confi
   string zoo = "zoo://";
   size_t index = slaves.find(zoo);
   if (index == 0) {
-#ifdef WITH_ZOOKEEPER
     // TODO(benh): Consider actually using the chroot feature of
     // ZooKeeper, rather than just using it's syntax.
     string temp = slaves.substr(zoo.size());
@@ -621,10 +614,6 @@ SlavesManager::SlavesManager(const Confi
 
     storage = new ZooKeeperSlavesManagerStorage(servers, znode, self());
     process::spawn(storage);
-#else
-    fatal("Cannot get active/inactive slave information using 'zoo://',"
-          " ZooKeeper is not supported in this build");
-#endif // WITH_ZOOKEEPER
   } else {
     // Parse 'slaves' as initial active hostname:port pairs.
     if (slaves != "*") {

Modified: incubator/mesos/trunk/src/master/webui.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/webui.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/webui.cpp (original)
+++ incubator/mesos/trunk/src/master/webui.cpp Thu Jan 19 21:34:02 2012
@@ -16,74 +16,28 @@
  * limitations under the License.
  */
 
-#include <pthread.h>
-
-#include <sstream>
-#include <string>
-
-#include <process/dispatch.hpp>
+#include <process/process.hpp>
 
 #include "master/webui.hpp"
 
-#include "configurator/configuration.hpp"
+#include "common/utils.hpp"
+#include "common/webui_utils.hpp"
 
 #ifdef MESOS_WEBUI
 
-#include <Python.h>
-
-
 namespace mesos {
 namespace internal {
 namespace master {
 namespace webui {
 
-static std::string masterPort;
-static std::string webuiPort;
-static std::string logDir;
-
-
-void* run(void*)
-{
-  LOG(INFO) << "Master web server thread started";
-  Py_Initialize();
-  char* argv[4];
-  argv[0] = const_cast<char*>("webui/master/webui.py");
-  argv[1] = const_cast<char*>(masterPort.c_str());
-  argv[2] = const_cast<char*>(webuiPort.c_str());
-  argv[3] = const_cast<char*>(logDir.c_str());
-  PySys_SetArgv(4, argv);
-  PyRun_SimpleString(
-      "import sys\n"
-      "sys.path.append('webui/common')\n"
-      "sys.path.append('webui/bottle-0.8.3')\n");
-  LOG(INFO) << "Loading webui/master/webui.py";
-  FILE* file = fopen("webui/master/webui.py", "r");
-  PyRun_SimpleFile(file, "webui/master/webui.py");
-  fclose(file);
-  Py_Finalize();
-}
-
-
 void start(const process::PID<Master>& master, const Configuration& conf)
 {
-  masterPort = utils::stringify(master.port);
+  std::vector<std::string> args(3);
+  args[0] = "--master_port=" + utils::stringify(master.port);
+  args[1] = "--webui_port=" + conf.get("webui_port", "8080");
+  args[2] = "--log_dir=" + conf.get("log_dir", FLAGS_log_dir);
 
-  // TODO(*): It would be nice if we didn't have to be specifying
-  // default values for configuration options in the code like
-  // this. For example, we specify /tmp for log_dir because that is
-  // what glog does, but it would be nice if at this point in the game
-  // all of the configuration options have been set (from defaults or
-  // from the command line, environment, or configuration file) and we
-  // can just query what their values are.
-  webuiPort = conf.get("webui_port", "8080");
-  logDir = conf.get("log_dir", FLAGS_log_dir);
-
-  LOG(INFO) << "Starting master web server on port " << webuiPort;
-
-  pthread_t thread;
-  if (pthread_create(&thread, 0, run, NULL) != 0) {
-    LOG(FATAL) << "Failed to create master web server thread";
-  }
+  utils::webui::start(conf, "master/webui.py", args);
 }
 
 } // namespace webui {

Modified: incubator/mesos/trunk/src/mesos/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/mesos/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/mesos/main.cpp (original)
+++ incubator/mesos/trunk/src/mesos/main.cpp Thu Jan 19 21:34:02 2012
@@ -32,6 +32,8 @@ void usage(const char* programName, cons
 
 int main(int argc, char** argv)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   // TODO(vinod): Add options!
   Configurator configurator;
 

Modified: incubator/mesos/trunk/src/python/setup.py.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/python/setup.py.in?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/python/setup.py.in (original)
+++ incubator/mesos/trunk/src/python/setup.py.in Thu Jan 19 21:34:02 2012
@@ -54,8 +54,7 @@ LIBRARY_OBJECTS = [
 LIBRARY_DIRS = []
 
 EXTRA_STATIC_LINKS = [
-  os.path.join(mesos_build, 'lib', 'libmesos_sched.a'),
-  os.path.join(mesos_build, 'lib', 'libmesos_exec.a'),
+  os.path.join(mesos_build, 'src', '.libs', 'libmesos_no_third_party.a'),
 ]
 
 SOURCES = [
@@ -92,8 +91,8 @@ if os.path.abspath(mesos_src) != os.path
       raise
 
 setup(name = 'mesos',
-      version = '1.0',  # TODO(wickman)  This should be versioned along w/ mesos-core.
-      description = 'This is mesos',
+      version = '@PACKAGE_VERSION@',
+      description = 'Mesos',
       package_dir = { '': 'src' },
       packages = ['.'],
       ext_modules = [mesos_module])

Modified: incubator/mesos/trunk/src/sched/sched.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/sched/sched.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/sched/sched.cpp (original)
+++ incubator/mesos/trunk/src/sched/sched.cpp Thu Jan 19 21:34:02 2012
@@ -625,6 +625,8 @@ void MesosSchedulerDriver::init(Schedule
                                 const std::string& _frameworkName,
                                 const ExecutorInfo& _executorInfo)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   sched = _sched;
   conf = _conf;
   frameworkId = _frameworkId;

Modified: incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp (original)
+++ incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp Thu Jan 19 21:34:02 2012
@@ -214,7 +214,7 @@ void LxcIsolationModule::launchExecutor(
     }
 
     // Determine path for mesos-launcher from Mesos home directory.
-    string path = conf.get("home", ".") + "/bin/mesos-launcher";
+    string path = conf.get("launcher_dir", MESOS_LIBEXECDIR) + "/mesos-launcher";
     args[i++] = path.c_str();
     args[i++] = NULL;
 

Modified: incubator/mesos/trunk/src/slave/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/main.cpp (original)
+++ incubator/mesos/trunk/src/slave/main.cpp Thu Jan 19 21:34:02 2012
@@ -55,6 +55,8 @@ void usage(const char *programName, cons
 
 int main(int argc, char** argv)
 {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
   Configurator configurator;
   Logging::registerOptions(&configurator);
   Slave::registerOptions(&configurator);

Modified: incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp (original)
+++ incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp Thu Jan 19 21:34:02 2012
@@ -111,7 +111,7 @@ void ProcessBasedIsolationModule::launch
 
   if (pid) {
     // In parent process.
-    LOG(INFO) << "Forked executor at = " << pid;
+    LOG(INFO) << "Forked executor at " << pid;
 
     // Record the pid (should also be the pgis since we setsid below).
     infos[frameworkId][executorId]->pid = pid;

Modified: incubator/mesos/trunk/src/slave/webui.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/webui.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/webui.cpp (original)
+++ incubator/mesos/trunk/src/slave/webui.cpp Thu Jan 19 21:34:02 2012
@@ -16,85 +16,47 @@
  * limitations under the License.
  */
 
-#include <pthread.h>
-
-#include <sstream>
-#include <string>
-
-#include <process/dispatch.hpp>
+#include <process/process.hpp>
 
 #include "slave/webui.hpp"
 
+#include "common/option.hpp"
 #include "common/utils.hpp"
+#include "common/webui_utils.hpp"
 
 #include "configurator/configuration.hpp"
 
 #ifdef MESOS_WEBUI
 
-#include <Python.h>
-
-
 namespace mesos {
 namespace internal {
 namespace slave {
 namespace webui {
 
-static std::string slavePort;
-static std::string webuiPort;
-static std::string logDir;
-static std::string workDir;
-
-
-void* run(void*)
-{
-  LOG(INFO) << "Slave web server thread started";
-  Py_Initialize();
-  char* argv[5];
-  argv[0] = const_cast<char*>("webui/slave/webui.py");
-  argv[1] = const_cast<char*>(slavePort.c_str());
-  argv[2] = const_cast<char*>(webuiPort.c_str());
-  argv[3] = const_cast<char*>(logDir.c_str());
-  argv[4] = const_cast<char*>(workDir.c_str());
-  PySys_SetArgv(5, argv);
-  PyRun_SimpleString(
-      "import sys\n"
-      "sys.path.append('webui/common')\n"
-      "sys.path.append('webui/bottle-0.8.3')\n");
-  LOG(INFO) << "Loading webui/slave/webui.py";
-  FILE* file = fopen("webui/slave/webui.py", "r");
-  PyRun_SimpleFile(file, "webui/slave/webui.py");
-  fclose(file);
-  Py_Finalize();
-}
-
-
 void start(const process::PID<Slave>& slave, const Configuration& conf)
 {
-  slavePort = utils::stringify(slave.port);
-
-  // TODO(*): See the note in master/webui.cpp about having to
-  // determine default values. These should be set by now and can just
-  // be used! For example, what happens when the slave code changes
-  // their default location for the work directory, it might not get
-  // changed here!
-  webuiPort = conf.get("webui_port", "8081");
-  logDir = conf.get("log_dir", FLAGS_log_dir);
-  if (conf.contains("work_dir")) {
-    workDir = conf.get("work_dir", "");
-  } else if (conf.contains("home")) {
-    workDir = conf.get("home", "") + "/work";
+  std::vector<std::string> args(4);
+  args[0] = "--slave_port=" + utils::stringify(slave.port);
+  args[1] = "--webui_port=" + conf.get("webui_port", "8081");
+  args[2] = "--log_dir=" + conf.get("log_dir", FLAGS_log_dir);
+
+  std::string workDir = "work";  // Default work directory.
+
+  // Now look for configured work directory.
+  Option<std::string> option = conf.get("work_dir");
+  if (option.isNone()) {
+    // Okay, then look for a home directory instead.
+    option = conf.get("home");
+    if (option.isSome()) {
+      workDir = option.get() + "/work";
+    }
   } else {
-    workDir = "work";
+    workDir = option.get();
   }
 
-  CHECK(workDir != "");
-
-  LOG(INFO) << "Starting slave web server on port " << webuiPort;
+  args[3] = "--work_dir=" + workDir;
 
-  pthread_t thread;
-  if (pthread_create(&thread, 0, run, NULL) != 0) {
-    LOG(FATAL) << "Failed to create slave web server thread";
-  }
+  utils::webui::start(conf, "slave/webui.py", args);
 }
 
 } // namespace webui {

Modified: incubator/mesos/trunk/src/tests/base_zookeeper_test.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/base_zookeeper_test.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/base_zookeeper_test.cpp (original)
+++ incubator/mesos/trunk/src/tests/base_zookeeper_test.cpp Thu Jan 19 21:34:02 2012
@@ -28,12 +28,13 @@
 
 #include "common/lock.hpp"
 
+#include "jvm/jvm.hpp"
+
 #include "tests/base_zookeeper_test.hpp"
-#include "tests/jvm.hpp"
 #include "tests/utils.hpp"
 #include "tests/zookeeper_server.hpp"
 
-using mesos::internal::test::mesosRoot;
+using mesos::internal::test::mesosSourceDirectory;
 using std::tr1::bind;
 using std::tr1::function;
 
@@ -76,7 +77,7 @@ void BaseZooKeeperTest::SetUpTestCase()
   if (singleton == NULL) {
     std::vector<std::string> opts;
 
-    std::string zkHome = mesosRoot + "/third_party/zookeeper-3.3.1";
+    std::string zkHome = mesosSourceDirectory + "/third_party/zookeeper-3.3.1";
     std::string classpath = "-Djava.class.path=" +
         zkHome + "/zookeeper-3.3.1.jar:" +
         zkHome + "/lib/log4j-1.2.15.jar";

Modified: incubator/mesos/trunk/src/tests/base_zookeeper_test.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/base_zookeeper_test.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/base_zookeeper_test.hpp (original)
+++ incubator/mesos/trunk/src/tests/base_zookeeper_test.hpp Thu Jan 19 21:34:02 2012
@@ -27,7 +27,8 @@
 
 #include "common/seconds.hpp"
 
-#include "tests/jvm.hpp"
+#include "jvm/jvm.hpp"
+
 #include "tests/zookeeper_server.hpp"
 
 using std::tr1::function;

Modified: incubator/mesos/trunk/src/tests/external/LxcIsolation/HoldMoreMemThanRequested.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/LxcIsolation/HoldMoreMemThanRequested.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/LxcIsolation/HoldMoreMemThanRequested.sh (original)
+++ incubator/mesos/trunk/src/tests/external/LxcIsolation/HoldMoreMemThanRequested.sh Thu Jan 19 21:34:02 2012
@@ -15,4 +15,4 @@ export DESIRED_MEMHOG_EXIT_CODE=1
 
 # Exec run_scheduled_memhog_test.sh, which actually runs the test and reports
 # whether memhog gave the desired exit status through its exit status
-exec $MESOS_HOME/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
+exec $MESOS_SOURCE_DIR/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh

Modified: incubator/mesos/trunk/src/tests/external/LxcIsolation/ScaleUpAndDown.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/LxcIsolation/ScaleUpAndDown.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/LxcIsolation/ScaleUpAndDown.sh (original)
+++ incubator/mesos/trunk/src/tests/external/LxcIsolation/ScaleUpAndDown.sh Thu Jan 19 21:34:02 2012
@@ -10,4 +10,4 @@ export DESIRED_MEMHOG_EXIT_CODE=0
 
 # Exec run_scheduled_memhog_test.sh, which actually runs the test and reports
 # whether memhog gave the desired exit status through its exit status
-exec $MESOS_HOME/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
+exec $MESOS_SOURCE_DIR/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh

Modified: incubator/mesos/trunk/src/tests/external/LxcIsolation/TwoSeparateTasks.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/LxcIsolation/TwoSeparateTasks.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/LxcIsolation/TwoSeparateTasks.sh (original)
+++ incubator/mesos/trunk/src/tests/external/LxcIsolation/TwoSeparateTasks.sh Thu Jan 19 21:34:02 2012
@@ -10,4 +10,4 @@ export DESIRED_MEMHOG_EXIT_CODE=0
 
 # Exec run_scheduled_memhog_test.sh, which actually runs the test and reports
 # whether memhog gave the desired exit status through its exit status
-exec $MESOS_HOME/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
+exec $MESOS_SOURCE_DIR/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh

Modified: incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh (original)
+++ incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh Thu Jan 19 21:34:02 2012
@@ -13,7 +13,7 @@ if [[ $EUID -ne 0 ]]; then
 fi
 
 # Launch master
-$MESOS_HOME/mesos-master --port=5432 > master.log 2>&1 &
+$MESOS_BUILD_DIR/src/mesos-master --port=5432 > master.log 2>&1 &
 MASTER_PID=$!
 echo "Launched master, PID = $MASTER_PID"
 sleep 2
@@ -27,7 +27,7 @@ if [[ $KILL_EXIT_CODE -ne 0 ]]; then
 fi
 
 # Launch slave
-$MESOS_HOME/mesos-slave \
+$MESOS_BUILD_DIR/src/mesos-slave \
     --url=master@localhost:5432 \
     --isolation=lxc \
     --resources="cpus:2;mem:$[512*1024*1024]" \
@@ -47,7 +47,8 @@ fi
 
 # Launch memhog
 echo "Running scheduled-memhog"
-$MESOS_HOME/examples/scheduled-memhog master@localhost:5432 schedule > memhog.log 2>&1
+$MESOS_BUILD_DIR/src/examples/scheduled-memhog master@localhost:5432 \
+  schedule > memhog.log 2>&1
 EXIT_CODE=$?
 echo "Memhog exit code: $?"
 sleep 2

Modified: incubator/mesos/trunk/src/tests/external/SampleFrameworks/CppFramework.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/SampleFrameworks/CppFramework.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/SampleFrameworks/CppFramework.sh (original)
+++ incubator/mesos/trunk/src/tests/external/SampleFrameworks/CppFramework.sh Thu Jan 19 21:34:02 2012
@@ -1,7 +1,21 @@
 #!/bin/sh
 
+# Expecting MESOS_SOURCE_DIR and MESOS_BUILD_DIR to be in environment.
+
+env | grep MESOS_SOURCE_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_SOURCE_DIR in environment" && \
+  exit 1
+
+env | grep MESOS_BUILD_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_BUILD_DIR in environment" && \
+  exit 1
+
 # Set local Mesos runner to use 3 slaves
 export MESOS_NUM_SLAVES=3
 
 # Check that the C++ test framework executes without crashing (returns 0).
-exec $MESOS_HOME/bin/examples/cpp-test-framework local
+exec $MESOS_BUILD_DIR/src/test-framework local

Modified: incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaExceptionFramework.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaExceptionFramework.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaExceptionFramework.sh (original)
+++ incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaExceptionFramework.sh Thu Jan 19 21:34:02 2012
@@ -1,6 +1,24 @@
 #!/bin/sh
 
-# Check that the JavaException framework crashes and prints an ArrayIndexOutOfBoundsExcpetion. This is a test to be sure that Java excpetions are getting propagated, which is an issue with Swig generated Java libraries. The grep should returns 0.
-$MESOS_HOME/bin/examples/java/test_exception_framework local 2>&1 | grep "ArrayIndexOutOfBoundsException"
+# Expecting MESOS_SOURCE_DIR and MESOS_BUILD_DIR to be in environment.
+
+env | grep MESOS_SOURCE_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_SOURCE_DIR in environment" && \
+  exit 1
+
+env | grep MESOS_BUILD_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_BUILD_DIR in environment" && \
+  exit 1
+
+# Check that the JavaException framework crashes and prints an
+# ArrayIndexOutOfBoundsExcpetion. This is a test to be sure that Java
+# exceptions are getting propagated. Th exit status of grep should be 0.
+
+$MESOS_BUILD_DIR/src/examples/java/test-exception-framework local 2>&1 \
+  | grep "ArrayIndexOutOfBoundsException"
 
 exit $?

Modified: incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaFramework.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaFramework.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaFramework.sh (original)
+++ incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaFramework.sh Thu Jan 19 21:34:02 2012
@@ -1,7 +1,21 @@
 #!/bin/sh
 
-# Set local Mesos runner to use 3 slaves
+# Expecting MESOS_SOURCE_DIR and MESOS_BUILD_DIR to be in environment.
+
+env | grep MESOS_SOURCE_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_SOURCE_DIR in environment" && \
+  exit 1
+
+env | grep MESOS_BUILD_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_BUILD_DIR in environment" && \
+  exit 1
+
+# Set local Mesos runner to use 3 slaves.
 export MESOS_NUM_SLAVES=3
 
 # Check that the Java test framework executes without crashing (returns 0).
-exec $MESOS_HOME/bin/examples/java/test_framework local
+exec $MESOS_BUILD_DIR/src/examples/java/test-framework local

Modified: incubator/mesos/trunk/src/tests/external/SampleFrameworks/PythonFramework.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external/SampleFrameworks/PythonFramework.sh?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external/SampleFrameworks/PythonFramework.sh (original)
+++ incubator/mesos/trunk/src/tests/external/SampleFrameworks/PythonFramework.sh Thu Jan 19 21:34:02 2012
@@ -1,7 +1,21 @@
 #!/bin/sh
 
+# Expecting MESOS_SOURCE_DIR and MESOS_BUILD_DIR to be in environment.
+
+env | grep MESOS_SOURCE_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_SOURCE_DIR in environment" && \
+  exit 1
+
+env | grep MESOS_BUILD_DIR >/dev/null
+
+test $? != 0 && \
+  echo "Failed to find MESOS_BUILD_DIR in environment" && \
+  exit 1
+
 # Set local Mesos runner to use 3 slaves
 export MESOS_NUM_SLAVES=3
 
 # Check that the Python test framework executes without crashing (returns 0).
-exec $MESOS_HOME/bin/examples/python/test_framework local
+exec $MESOS_BUILD_DIR/src/examples/python/test-framework local

Modified: incubator/mesos/trunk/src/tests/external_tests.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/external_tests.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/external_tests.cpp (original)
+++ incubator/mesos/trunk/src/tests/external_tests.cpp Thu Jan 19 21:34:02 2012
@@ -50,8 +50,8 @@ void mesos::internal::test::runExternalT
   // Create and go into the test's work directory
   enterTestDirectory(testCase, testName);
   // Figure out the absolute path to the test script
-  string script = mesosHome + "/bin/tests/external/" + testCase
-                             + "/" + testName + ".sh";
+  string script = mesosSourceDirectory + "/src/tests/external/" + testCase +
+      "/" + testName + ".sh";
   // Fork a process to change directory and run the test
   pid_t pid;
   if ((pid = fork()) == -1) {
@@ -69,7 +69,11 @@ void mesos::internal::test::runExternalT
       fatalerror("freopen failed");
     if (freopen("stderr", "w", stderr) == NULL)
       fatalerror("freopen failed");
-    setenv("MESOS_HOME", mesosHome.c_str(), 1);
+    setenv("MESOS_SOURCE_DIR", mesosSourceDirectory.c_str(), 1);
+    setenv("MESOS_BUILD_DIR", mesosBuildDirectory.c_str(), 1);
+    setenv("MESOS_WEBUI_DIR",
+           (mesosSourceDirectory + "/src/webui").c_str(), 1);
+    setenv("MESOS_LAUNCHER_DIR", (mesosBuildDirectory + "/src").c_str(), 1);
     execl(script.c_str(), script.c_str(), (char*) NULL);
     // If we get here, execl failed; report the error
     fatalerror("Could not execute %s", script.c_str());

Modified: incubator/mesos/trunk/src/tests/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/main.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/main.cpp (original)
+++ incubator/mesos/trunk/src/tests/main.cpp Thu Jan 19 21:34:02 2012
@@ -52,13 +52,13 @@ string getRealpath(const string& relPath
 }
 
 
-string getMesosRoot()
+string getMesosSourceDirectory()
 {
-  return getRealpath(ROOT_DIR);
+  return getRealpath(SOURCE_DIR);
 }
 
 
-string getMesosHome()
+string getMesosBuildDirectory()
 {
   return getRealpath(BUILD_DIR);
 }
@@ -70,14 +70,16 @@ int main(int argc, char** argv)
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
   // Get the absolute path to the Mesos project root directory.
-  mesos::internal::test::mesosRoot = getMesosRoot();
+  mesos::internal::test::mesosSourceDirectory = getMesosSourceDirectory();
 
-  std::cout << "MESOS_ROOT: " << mesos::internal::test::mesosRoot << std::endl;
+  std::cout << "Source directory: "
+            << mesos::internal::test::mesosSourceDirectory << std::endl;
 
   // Get absolute path to Mesos home install directory.
-  mesos::internal::test::mesosHome = getMesosHome();
+  mesos::internal::test::mesosBuildDirectory = getMesosBuildDirectory();
 
-  std::cout << "MESOS_HOME: " << mesos::internal::test::mesosHome << std::endl;
+  std::cout << "Build directory: "
+            << mesos::internal::test::mesosBuildDirectory << std::endl;
 
   // Clear any MESOS_ environment variables so they don't affect our tests.
   Configurator::clearMesosEnvironmentVars();

Modified: incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp (original)
+++ incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp Thu Jan 19 21:34:02 2012
@@ -23,18 +23,14 @@
 #include "tests/external_test.hpp"
 
 
-// Run each of the sample frameworks in local mode
+// Run each of the sample frameworks in local mode.
 TEST_EXTERNAL(SampleFrameworks, CppFramework)
+
 #if MESOS_HAS_JAVA
   TEST_EXTERNAL(SampleFrameworks, JavaFramework)
   TEST_EXTERNAL(SampleFrameworks, JavaExceptionFramework)
 #endif 
+
 #if MESOS_HAS_PYTHON
   TEST_EXTERNAL(SampleFrameworks, PythonFramework)
 #endif
-
-// TODO(*): Add the tests below as C++ tests.
-// // Some tests for command-line and environment configuration
-// TEST_EXTERNAL(SampleFrameworks, CFrameworkCmdlineParsing)
-// TEST_EXTERNAL(SampleFrameworks, CFrameworkInvalidCmdline)
-// TEST_EXTERNAL(SampleFrameworks, CFrameworkInvalidEnv)

Modified: incubator/mesos/trunk/src/tests/utils.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/utils.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/utils.cpp (original)
+++ incubator/mesos/trunk/src/tests/utils.cpp Thu Jan 19 21:34:02 2012
@@ -29,8 +29,8 @@ using namespace mesos::internal;
 using std::string;
 
 
-string test::mesosRoot;
-string test::mesosHome;
+string test::mesosSourceDirectory;
+string test::mesosBuildDirectory;
 
 
 namespace {
@@ -52,7 +52,8 @@ bool isValidTestName(const char* name) {
 /**
  * Create and clean up the work directory for a given test, and cd into it,
  * given the test's test case name and test name.
- * Test directories are placed in <mesosHome>/test_output/<testCase>/<testName>.
+ * Test directories are placed in
+ * <mesosBuildDir>/test_output/<testCase>/<testName>.
  */
 void test::enterTestDirectory(const char* testCase, const char* testName)
 {
@@ -65,7 +66,8 @@ void test::enterTestDirectory(const char
            << "only contain alphanumeric and underscore characters)";
   }
   // Make the work directory for this test
-  string workDir = mesosHome + "/test_output/" + testCase + "/" + testName;
+  string workDir = mesosBuildDirectory + "/test_output/" + testCase + "/"
+    + testName;
   string command = "rm -fr '" + workDir + "'";
   ASSERT_EQ(0, system(command.c_str())) << "Command failed: " << command;
   command = "mkdir -p '" + workDir + "'";

Modified: incubator/mesos/trunk/src/tests/utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/utils.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/utils.hpp (original)
+++ incubator/mesos/trunk/src/tests/utils.hpp Thu Jan 19 21:34:02 2012
@@ -43,17 +43,17 @@
 namespace mesos { namespace internal { namespace test {
 
 /**
- * The location of the Mesos project root directory.  Used by tests to locate
+ * The location of the Mesos source directory.  Used by tests to locate
  * various frameworks and binaries.  Initialized in main.cpp.
  */
-extern std::string mesosRoot;
+extern std::string mesosSourceDirectory;
 
 
 /**
- * The location where Mesos is installed, used by tests to locate various
+ * The location of the Mesos build directory. Used by tests to locate
  * frameworks and binaries.  Initialized in main.cpp.
  */
-extern std::string mesosHome;
+extern std::string mesosBuildDirectory;
 
 
 /**

Modified: incubator/mesos/trunk/src/tests/zookeeper_server.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/zookeeper_server.cpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/zookeeper_server.cpp (original)
+++ incubator/mesos/trunk/src/tests/zookeeper_server.cpp Thu Jan 19 21:34:02 2012
@@ -27,7 +27,8 @@
 #include "common/utils.hpp"
 #include "common/uuid.hpp"
 
-#include "tests/jvm.hpp"
+#include "jvm/jvm.hpp"
+
 #include "tests/zookeeper_server.hpp"
 
 namespace mesos {

Modified: incubator/mesos/trunk/src/tests/zookeeper_server.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/zookeeper_server.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/zookeeper_server.hpp (original)
+++ incubator/mesos/trunk/src/tests/zookeeper_server.hpp Thu Jan 19 21:34:02 2012
@@ -25,7 +25,7 @@
 
 #include "common/utils.hpp"
 
-#include "tests/jvm.hpp"
+#include "jvm/jvm.hpp"
 
 #include "zookeeper/zookeeper.hpp"
 

Modified: incubator/mesos/trunk/src/webui/master/webui.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/master/webui.py?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/master/webui.py (original)
+++ incubator/mesos/trunk/src/webui/master/webui.py Thu Jan 19 21:34:02 2012
@@ -14,12 +14,36 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
 import bottle
 import commands
+import os
+import sys
 
 from bottle import route, send_file, template
 
+from optparse import OptionParser
+
+
+# Parse options for this script.
+parser = OptionParser()
+
+parser.add_option('--master_port', default=None)
+parser.add_option('--webui_port', default=None)
+parser.add_option('--log_dir', default=None)
+
+(options, args) = parser.parse_args(sys.argv)
+
+assert options.master_port is not None, "Missing --master_port argument"
+assert options.webui_port is not None, "Missing --webui_port argument"
+assert options.log_dir is not None, "Missing --log_dir argument"
+
+master_port = options.master_port
+webui_port = options.webui_port
+log_dir = options.log_dir
+
+# Recover the webui directory from argv[0].
+webui_dir = os.path.abspath(os.path.dirname(sys.argv[0]) + '/..')
+
 
 @route('/')
 def index():
@@ -35,7 +59,7 @@ def framework(id):
 
 @route('/static/:filename#.*#')
 def static(filename):
-  send_file(filename, root = './webui/static')
+  send_file(filename, root = webui_dir + '/static')
 
 
 @route('/log/:level#[A-Z]*#')
@@ -51,15 +75,6 @@ def log_tail(level, lines):
   return commands.getoutput(command)
 
 
-bottle.TEMPLATE_PATH.append('./webui/master/')
-
-# TODO(*): Add an assert to confirm that all the arguments we are
-# expecting have been passed to us, which will give us a better error
-# message when they aren't!
-
-master_port = sys.argv[1]
-webui_port = sys.argv[2]
-log_dir = sys.argv[3]
-
+bottle.TEMPLATE_PATH.append(webui_dir + '/master')
 bottle.debug(True)
 bottle.run(host = '0.0.0.0', port = webui_port)

Modified: incubator/mesos/trunk/src/webui/slave/webui.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/slave/webui.py?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/slave/webui.py (original)
+++ incubator/mesos/trunk/src/webui/slave/webui.py Thu Jan 19 21:34:02 2012
@@ -24,6 +24,32 @@ import urllib
 
 from bottle import abort, route, send_file, template
 
+from optparse import OptionParser
+
+
+# Parse options for this script.
+parser = OptionParser()
+
+parser.add_option('--slave_port', default=None)
+parser.add_option('--webui_port', default=None)
+parser.add_option('--log_dir', default=None)
+parser.add_option('--work_dir', default=None)
+
+(options, args) = parser.parse_args(sys.argv)
+
+assert options.slave_port is not None, "Missing --slave_port argument"
+assert options.webui_port is not None, "Missing --webui_port argument"
+assert options.log_dir is not None, "Missing --log_dir argument"
+assert options.work_dir is not None, "Missing --log_dir argument"
+
+slave_port = options.slave_port
+webui_port = options.webui_port
+log_dir = options.log_dir
+work_dir = options.work_dir
+
+# Recover the webui directory from argv[0].
+webui_dir = os.path.abspath(os.path.dirname(sys.argv[0]) + '/..')
+
 
 @route('/')
 def index():
@@ -45,7 +71,7 @@ def executor(fid, eid):
 
 @route('/static/:filename#.*#')
 def static(filename):
-  send_file(filename, root = './webui/static')
+  send_file(filename, root = webui_dir + '/static')
 
 
 @route('/log/:level#[A-Z]*#')
@@ -94,16 +120,6 @@ def framework_log_tail(fid, eid, log_typ
     abort(403, 'Slave not yet registered with master')
 
 
-bottle.TEMPLATE_PATH.append('./webui/slave/')
-
-# TODO(*): Add an assert to confirm that all the arguments we are
-# expecting have been passed to us, which will give us a better error
-# message when they aren't!
-
-slave_port = sys.argv[1]
-webui_port = sys.argv[2]
-log_dir = sys.argv[3]
-work_dir = sys.argv[4]
-
+bottle.TEMPLATE_PATH.append(webui_dir + '/slave')
 bottle.debug(True)
 bottle.run(host = '0.0.0.0', port = webui_port)

Added: incubator/mesos/trunk/support/colors.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/support/colors.sh?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/support/colors.sh (added)
+++ incubator/mesos/trunk/support/colors.sh Thu Jan 19 21:34:02 2012
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+BLACK=$(tput setaf 0)
+RED=$(tput setaf 1)
+GREEN=$(tput setaf 2)
+YELLOW=$(tput setaf 3)
+LIME_YELLOW=$(tput setaf 190)
+POWDER_BLUE=$(tput setaf 153)
+BLUE=$(tput setaf 4)
+MAGENTA=$(tput setaf 5)
+CYAN=$(tput setaf 6)
+WHITE=$(tput setaf 7)
+BRIGHT=$(tput bold)
+BLINK=$(tput blink)
+REVERSE=$(tput smso)
+UNDERLINE=$(tput smul)
+NORMAL=$(tput sgr0)
\ No newline at end of file



Mime
View raw message