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 2012/11/04 02:30:38 UTC

svn commit: r1405477 - in /incubator/mesos/branches/0.10.0/src: launcher/launcher.cpp webui/webui.cpp

Author: benh
Date: Sun Nov  4 01:30:38 2012
New Revision: 1405477

URL: http://svn.apache.org/viewvc?rev=1405477&view=rev
Log:
*** MODIFIED FOR 0.10.0 ***
Removed LOG and CHECK from forked processes since they acquire locks.

From: Vinod Kone <vi...@gmail.com>
Review: https://reviews.apache.org/r/7553

Modified:
    incubator/mesos/branches/0.10.0/src/launcher/launcher.cpp
    incubator/mesos/branches/0.10.0/src/webui/webui.cpp

Modified: incubator/mesos/branches/0.10.0/src/launcher/launcher.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.0/src/launcher/launcher.cpp?rev=1405477&r1=1405476&r2=1405477&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.0/src/launcher/launcher.cpp (original)
+++ incubator/mesos/branches/0.10.0/src/launcher/launcher.cpp Sun Nov  4 01:30:38 2012
@@ -33,6 +33,7 @@
 #include <stout/foreach.hpp>
 #include <stout/net.hpp>
 #include <stout/os.hpp>
+#include <stout/path.hpp>
 
 #include "launcher/launcher.hpp"
 
@@ -225,9 +226,17 @@ int ExecutorLauncher::fetchExecutors()
                || resource.find("ftp://") == 0
                || resource.find("ftps://") == 0) {
       string path = resource.substr(resource.find("://") + 3);
-      CHECK(path.find("/") != string::npos) << "Malformed URL (missing path)";
-      CHECK(path.size() > path.find("/") + 1) << "Malformed URL (missing path)";
-      path =  "./" + path.substr(path.find_last_of("/") + 1);
+      if (path.find("/") == string::npos) {
+        cerr << "Malformed URL (missing path)" << endl;
+        return -1;
+      }
+
+      if (path.size() <= path.find("/") + 1) {
+        cerr << "Malformed URL (missing path)" << endl;
+        return -1;
+      }
+
+      path =  path::join(".", path.substr(path.find_last_of("/") + 1));
       cout << "Downloading " << resource << " to " << path << endl;
       Try<int> code = net::download(resource, path);
       if (code.isError()) {

Modified: incubator/mesos/branches/0.10.0/src/webui/webui.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.0/src/webui/webui.cpp?rev=1405477&r1=1405476&r2=1405477&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.0/src/webui/webui.cpp (original)
+++ incubator/mesos/branches/0.10.0/src/webui/webui.cpp Sun Nov  4 01:30:38 2012
@@ -1,10 +1,13 @@
 #ifdef MESOS_WEBUI
 
+#include <stdlib.h>
 #include <unistd.h>
 
 #include <sys/types.h>
 #include <sys/uio.h>
 
+#include <iostream>
+
 #include <tr1/functional>
 
 #include <stout/os.hpp>
@@ -52,7 +55,7 @@ static void run(const std::string& direc
 
   PyRun_SimpleString(code.c_str());
 
-  LOG(INFO) << "Loading webui script at '" << path << "'";
+  std::cerr << "Loading webui script at '" << path << "'" << std::endl;
 
   FILE* file = fopen(path.c_str(), "r");
   PyRun_SimpleFile(file, path.c_str());
@@ -68,9 +71,10 @@ void wait(int fd)
 {
   char temp[8];
   if (read(fd, temp, 8) == -1) {
-    PLOG(FATAL) << "Failed to read on pipe from parent";
+    std::cerr << "Failed to read on pipe from parent" << std::endl;
+    abort();
   }
-  exit(1);
+  exit(0);
 }
 
 
@@ -122,7 +126,8 @@ void start(const std::string& directory,
     close(pipes[1]); // Close the writer end in the child.
 
     if (!thread::start(std::tr1::bind(&wait, pipes[0]), true)) {
-      LOG(FATAL) << "Failed to start wait thread";
+      std::cerr << "Failed to start wait thread" << std::endl;
+      abort();
     }
 
     run(directory, script, args);