You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 11:25:43 UTC
svn commit: r1132329 [3/6] - in /incubator/mesos/trunk: ./ src/ src/common/
src/config/ src/event_history/ src/examples/ src/local/ src/master/
src/messaging/ src/slave/ src/tests/ third_party/sqlite-3.6.23.1/
Modified: incubator/mesos/trunk/configure.ac
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.ac?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.ac (original)
+++ incubator/mesos/trunk/configure.ac Sun Jun 5 09:25:41 2011
@@ -34,7 +34,6 @@ AC_CONFIG_SUBDIRS([third_party/libproces
AC_CONFIG_SUBDIRS([third_party/protobuf-2.3.0])
AC_CONFIG_SUBDIRS([third_party/glog-0.3.1])
AC_CONFIG_SUBDIRS([third_party/gmock-1.5.0])
-AC_CONFIG_SUBDIRS([third_party/sqlite-3.6.23.1])
AC_CONFIG_SUBDIRS([third_party/zookeeper-3.3.1/src/c])
AC_CANONICAL_SYSTEM
@@ -174,20 +173,6 @@ AC_ARG_WITH([swig],
[])
AC_SUBST(SWIG)
-WITH_INCLUDED_SQLITE="0"
-AC_ARG_WITH([included-sqlite],
- AC_HELP_STRING([--with-included-sqlite],
- [build with included sqlite]),
- [case "$with_included_sqlite" in
- yes) WITH_SQLITE="1"
- WITH_INCLUDED_SQLITE="1" ;;
- no) WITH_INCLUDED_SQLITE="0" ;;
- *) AC_MSG_ERROR([
-*** --with-included-sqlite does not take arguments]) ;;
- esac],
- [])
-AC_SUBST(WITH_INCLUDED_SQLITE)
-
WITH_ZOOKEEPER="0"
AC_ARG_WITH([zookeeper],
AC_HELP_STRING([--with-zookeeper],
Modified: incubator/mesos/trunk/configure.template.centos-5.4-64
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.template.centos-5.4-64?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.template.centos-5.4-64 (original)
+++ incubator/mesos/trunk/configure.template.centos-5.4-64 Sun Jun 5 09:25:41 2011
@@ -6,5 +6,4 @@ $(dirname $0)/configure \
--with-python-headers=/usr/include/python2.6 \
--with-java-home=/usr/java/default \
--with-webui \
- --with-included-sqlite \
--with-included-zookeeper $@
Modified: incubator/mesos/trunk/configure.template.macosx
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.template.macosx?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.template.macosx (original)
+++ incubator/mesos/trunk/configure.template.macosx Sun Jun 5 09:25:41 2011
@@ -13,5 +13,4 @@ $(dirname $0)/configure
--with-java-home=$JAVA_HOME \
--with-java-headers=$JAVA_HEADERS \
--with-webui \
- --with-included-sqlite \
--with-included-zookeeper $@
Modified: incubator/mesos/trunk/configure.template.ubuntu-hardy-64
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.template.ubuntu-hardy-64?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.template.ubuntu-hardy-64 (original)
+++ incubator/mesos/trunk/configure.template.ubuntu-hardy-64 Sun Jun 5 09:25:41 2011
@@ -6,5 +6,4 @@ $(dirname $0)/configure \
--with-python-headers=/usr/include/python2.5 \
--with-java-home=/usr/lib/jvm/java-6-openjdk \
--with-webui \
- --with-included-sqlite \
--with-included-zookeeper $@
Modified: incubator/mesos/trunk/configure.template.ubuntu-karmic-64
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.template.ubuntu-karmic-64?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.template.ubuntu-karmic-64 (original)
+++ incubator/mesos/trunk/configure.template.ubuntu-karmic-64 Sun Jun 5 09:25:41 2011
@@ -4,5 +4,4 @@ $(dirname $0)/configure \
--with-python-headers=/usr/include/python2.6 \
--with-java-home=/usr/lib/jvm/java-6-sun \
--with-webui \
- --with-included-sqlite \
--with-included-zookeeper $@
Modified: incubator/mesos/trunk/configure.template.ubuntu-lucid-64
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.template.ubuntu-lucid-64?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.template.ubuntu-lucid-64 (original)
+++ incubator/mesos/trunk/configure.template.ubuntu-lucid-64 Sun Jun 5 09:25:41 2011
@@ -4,5 +4,4 @@ $(dirname $0)/configure \
--with-python-headers=/usr/include/python2.6 \
--with-java-home=/usr/lib/jvm/java-6-openjdk \
--with-webui \
- --with-included-sqlite \
--with-included-zookeeper $@
Modified: incubator/mesos/trunk/src/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.in?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/Makefile.in (original)
+++ incubator/mesos/trunk/src/Makefile.in Sun Jun 5 09:25:41 2011
@@ -2,8 +2,6 @@
SHELL = '/bin/sh'
-SRCDIR = @srcdir@
-INCLUDEDIR = @top_builddir@/include
BINDIR = @top_builddir@/bin
LIBDIR = @top_builddir@/lib
CONFDIR = @top_builddir@/conf
@@ -13,8 +11,6 @@ CC = @CC@
CXX = @CXX@
SWIG = @SWIG@
-PROTOC=@top_builddir@/third_party/protobuf-2.3.0/src/protoc
-
CFLAGS = @CFLAGS@
CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
@@ -38,37 +34,30 @@ WITH_ZOOKEEPER = @WITH_ZOOKEEPER@
WITH_INCLUDED_ZOOKEEPER = @WITH_INCLUDED_ZOOKEEPER@
-BOOST = third_party/boost-1.37.0
-PROTOBUF = third_party/protobuf-2.3.0
-GLOG = third_party/glog-0.3.1
-ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
LIBPROCESS = third_party/libprocess
+
LIBEV = $(LIBPROCESS)/third_party/libev-3.8
+GLOG = third_party/glog-0.3.1
+
+ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
+
# Ensure that we get better debugging info.
CFLAGS += -g
CXXFLAGS += -g
# Add source dir and build dir to CFLAGS and CXXFLAGS.
-CFLAGS += -I$(SRCDIR) -I.
-CXXFLAGS += -I$(SRCDIR) -I.
+CFLAGS += -I@srcdir@ -I.
+CXXFLAGS += -I@srcdir@ -I.
-# Add include and build include to CFLAGS and CXXFLAGS.
-CFLAGS += -I@top_srcdir@/include -I$(INCLUDEDIR)
-CXXFLAGS += -I@top_srcdir@/include -I$(INCLUDEDIR)
+# Add include to CFLAGS and CXXFLAGS.
+CFLAGS += -I@top_srcdir@/include
+CXXFLAGS += -I@top_srcdir@/include
# Add boost to CFLAGS and CXXFLAGS.
CFLAGS += -I@top_srcdir@/third_party/boost-1.37.0
CXXFLAGS += -I@top_srcdir@/third_party/boost-1.37.0
-# Add protobuf to include and lib paths.
-CXXFLAGS += -I@top_srcdir@/$(PROTOBUF)/src
-LDFLAGS += -L@top_builddir@/$(PROTOBUF)/src/.libs
-
-# Add glog to include and lib paths.
-CXXFLAGS += -I@top_srcdir@/$(GLOG)/src -I@top_builddir@/$(GLOG)/src
-LDFLAGS += -L@top_builddir@/$(GLOG)/.libs
-
# Add libprocess to CFLAGS, CXXFLAGS, and LDFLAGS.
CFLAGS += -I@top_srcdir@/$(LIBPROCESS)
CXXFLAGS += -I@top_srcdir@/$(LIBPROCESS)
@@ -77,6 +66,10 @@ LDFLAGS += -L@top_builddir@/$(LIBPROCESS
# Add libev to LDFLAGS.
LDFLAGS += -L@top_builddir@/$(LIBEV)/.libs
+# Add glog to include and lib paths.
+CXXFLAGS += -I@top_srcdir@/$(GLOG)/src -I@top_builddir@/$(GLOG)/src
+LDFLAGS += -L@top_builddir@/$(GLOG)/.libs
+
# Add included ZooKeeper to include and lib paths if necessary.
ifeq ($(WITH_INCLUDED_ZOOKEEPER),1)
CXXFLAGS += -I@top_srcdir@/$(ZOOKEEPER)/include -I@top_srcdir@/$(ZOOKEEPER)/generated
@@ -87,16 +80,26 @@ endif
CFLAGS += -MMD -MP
CXXFLAGS += -MMD -MP
-# Add protobuf, glog, libev, libprocess, pthread, and dl to LIBS.
-LIBS += -lprotobuf -lglog -lprocess -lev -lpthread -ldl
+# Add build date to CFLAGS, CXXFLAGS
+CFLAGS += -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\""
+CXXFLAGS += -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\""
+
+# Add build user to CFLAGS, CXXFLAGS
+CFLAGS += -DBUILD_USER="\"$$USER\""
+CXXFLAGS += -DBUILD_USER="\"$$USER\""
+
+# Add libev to LDFLAGS.
+LDFLAGS += -L$(LIBEV)/.libs
+
+# Add glog, libev, libprocess, pthread, and dl to LIBS.
+LIBS += -lglog -lprocess -lev -lpthread -ldl
# Add ZooKeeper if necessary.
ifeq ($(WITH_ZOOKEEPER),1)
- LIBS += -lzookeeper_mt
+ LIBS += -lzookeeper_st
endif
-MASTER_OBJ = master/master.o master/slaves_manager.o \
- master/allocator_factory.o master/simple_allocator.o
+MASTER_OBJ = master/master.o master/allocator_factory.o master/simple_allocator.o
SLAVE_OBJ = slave/slave.o launcher/launcher.o slave/isolation_module.o \
slave/process_based_isolation_module.o
@@ -109,8 +112,6 @@ ifeq ($(OS_NAME),linux)
SLAVE_OBJ += slave/lxc_isolation_module.o
endif
-PROTOBUF_OBJ = mesos.pb.o messaging/messages.pb.o
-
MASTER_WEBUI_OBJ = master/webui.o
MASTER_SWIG_WEBUI_OBJ = webui/master/swig/master_wrap.o
@@ -120,14 +121,13 @@ SLAVE_SWIG_WEBUI_OBJ = webui/slave/swig/
WEBUI_OBJ = $(MASTER_WEBUI_OBJ) $(SLAVE_WEBUI_OBJ)
SWIG_WEBUI_OBJ = $(MASTER_SWIG_WEBUI_OBJ) $(SLAVE_SWIG_WEBUI_OBJ)
-COMMON_OBJ = common/fatal.o common/lock.o detector/detector.o \
+COMMON_OBJ = common/fatal.o messaging/messages.o common/lock.o \
+ detector/detector.o common/params.o \
detector/url_processor.o configurator/configurator.o \
- common/string_utils.o common/logging.o \
- common/date_utils.o common/tokenize.o common/resources.o \
- messaging/messages.o
+ common/string_utils.o common/logging.o common/date_utils.o
ifeq ($(WITH_ZOOKEEPER),1)
- COMMON_OBJ += common/zookeeper.o
+ COMMON_OBJ += detector/zookeeper.o
endif
EXEC_LIB_OBJ = exec/exec.o
@@ -136,18 +136,17 @@ SCHED_LIB_OBJ = sched/sched.o local/loca
BASIC_OBJ = $(MASTER_OBJ) $(SLAVE_OBJ) $(COMMON_OBJ) \
$(SCHED_LIB_OBJ) $(EXEC_LIB_OBJ)
-ALL_OBJ = $(PROTOBUF_OBJ) $(BASIC_OBJ) $(WEBUI_OBJ) $(SWIG_WEBUI_OBJ)
+ALL_OBJ = $(BASIC_OBJ) $(WEBUI_OBJ) $(SWIG_WEBUI_OBJ)
-MASTER_EXE_OBJ = $(MASTER_OBJ) $(MASTER_WEBUI_OBJ) \
- $(MASTER_SWIG_WEBUI_OBJ) $(COMMON_OBJ) common/build.o
+MASTER_EXE_OBJ = $(MASTER_OBJ) $(MASTER_WEBUI_OBJ) \
+ $(MASTER_SWIG_WEBUI_OBJ) $(COMMON_OBJ)
-SLAVE_EXE_OBJ = $(SLAVE_OBJ) $(SLAVE_WEBUI_OBJ) \
- $(SLAVE_SWIG_WEBUI_OBJ) $(COMMON_OBJ) common/build.o
+SLAVE_EXE_OBJ = $(SLAVE_OBJ) $(SLAVE_WEBUI_OBJ) \
+ $(SLAVE_SWIG_WEBUI_OBJ) $(COMMON_OBJ)
LAUNCHER_EXE_OBJ = launcher/launcher.o $(COMMON_OBJ)
-LOCAL_EXE_OBJ = local/local.o $(MASTER_OBJ) $(SLAVE_OBJ) $(COMMON_OBJ) \
- common/build.o
+LOCAL_EXE_OBJ = local/local.o $(MASTER_OBJ) $(SLAVE_OBJ) $(COMMON_OBJ)
MESOS_MASTER_EXE = $(BINDIR)/mesos-master
MESOS_SLAVE_EXE = $(BINDIR)/mesos-slave
@@ -177,10 +176,6 @@ endif
MESOS_LIBS = $(MESOS_LIB) $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB)
-MESOS_JAVA_LIB_OBJ = java/jni/convert.o java/jni/construct.o \
- java/jni/org_apache_mesos_MesosSchedulerDriver.o \
- java/jni/org_apache_mesos_MesosExecutorDriver.o
-
# Java and Python shared libraries which contain the everything in
# MESOS_LIB as well as the SWIG wrappers (note, Java requires the use
# of the .dylib suffix on Mac OS X, but at the time Python required
@@ -195,14 +190,6 @@ MESOS_JAVA_JAR = $(LIBDIR)/java/mesos.ja
MESOS_PYTHON_LIB = $(LIBDIR)/python/_mesos.so
-MESOS_PYTHON_LIB_OBJ = python/native/module.o \
- python/native/proxy_scheduler.o \
- python/native/mesos_scheduler_driver_impl.o \
- python/native/proxy_executor.o \
- python/native/mesos_executor_driver_impl.o
-
-MESOS_PYTHON_FILE = $(LIBDIR)/python/mesos.py
-
# We copy all the webui files into the bin directory.
WEBUI_FILES = $(BINDIR)/webui/bottle-0.8.3 \
$(BINDIR)/webui/common/webui_lib.py \
@@ -238,9 +225,9 @@ WEBUI_DIRECTORIES = $(BINDIR)/webui/comm
$(BINDIR)/webui/master/swig \
$(BINDIR)/webui/slave/swig
-DIRECTORIES = $(INCLUDEDIR) $(BINDIR) $(LIBDIR) $(LIBDIR)/java \
- $(LIBDIR)/python $(CONFDIR) $(DEPLOYDIR) \
- $(OBJ_DIRECTORIES) $(WEBUI_DIRECTORIES)
+DIRECTORIES = $(BINDIR) $(LIBDIR) $(LIBDIR)/java $(LIBDIR)/python \
+ $(CONFDIR) $(DEPLOYDIR) $(OBJ_DIRECTORIES) \
+ $(WEBUI_DIRECTORIES)
default: all
@@ -251,56 +238,39 @@ default: all
$(DIRECTORIES): %:
mkdir -p $@
-mesos.pb.cc: @top_srcdir@/include/mesos.proto
- mkdir -p java/generated
- $(PROTOC) -I@top_srcdir@/include --cpp_out=. --java_out=java/generated @top_srcdir@/include/mesos.proto
-
-$(INCLUDEDIR)/mesos.hpp: mesos.pb.cc | $(INCLUDEDIR)
- cp mesos.pb.h $(INCLUDEDIR)/mesos.hpp
-
-messaging/messages.pb.cc: $(SRCDIR)/messaging/messages.proto
- mkdir -p messaging
- $(PROTOC) -I$(SRCDIR)/messaging -I@top_srcdir@/include --cpp_out=messaging $(SRCDIR)/messaging/messages.proto
-
-common/build.o: $(SRCDIR)/common/build.cpp force | common
- $(CXX) -c $(CXXFLAGS) -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\"" -DBUILD_USER="\"$$USER\"" -DBUILD_FLAGS="\"$(CFLAGS) $(CXXFLAGS)\"" -o $@ $<
-
-$(PROTOBUF_OBJ): %.pb.o: %.pb.cc $(INCLUDEDIR)/mesos.hpp
- $(CXX) -c $(CXXFLAGS) -I@top_srcdir@/$(PROTOBUF)/src -I. -o $@ $<
-
-$(BASIC_OBJ): %.o: $(SRCDIR)/%.cpp $(PROTOBUF_OBJ) | $(OBJ_DIRECTORIES)
+$(BASIC_OBJ): %.o: @srcdir@/%.cpp | $(OBJ_DIRECTORIES)
$(CXX) -c $(CXXFLAGS) -o $@ $<
-$(WEBUI_OBJ): %.o: $(SRCDIR)/%.cpp
- $(CXX) -c $(CXXFLAGS) $(WEBUI_CXXFLAGS) -o $@ $<
-
-$(SWIG_WEBUI_OBJ): %.o: %.cpp
- $(CXX) -c $(CXXFLAGS) $(WEBUI_CXXFLAGS) -o $@ $<
-
$(MESOS_LIBS): $(COMMON_OBJ) | $(LIBDIR)
-$(MESOS_SCHED_LIB):$(SCHED_LIB_OBJ) $(MASTER_OBJ) $(SLAVE_OBJ) $(PROTOBUF_OBJ) common/build.o
+$(MESOS_SCHED_LIB): $(SCHED_LIB_OBJ) $(MASTER_OBJ) $(SLAVE_OBJ)
$(AR) rcs $@ $^
-$(MESOS_EXEC_LIB): $(EXEC_LIB_OBJ) $(PROTOBUF_OBJ) common/build.o
+$(MESOS_EXEC_LIB): $(EXEC_LIB_OBJ)
$(AR) rcs $@ $^
-$(MESOS_LIB): $(SCHED_LIB_OBJ) $(MASTER_OBJ) $(SLAVE_OBJ) $(EXEC_LIB_OBJ) $(PROTOBUF_OBJ) common/build.o
+$(MESOS_LIB): $(SCHED_LIB_OBJ) $(MASTER_OBJ) $(SLAVE_OBJ) $(EXEC_LIB_OBJ)
$(CXX) $(CXXFLAGS) -shared -o $@ $^ $(LDFLAGS) $(LIBS)
-webui/master/swig/master_wrap.cpp: $(SRCDIR)/webui/master/swig/master.i $(SRCDIR)/master/state.hpp $(SRCDIR)/master/webui.hpp $(SRCDIR)/master/master.hpp config/config.hpp $(BINDIR)/webui/master/swig
+$(WEBUI_OBJ): %.o: @srcdir@/%.cpp
+ $(CXX) -c $(CXXFLAGS) $(WEBUI_CXXFLAGS) -o $@ $<
+
+$(SWIG_WEBUI_OBJ): %.o: %.cpp
+ $(CXX) -c $(CXXFLAGS) $(WEBUI_CXXFLAGS) -o $@ $<
+
+webui/master/swig/master_wrap.cpp: @srcdir@/webui/master/swig/master.i @srcdir@/master/state.hpp @srcdir@/master/webui.hpp @srcdir@/master/master.hpp config/config.hpp $(BINDIR)/webui/master/swig
ifeq ($(WITH_WEBUI),1)
mkdir -p webui/master/swig
- $(SWIG) -c++ -python -outdir webui/master/swig -I$(SRCDIR) -o $@ $<
+ $(SWIG) -c++ -python -outdir webui/master/swig -I@top_srcdir@/include -I@srcdir@ -o $@ $<
cp -r webui/master/swig/master.py $(BINDIR)/webui/master/swig
else
echo "" > $@
endif
-webui/slave/swig/slave_wrap.cpp: $(SRCDIR)/webui/slave/swig/slave.i $(SRCDIR)/slave/state.hpp $(SRCDIR)/slave/webui.hpp $(SRCDIR)/slave/slave.hpp config/config.hpp $(BINDIR)/webui/slave/swig
+webui/slave/swig/slave_wrap.cpp: @srcdir@/webui/slave/swig/slave.i @srcdir@/slave/state.hpp @srcdir@/slave/webui.hpp @srcdir@/slave/slave.hpp config/config.hpp $(BINDIR)/webui/slave/swig
ifeq ($(WITH_WEBUI),1)
mkdir -p webui/slave/swig
- $(SWIG) -c++ -python -outdir webui/slave/swig -I$(SRCDIR) -o $@ $<
+ $(SWIG) -c++ -python -outdir webui/slave/swig -I@top_srcdir@/include -I@srcdir@ -o $@ $<
cp -r webui/slave/swig/slave.py $(BINDIR)/webui/slave/swig
else
echo "" > $@
@@ -308,88 +278,70 @@ endif
$(MESOS_EXES): | $(BINDIR)
-$(MESOS_MASTER_EXE): $(SRCDIR)/master/main.cpp $(MASTER_EXE_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(MASTER_EXE_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(WEBUI_LDFLAGS) $(LIBS)
+$(MESOS_MASTER_EXE): @srcdir@/master/main.cpp $(MASTER_EXE_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< $(MASTER_EXE_OBJ) $(LDFLAGS) $(WEBUI_LDFLAGS) $(LIBS)
-$(MESOS_SLAVE_EXE): $(SRCDIR)/slave/main.cpp $(SLAVE_EXE_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(SLAVE_EXE_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(WEBUI_LDFLAGS) $(LIBS)
+$(MESOS_SLAVE_EXE): @srcdir@/slave/main.cpp $(SLAVE_EXE_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< $(SLAVE_EXE_OBJ) $(LDFLAGS) $(WEBUI_LDFLAGS) $(LIBS)
-$(MESOS_LAUNCHER_EXE): $(SRCDIR)/launcher/main.cpp $(LAUNCHER_EXE_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(LAUNCHER_EXE_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(LIBS)
+$(MESOS_LAUNCHER_EXE): @srcdir@/launcher/main.cpp $(LAUNCHER_EXE_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< launcher/launcher.o $(COMMON_OBJ) $(LDFLAGS) $(LIBS)
-$(MESOS_LOCAL_EXE): $(SRCDIR)/local/main.cpp $(LOCAL_EXE_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(LOCAL_EXE_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(LIBS)
+$(MESOS_LOCAL_EXE): @srcdir@/local/main.cpp $(LOCAL_EXE_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< $(LOCAL_EXE_OBJ) $(LDFLAGS) $(LIBS)
-$(MESOS_GETCONF_EXE): $(SRCDIR)/configurator/get_conf.cpp $(COMMON_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(COMMON_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(LIBS)
+$(MESOS_GETCONF_EXE): @srcdir@/configurator/get_conf.cpp $(COMMON_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< $(COMMON_OBJ) $(LDFLAGS) $(LIBS)
-$(MESOS_PROJD_EXE): $(SRCDIR)/slave/projd.cpp $(COMMON_OBJ) $(PROTOBUF_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $< $(COMMON_OBJ) $(PROTOBUF_OBJ) $(LDFLAGS) $(LIBS)
+$(MESOS_PROJD_EXE): @srcdir@/slave/projd.cpp $(COMMON_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $< $(COMMON_OBJ) $(LDFLAGS) $(LIBS)
java: $(MESOS_JAVA_LIB) $(MESOS_JAVA_JAR)
-$(MESOS_JAVA_JAR): $(SRCDIR)/java/src/org/apache/mesos/*.java @top_srcdir@/include/mesos.proto | $(LIBDIR)/java
-ifdef JAVA_HOME
- mkdir -p @top_builddir@/$(PROTOBUF)/java/src/main/java
- $(PROTOC) --java_out=@top_builddir@/$(PROTOBUF)/java/src/main/java -I@top_srcdir@/$(PROTOBUF)/src @top_srcdir@/$(PROTOBUF)/src/google/protobuf/descriptor.proto
- $(JAVA_HOME)/bin/javac -d @top_builddir@/$(PROTOBUF)/java/src/main/java @top_srcdir@/$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java @top_builddir@/$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java
- rm -f java/classes/org/apache/mesos/*
- mkdir -p java/classes/org/apache/mesos
- $(JAVA_HOME)/bin/javac -classpath @top_builddir@/$(PROTOBUF)/java/src/main/java -sourcepath java/generated -d java/classes java/generated/org/apache/mesos/*.java
- $(JAVA_HOME)/bin/javac -classpath @top_builddir@/$(PROTOBUF)/java/src/main/java:java/classes -sourcepath $(SRCDIR)/java/src -d java/classes $(SRCDIR)/java/src/org/apache/mesos/*.java
- $(JAVA_HOME)/bin/jar cf $@ -C java/classes org
- $(JAVA_HOME)/bin/javah -d java/jni -classpath @top_builddir@/$(PROTOBUF)/java/src/main/java:java/classes org.apache.mesos.MesosSchedulerDriver
- $(JAVA_HOME)/bin/javah -d java/jni -classpath @top_builddir@/$(PROTOBUF)/java/src/main/java:java/classes org.apache.mesos.MesosExecutorDriver
-endif
-
-$(MESOS_JAVA_LIB_OBJ): %.o: $(SRCDIR)/%.cpp $(MESOS_JAVA_JAR)
- $(CXX) -c $(CXXFLAGS) -Ijava/jni -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(OS_NAME) -I $(JAVA_HEADERS) -o $@ $<
+python: $(MESOS_PYTHON_LIB)
-$(MESOS_JAVA_LIB): $(MESOS_JAVA_LIB_OBJ) $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) | $(LIBDIR)/java
+$(MESOS_JAVA_JAR): $(MESOS_JAVA_LIB) | $(LIBDIR)/java
ifdef JAVA_HOME
- $(CXX) $(CXXFLAGS) -shared -o $@ $(MESOS_JAVA_LIB_OBJ) $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) $(LDFLAGS) $(LIBS)
-endif
-
-python: $(MESOS_PYTHON_LIB) $(MESOS_PYTHON_FILE) $(MESOS_PYTHON_PROTOBUFS)
-
-$(MESOS_PYTHON_LIB_OBJ): %.o: $(SRCDIR)/%.cpp
-ifdef PYTHON_HEADERS
- mkdir -p python/native
- $(CXX) -c $(CXXFLAGS) -Ipython/native -I$(PYTHON_HEADERS) -o $@ $<
+ patch -N swig/java/mesos/mesosJNI.java < @srcdir@/swig/java/mesosJNI.java.patch1 || echo -n
+ patch swig/java/mesos/mesosJNI.java < @srcdir@/swig/java/mesosJNI.java.patch2 || echo -n
+ $(JAVA_HOME)/bin/javac -sourcepath swig/java -d swig/java swig/java/mesos/*.java
+ $(JAVA_HOME)/bin/jar cf $@ -C swig/java mesos
endif
-$(MESOS_PYTHON_LIB): $(MESOS_PYTHON_LIB_OBJ) $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) | $(LIBDIR)/python
-ifdef PYTHON_HEADERS
- $(CXX) $(CXXFLAGS) -shared -o $@ $(MESOS_PYTHON_LIB_OBJ) $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) $(LDFLAGS) $(PYTHON_LDFLAGS) $(LIBS)
+$(MESOS_JAVA_LIB): @srcdir@/swig/mesos.i $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) | $(LIBDIR)/java
+ifdef JAVA_HOME
+ rm -f swig/java/mesos/*
+ mkdir -p swig/java/mesos
+ $(SWIG) -c++ -java -I@top_srcdir@/include -o swig/java/mesos_wrap.cpp -outdir swig/java/mesos -package mesos @srcdir@/swig/mesos.i
+ $(CXX) $(CXXFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HEADERS) -shared -o $@ swig/java/mesos_wrap.cpp $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) $(LDFLAGS) $(LIBS)
endif
-$(MESOS_PYTHON_FILE): $(SRCDIR)/python/src/mesos.py @top_srcdir@/include/mesos.proto | $(LIBDIR)/python
+$(MESOS_PYTHON_LIB): @srcdir@/swig/mesos.i $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) | $(LIBDIR)/python
ifdef PYTHON_HEADERS
- cp -r @top_srcdir@/$(PROTOBUF)/python @top_builddir@/$(PROTOBUF)/python
- cp $< $@
- $(PROTOC) --python_out=@top_builddir@/$(PROTOBUF)/python -I@top_srcdir@/$(PROTOBUF)/src @top_srcdir@/$(PROTOBUF)/src/google/protobuf/descriptor.proto
- $(PROTOC) --python_out=$(LIBDIR)/python -I@top_srcdir@/include @top_srcdir@/include/mesos.proto
+ mkdir -p swig/python
+ $(SWIG) -c++ -python -threads -I@top_srcdir@/include -o swig/python/mesos_wrap.cpp -outdir swig/python @srcdir@/swig/mesos.i
+ $(CXX) $(CXXFLAGS) -I$(PYTHON_HEADERS) -shared -o $@ swig/python/mesos_wrap.cpp $(MESOS_SCHED_LIB) $(MESOS_EXEC_LIB) $(LDFLAGS) $(PYTHON_LDFLAGS) $(LIBS)
+ cp -r swig/python/mesos.py $(LIBDIR)/python/mesos.py
endif
-$(WEBUI_FILES): $(BINDIR)/%: $(SRCDIR)/% | $(WEBUI_DIRECTORIES)
+$(WEBUI_FILES): $(BINDIR)/%: @srcdir@/% | $(WEBUI_DIRECTORIES)
ifeq ($(WITH_WEBUI),1)
cp -r $< $@
endif
-$(DEPLOY_FILES): $(DEPLOYDIR)/%: $(SRCDIR)/deploy/% | $(DEPLOYDIR)
+$(DEPLOY_FILES): $(DEPLOYDIR)/%: @srcdir@/deploy/% | $(DEPLOYDIR)
cp -r $< $@
-$(CONFDIR)/mesos.conf: | $(SRCDIR)/conf/mesos.conf.template $(CONFDIR)
- cp -r $(SRCDIR)/conf/mesos.conf.template $@
+$(CONFDIR)/mesos.conf: | @srcdir@/conf/mesos.conf.template $(CONFDIR)
+ cp -r @srcdir@/conf/mesos.conf.template $@
-$(CONFDIR)/deploy-env.sh: | $(SRCDIR)/conf/deploy-env.sh.template $(CONFDIR)
- cp -r $(SRCDIR)/conf/deploy-env.sh.template $@
+$(CONFDIR)/deploy-env.sh: | @srcdir@/conf/deploy-env.sh.template $(CONFDIR)
+ cp -r @srcdir@/conf/deploy-env.sh.template $@
test: all
$(MAKE) -C tests test
-#all: $(MESOS_LIBS) $(MESOS_EXES) java python $(WEBUI_FILES) $(CONF_FILES) $(DEPLOY_FILES)
-all: $(MESOS_LIBS) $(MESOS_EXES) java $(WEBUI_FILES) $(CONF_FILES) $(DEPLOY_FILES)
+all: $(MESOS_LIBS) $(MESOS_EXES) java python $(WEBUI_FILES) $(CONF_FILES) $(DEPLOY_FILES)
$(MAKE) -C examples
$(MAKE) -C tests
@@ -431,9 +383,6 @@ clean:
rm -f $(BINDIR)/webui/master/swig/master.py
rm -f $(BINDIR)/webui/master/swig/master.pc
rm -f $(DEPLOY_FILES)
- rm -f $(INCLUDEDIR)/mesos.hpp
- rm -f mesos.pb.cc
- rm -f mesos.pb.h
rm -f TAGS
-.PHONY: default java python test all clean force
+.PHONY: default java python test all clean
Modified: incubator/mesos/trunk/src/common/date_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/date_utils.cpp?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/date_utils.cpp (original)
+++ incubator/mesos/trunk/src/common/date_utils.cpp Sun Jun 5 09:25:41 2011
@@ -1,13 +1,7 @@
-#include <ctime>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
#include <time.h>
-#include <common/fatal.hpp>
#include "date_utils.hpp"
-
using std::string;
using namespace mesos::internal;
@@ -19,7 +13,7 @@ string DateUtils::mockDate = "";
// Get the current date in the format used for Mesos IDs (YYYYMMDDhhmm).
-string DateUtils::humanReadableDate()
+string DateUtils::currentDate()
{
if (useMockDate) {
return mockDate;
@@ -35,26 +29,6 @@ string DateUtils::humanReadableDate()
}
-// Get the current time in microseconds since the UNIX epoch.
-long DateUtils::currentDateInMicro() {
- if (useMockDate) {
- struct tm timeinfo;
- memset(&timeinfo, 0, sizeof(timeinfo));
- if (strptime(mockDate.c_str(), "%Y%m%d%H%M", &timeinfo) == NULL) {
- fatal("Failed to parse MockDate in date_utils.cpp. strptime returned NULL");
- }
- time_t rawtime = timegm(&timeinfo);
- long microSinceEpoch = rawtime * 1000000;
- return microSinceEpoch;
- } else {
- struct timeval curr_time;
- struct timezone tzp;
- gettimeofday(&curr_time, &tzp);
- return (long)(curr_time.tv_sec * 1000000 + curr_time.tv_usec);
- }
-}
-
-
// Unit test utility method that makes this class return a fixed string
// as the date instead of looking up the current time.
void DateUtils::setMockDate(string date)
Modified: incubator/mesos/trunk/src/common/date_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/date_utils.hpp?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/date_utils.hpp (original)
+++ incubator/mesos/trunk/src/common/date_utils.hpp Sun Jun 5 09:25:41 2011
@@ -15,12 +15,7 @@ public:
/**
* Get the current date in the format used for Mesos IDs (YYYYMMDDhhmm).
*/
- static std::string humanReadableDate();
-
- /**
- * Get the current time in microseconds since the UNIX epoch.
- */
- static long currentDateInMicro();
+ static std::string currentDate();
/**
* Unit test utility method that makes this class return a fixed string
Modified: incubator/mesos/trunk/src/config/config.hpp.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/config/config.hpp.in?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/config/config.hpp.in (original)
+++ incubator/mesos/trunk/src/config/config.hpp.in Sun Jun 5 09:25:41 2011
@@ -3,10 +3,6 @@
/* This header gets completed by configure. */
-#if @WITH_INCLUDED_SQLITE@
- #define WITH_INCLUDED_SQLITE
-#endif
-
#if @WITH_ZOOKEEPER@
#define WITH_ZOOKEEPER
#endif
Modified: incubator/mesos/trunk/src/examples/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/Makefile.in?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/Makefile.in (original)
+++ incubator/mesos/trunk/src/examples/Makefile.in Sun Jun 5 09:25:41 2011
@@ -2,8 +2,6 @@
SHELL = '/bin/sh'
-SRCDIR = @srcdir@
-INCLUDEDIR = @top_builddir@/include
BINDIR = @top_builddir@/bin
LIBDIR = @top_builddir@/lib
@@ -25,32 +23,25 @@ WITH_ZOOKEEPER = @WITH_ZOOKEEPER@
WITH_INCLUDED_ZOOKEEPER = @WITH_INCLUDED_ZOOKEEPER@
-BOOST = third_party/boost-1.37.0
-PROTOBUF = third_party/protobuf-2.3.0
-GLOG = third_party/glog-0.3.1
LIBPROCESS = third_party/libprocess
+
LIBEV = $(LIBPROCESS)/third_party/libev-3.8
+
+GLOG = third_party/glog-0.3.1
+
ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
# Ensure that we get better debugging info.
CFLAGS += -g
CXXFLAGS += -g
-# Add include and build include to CFLAGS and CXXFLAGS.
-CFLAGS += -I@top_srcdir@/include -I$(INCLUDEDIR)
-CXXFLAGS += -I@top_srcdir@/include -I$(INCLUDEDIR)
+# Add include to CFLAGS and CXXFLAGS.
+CFLAGS += -I@top_srcdir@/include
+CXXFLAGS += -I@top_srcdir@/include
# Add boost to CFLAGS and CXXFLAGS.
-CFLAGS += -I@top_srcdir@/$(BOOST)
-CXXFLAGS += -I@top_srcdir@/$(BOOST)
-
-# Add glog to include and lib paths.
-CXXFLAGS += -I@top_srcdir@/$(GLOG)/src -I@top_builddir@/$(GLOG)/src
-LDFLAGS += -L@top_builddir@/$(GLOG)/.libs
-
-# Add protobuf to include and lib paths.
-CXXFLAGS += -I@top_srcdir@/$(PROTOBUF)/src
-LDFLAGS += -L@top_builddir@/$(PROTOBUF)/src/.libs
+CFLAGS += -I@top_srcdir@/third_party/boost-1.37.0
+CXXFLAGS += -I@top_srcdir@/third_party/boost-1.37.0
# Add libprocess to CFLAGS, CXXFLAGS, and LDFLAGS.
CFLAGS += -I@top_srcdir@/$(LIBPROCESS)
@@ -60,6 +51,10 @@ LDFLAGS += -L@top_builddir@/$(LIBPROCESS
# Add libev to LDFLAGS.
LDFLAGS += -L@top_builddir@/$(LIBEV)/.libs
+# Add glog to include and lib paths.
+CXXFLAGS += -I@top_srcdir@/$(GLOG)/src -I@top_builddir@/$(GLOG)/src
+LDFLAGS += -L@top_builddir@/$(GLOG)/.libs
+
# Add included ZooKeeper to include and lib paths if necessary.
ifeq ($(WITH_INCLUDED_ZOOKEEPER),1)
CXXFLAGS += -I@top_srcdir@/$(ZOOKEEPER)/include -I@top_srcdir@/$(ZOOKEEPER)/generated
@@ -70,19 +65,32 @@ endif
CFLAGS += -MMD -MP
CXXFLAGS += -MMD -MP
-# Add protobuf, glog, libev, libprocess, pthread, and dl to LIBS.
-LIBS += -lprotobuf -lglog -lprocess -lev -lpthread -ldl
+# Add build date to CFLAGS, CXXFLAGS
+CFLAGS += -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\""
+CXXFLAGS += -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\""
+
+# Add build user to CFLAGS, CXXFLAGS
+CFLAGS += -DBUILD_USER="\"$$USER\""
+CXXFLAGS += -DBUILD_USER="\"$$USER\""
+
+# Add libev to LDFLAGS.
+LDFLAGS += -L$(LIBEV)/.libs
+
+# Add glog, libev, libprocess, pthread, and dl to LIBS.
+LIBS += -lglog -lprocess -lev -lpthread -ldl
# Add ZooKeeper if necessary.
ifeq ($(WITH_ZOOKEEPER),1)
- LIBS += -lzookeeper_mt
+ LIBS += -lzookeeper_st
endif
-SCHED_EXES = $(BINDIR)/examples/cpp-test-framework \
+SCHED_EXES = $(BINDIR)/examples/test-framework \
+ $(BINDIR)/examples/cpp-test-framework \
$(BINDIR)/examples/memhog \
$(BINDIR)/examples/scheduled-memhog
-EXEC_EXES = $(BINDIR)/examples/cpp-test-executor \
+EXEC_EXES = $(BINDIR)/examples/test-executor \
+ $(BINDIR)/examples/cpp-test-executor \
$(BINDIR)/examples/memhog-executor
EXAMPLES_EXES = $(SCHED_EXES) $(EXEC_EXES)
@@ -94,7 +102,6 @@ MESOS_EXEC_LIB = $(LIBDIR)/libmesos_exec
# automagically by configure.
DIRECTORIES = $(BINDIR)/examples
-
default: all
-include $(patsubst %, %.d, $(EXAMPLES_EXES))
@@ -135,8 +142,7 @@ ifdef PYTHON_HEADERS
$(MAKE) -C python
endif
-#all: $(EXAMPLES_EXES) java python
-all: $(EXAMPLES_EXES) java
+all: $(EXAMPLES_EXES) java python
clean:
rm -f $(patsubst %, %.d, $(EXAMPLES_EXES))
Modified: incubator/mesos/trunk/src/local/local.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/local/local.cpp?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/local/local.cpp (original)
+++ incubator/mesos/trunk/src/local/local.cpp Sun Jun 5 09:25:41 2011
@@ -1,7 +1,6 @@
#include <pthread.h>
#include <map>
-#include <sstream>
#include <vector>
#include "local.hpp"
@@ -11,27 +10,20 @@
#include "configurator/configurator.hpp"
-#include "detector/detector.hpp"
-
#include "master/master.hpp"
#include "slave/process_based_isolation_module.hpp"
#include "slave/slave.hpp"
-using namespace mesos::internal;
+using std::map;
+using std::vector;
using mesos::internal::master::Master;
-
using mesos::internal::slave::Slave;
using mesos::internal::slave::IsolationModule;
using mesos::internal::slave::ProcessBasedIsolationModule;
-using process::PID;
-using process::UPID;
-
-using std::map;
-using std::stringstream;
-using std::vector;
+using namespace mesos::internal;
namespace {
@@ -43,68 +35,59 @@ void initialize_glog() {
google::InitGoogleLogging("mesos-local");
}
-} // namespace {
+} /* namespace { */
namespace mesos { namespace internal { namespace local {
-static Master* master = NULL;
+static Master *master = NULL;
static map<IsolationModule*, Slave*> slaves;
-static MasterDetector* detector = NULL;
+static MasterDetector *detector = NULL;
-void registerOptions(Configurator* configurator)
+void registerOptions(Configurator* conf)
{
- Logging::registerOptions(configurator);
- Master::registerOptions(configurator);
- Slave::registerOptions(configurator);
- configurator->addOption<int>("num_slaves",
- "Number of slaves to create for local cluster",
- 1);
+ conf->addOption<int>("slaves", 's', "Number of slaves", 1);
+ Logging::registerOptions(conf);
+ Master::registerOptions(conf);
+ Slave::registerOptions(conf);
}
-PID<Master> launch(int numSlaves,
- int32_t cpus,
- int64_t mem,
- bool initLogging,
- bool quiet)
+PID launch(int numSlaves,
+ int32_t cpus,
+ int64_t mem,
+ bool initLogging,
+ bool quiet)
{
- Configuration conf;
- conf.set("slaves", "*");
- conf.set("num_slaves", numSlaves);
+ Params conf;
+ conf.set("slaves", numSlaves);
+ conf.set("cpus", cpus);
+ conf.set("mem", mem);
conf.set("quiet", quiet);
-
- stringstream out;
- out << "cpus:" << cpus << ";" << "mem:" << mem;
- conf.set("resources", out.str());
-
return launch(conf, initLogging);
}
-PID<Master> launch(const Configuration& conf,
- bool initLogging)
+PID launch(const Params& conf, bool initLogging)
{
- int numSlaves = conf.get<int>("num_slaves", 1);
+ int numSlaves = conf.get<int>("slaves", 1);
bool quiet = conf.get<bool>("quiet", false);
- if (master != NULL) {
+ if (master != NULL)
fatal("can only launch one local cluster at a time (for now)");
- }
if (initLogging) {
pthread_once(&glog_initialized, initialize_glog);
- if (!quiet) {
+ if (!quiet)
google::SetStderrLogging(google::INFO);
- }
}
master = new Master(conf);
- PID<Master> pid = process::spawn(master);
+ PID pid = Process::spawn(master);
- vector<UPID> pids;
+ vector<PID> pids;
for (int i = 0; i < numSlaves; i++) {
// TODO(benh): Create a local isolation module?
@@ -112,7 +95,7 @@ PID<Master> launch(const Configuration&
new ProcessBasedIsolationModule();
Slave* slave = new Slave(conf, true, isolationModule);
slaves[isolationModule] = slave;
- pids.push_back(process::spawn(slave));
+ pids.push_back(Process::spawn(slave));
}
detector = new BasicMasterDetector(pid, pids, true);
@@ -123,30 +106,28 @@ PID<Master> launch(const Configuration&
void shutdown()
{
- if (master != NULL) {
- process::post(master->self(), process::TERMINATE);
- process::wait(master->self());
- delete master;
- master = NULL;
-
- // TODO(benh): Ugh! Because the isolation module calls back into the
- // slave (not the best design) we can't delete the slave until we
- // have deleted the isolation module. But since the slave calls into
- // the isolation module, we can't delete the isolation module until
- // we have stopped the slave.
-
- foreachpair (IsolationModule* isolationModule, Slave* slave, slaves) {
- process::post(slave->self(), process::TERMINATE);
- process::wait(slave->self());
- delete isolationModule;
- delete slave;
- }
+ MesosProcess::post(master->self(), pack<M2M_SHUTDOWN>());
+ Process::wait(master->self());
+ delete master;
+ master = NULL;
+
+ // TODO(benh): Ugh! Because the isolation module calls back into the
+ // slave (not the best design) we can't delete the slave until we
+ // have deleted the isolation module. But since the slave calls into
+ // the isolation module, we can't delete the isolation module until
+ // we have stopped the slave.
+
+ foreachpair (IsolationModule *isolationModule, Slave *slave, slaves) {
+ MesosProcess::post(slave->self(), pack<S2S_SHUTDOWN>());
+ Process::wait(slave->self());
+ delete isolationModule;
+ delete slave;
+ }
- slaves.clear();
+ slaves.clear();
- delete detector;
- detector = NULL;
- }
+ delete detector;
+ detector = NULL;
}
-}}} // namespace mesos { namespace internal { namespace local {
+}}} /* namespace mesos { namespace internal { namespace local { */
Modified: incubator/mesos/trunk/src/master/main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/main.cpp?rev=1132329&r1=1132328&r2=1132329&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/main.cpp (original)
+++ incubator/mesos/trunk/src/master/main.cpp Sun Jun 5 09:25:41 2011
@@ -1,25 +1,21 @@
#include <libgen.h>
-#include "common/build.hpp"
-#include "common/fatal.hpp"
#include "common/logging.hpp"
#include "configurator/configurator.hpp"
-#include "detector/detector.hpp"
-
#include "master.hpp"
#include "webui.hpp"
-using namespace mesos::internal;
-using namespace mesos::internal::master;
-
using std::cerr;
using std::endl;
-using std::string;
+using boost::lexical_cast;
+using boost::bad_lexical_cast;
+
+using namespace mesos::internal::master;
-void usage(const char* progName, const Configurator& configurator)
+void usage(const char* progName, const Configurator& conf)
{
cerr << "Usage: " << progName << " [--port=PORT] [--url=URL] [...]" << endl
<< endl
@@ -28,69 +24,62 @@ void usage(const char* progName, const C
<< " zoofile://file where file has one host:port pair per line" << endl
<< endl
<< "Supported options:" << endl
- << configurator.getUsage();
+ << conf.getUsage();
}
int main(int argc, char **argv)
{
- Configurator configurator;
- Logging::registerOptions(&configurator);
- Master::registerOptions(&configurator);
- configurator.addOption<int>("port", 'p', "Port to listen on", 5050);
- configurator.addOption<string>("ip", "IP address to listen on");
- configurator.addOption<string>("url", 'u', "URL used for leader election");
+ Configurator conf;
+ conf.addOption<string>("url", 'u', "URL used for leader election");
+ conf.addOption<int>("port", 'p', "Port to listen on", 5050);
+ conf.addOption<string>("ip", "IP address to listen on");
#ifdef MESOS_WEBUI
- configurator.addOption<int>("webui_port", 'w', "Web UI port", 8080);
+ conf.addOption<int>("webui_port", 'w', "Web UI port", 8080);
#endif
+ Logging::registerOptions(&conf);
+ Master::registerOptions(&conf);
if (argc == 2 && string("--help") == argv[1]) {
- usage(argv[0], configurator);
+ usage(argv[0], conf);
exit(1);
}
- Configuration conf;
+ Params params;
try {
- conf = configurator.load(argc, argv, true);
+ params = conf.load(argc, argv, true);
} catch (ConfigurationException& e) {
cerr << "Configuration error: " << e.what() << endl;
exit(1);
}
- Logging::init(argv[0], conf);
+ Logging::init(argv[0], params);
- if (conf.contains("port")) {
- setenv("LIBPROCESS_PORT", conf["port"].c_str(), 1);
- }
-
- if (conf.contains("ip")) {
- setenv("LIBPROCESS_IP", conf["ip"].c_str(), 1);
- }
+ if (params.contains("port"))
+ setenv("LIBPROCESS_PORT", params["port"].c_str(), 1);
- // Initialize libprocess library (but not glog, done above).
- process::initialize(false);
+ if (params.contains("ip"))
+ setenv("LIBPROCESS_IP", params["ip"].c_str(), 1);
- string url = conf.get("url", "");
+ string url = params.get("url", "");
- LOG(INFO) << "Build: " << build::DATE << " by " << build::USER;
+ LOG(INFO) << "Build: " << BUILD_DATE << " by " << BUILD_USER;
LOG(INFO) << "Starting Mesos master";
- if (chdir(dirname(argv[0])) != 0) {
+ if (chdir(dirname(argv[0])) != 0)
fatalerror("Could not chdir into %s", dirname(argv[0]));
- }
- Master* master = new Master(conf);
- process::spawn(master);
+ Master *master = new Master(params);
+ PID pid = Process::spawn(master);
- MasterDetector* detector =
- MasterDetector::create(url, master->self(), true, Logging::isQuiet(conf));
+ bool quiet = Logging::isQuiet(params);
+ MasterDetector *detector = MasterDetector::create(url, pid, true, quiet);
#ifdef MESOS_WEBUI
- startMasterWebUI(master->self(), conf);
+ startMasterWebUI(pid, params);
#endif
- process::wait(master->self());
- delete master;
+ Process::wait(pid);
MasterDetector::destroy(detector);