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 05:30:31 UTC

svn commit: r1131618 - in /incubator/mesos/trunk/src: leader_detector.hpp master_main.cpp slave_main.cpp

Author: benh
Date: Sun Jun  5 03:30:31 2011
New Revision: 1131618

URL: http://svn.apache.org/viewvc?rev=1131618&view=rev
Log:
ZK logging output is now affected by --quiet parameter to slave and masters.

Modified:
    incubator/mesos/trunk/src/leader_detector.hpp
    incubator/mesos/trunk/src/master_main.cpp
    incubator/mesos/trunk/src/slave_main.cpp

Modified: incubator/mesos/trunk/src/leader_detector.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/leader_detector.hpp?rev=1131618&r1=1131617&r2=1131618&view=diff
==============================================================================
--- incubator/mesos/trunk/src/leader_detector.hpp (original)
+++ incubator/mesos/trunk/src/leader_detector.hpp Sun Jun  5 03:30:31 2011
@@ -67,6 +67,14 @@ public:
 
   ~LeaderDetector();
 
+  /**
+   * Adjusts ZooKeepers level of debugging output.
+   * @param quiet true makes ZK quiet, whereas false makes ZK output DEBUG messages
+   */ 
+  static void setQuiet(bool quiet) {
+    zoo_set_debug_level( quiet ? ZOO_LOG_LEVEL_ERROR : ZOO_LOG_LEVEL_DEBUG );
+  }
+
 private: 
   static void initWatchWrap(zhandle_t * zh, int type, int state, const char *path, void *watcherCtx);
 

Modified: incubator/mesos/trunk/src/master_main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master_main.cpp?rev=1131618&r1=1131617&r2=1131618&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master_main.cpp (original)
+++ incubator/mesos/trunk/src/master_main.cpp Sun Jun  5 03:30:31 2011
@@ -2,8 +2,8 @@
 
 #include "master.hpp"
 #include "master_webui.hpp"
-#include "zookeeper_master.hpp"
-
+#include "url_processor.hpp"
+#include "leader_detector.hpp"
 
 using std::cerr;
 using std::endl;
@@ -13,10 +13,9 @@ using namespace nexus::internal::master;
 void usage(const char* programName)
 {
   cerr << "Usage: " << programName
-       << " [--port PORT]"
-       << " [--allocator ALLOCATOR]"
-       << " [--zookeeper host:port]"
-       << " [--quiet]"
+       << " [--port PORT] [--allocator ALLOCATOR] [--fault-tolerant ZOO_SERVERS] [--quiet]"
+       << endl
+       << "ZOO_SERVERS is a url of the form zoo://<zoosrv1>,<zoosrv2>..., or zoofile://listfile"
        << endl;
 }
 
@@ -31,17 +30,18 @@ int main (int argc, char **argv)
   option options[] = {
     {"allocator", required_argument, 0, 'a'},
     {"port", required_argument, 0, 'p'},
-    {"zookeeper", required_argument, 0, 'z'},
+    {"fault-tolerant", required_argument, 0, 'f'},
     {"quiet", no_argument, 0, 'q'},
   };
 
+  bool isFT = false;
+  string zooarg = "";
   bool quiet = false;
   string allocator = "simple";
-  string zookeeper;
 
   int opt;
   int index;
-  while ((opt = getopt_long(argc, argv, "a:p:z:q", options, &index)) != -1) {
+  while ((opt = getopt_long(argc, argv, "a:p:f:q", options, &index)) != -1) {
     switch (opt) {
       case 'a':
         allocator = optarg;
@@ -49,9 +49,10 @@ int main (int argc, char **argv)
       case 'p':
         setenv("LIBPROCESS_PORT", optarg, 1);
         break;
-      case 'z':
-        zookeeper = optarg;
-	break;
+      case 'f':
+        isFT = true;
+	zooarg = optarg;
+        break;
       case 'q':
         quiet = true;
         break;
@@ -66,22 +67,24 @@ int main (int argc, char **argv)
 
   if (!quiet)
     google::SetStderrLogging(google::INFO);
-  
+  else if (isFT)
+    LeaderDetector::setQuiet(true);
+
+  FLAGS_log_dir = "/tmp";
   FLAGS_logbufsecs = 1;
   google::InitGoogleLogging(argv[0]);
 
   LOG(INFO) << "Build: " << BUILD_DATE << " by " << BUILD_USER;
   LOG(INFO) << "Starting Nexus master";
-  Master* master = new Master(allocator);
-  PID pid = Process::spawn(master);
-
-  if (!zookeeper.empty())
-    Process::spawn(new ZooKeeperProcessForMaster(pid, zookeeper));
+  if (isFT)
+    LOG(INFO) << "Nexus in fault-tolerant mode";
+  PID master = Process::spawn(new Master(allocator, zooarg));
 
+#undef NEXUS_WEBUI
 #ifdef NEXUS_WEBUI
-  startMasterWebUI(pid);
+  startMasterWebUI(master);
 #endif
   
-  Process::wait(pid);
+  Process::wait(master);
   return 0;
 }

Modified: incubator/mesos/trunk/src/slave_main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave_main.cpp?rev=1131618&r1=1131617&r2=1131618&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave_main.cpp (original)
+++ incubator/mesos/trunk/src/slave_main.cpp Sun Jun  5 03:30:31 2011
@@ -71,6 +71,8 @@ int main(int argc, char **argv)
 
   if (!quiet)
     google::SetStderrLogging(google::INFO);
+  else if (isFT)
+    LeaderDetector::setQuiet(true);
 
   FLAGS_logbufsecs = 1;
   google::InitGoogleLogging(argv[0]);