You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/14 01:27:50 UTC

[3/4] mesos git commit: Added --http_command_executor flag.

Added --http_command_executor flag.

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


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

Branch: refs/heads/master
Commit: df24b6700aa79448782eab6277039d9129f9a17e
Parents: bec4d71
Author: Qian Zhang <zh...@cn.ibm.com>
Authored: Wed Apr 13 15:55:29 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Apr 13 16:27:39 2016 -0700

----------------------------------------------------------------------
 docs/configuration.md | 13 +++++++++++++
 src/slave/flags.cpp   | 10 ++++++++++
 src/slave/flags.hpp   |  1 +
 src/slave/slave.cpp   | 28 ++++++++++++++++++++++++----
 4 files changed, 48 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/df24b670/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index ba00ec5..ce51f26 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1290,6 +1290,19 @@ Example:
 </tr>
 <tr>
   <td>
+    --[no-]http_command_executor
+  </td>
+  <td>
+The underlying executor library to be used for the command executor.
+If set to <code>true</code>, the command executor would use the HTTP based
+executor library to interact with the Mesos agent. If set to <code>false</code>,
+the driver based implementation would be used.
+<b>NOTE</b>: This flag is *experimental* and should not be used in
+production yet. (default: false)
+  </td>
+</tr>
+<tr>
+  <td>
     --image_providers=VALUE
   </td>
   <td>

http://git-wip-us.apache.org/repos/asf/mesos/blob/df24b670/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index dd7bc9a..316feec 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -783,4 +783,14 @@ mesos::internal::slave::Flags::Flags()
       "The ranges of XFS project IDs to use for tracking directory quotas",
       "[5000-10000]");
 #endif
+
+  add(&Flags::http_command_executor,
+      "http_command_executor",
+      "The underlying executor library to be used for the command executor.\n"
+      "If set to `true`, the command executor would use the HTTP based\n"
+      "executor library to interact with the Mesos agent. If set to `false`,\n"
+      "the driver based implementation would be used.\n"
+      "NOTE: This flag is *experimental* and should not be used in\n"
+      "production yet.",
+      false);
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/df24b670/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 300db49..ee520ac 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -147,6 +147,7 @@ public:
 #if ENABLE_XFS_DISK_ISOLATOR
   std::string xfs_project_range;
 #endif
+  bool http_command_executor;
 };
 
 } // namespace slave {

http://git-wip-us.apache.org/repos/asf/mesos/blob/df24b670/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 6ee277d..49fa4a0 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -3898,8 +3898,14 @@ ExecutorInfo Slave::getExecutorInfo(
       executor.mutable_command()->set_user(task.command().user());
     }
 
-    Result<string> path =
-      os::realpath(path::join(flags.launcher_dir, "mesos-executor"));
+    Result<string> path = None();
+    if (flags.http_command_executor) {
+      path =
+        os::realpath(path::join(flags.launcher_dir, "mesos-http-executor"));
+    } else {
+      path =
+        os::realpath(path::join(flags.launcher_dir, "mesos-executor"));
+    }
 
     // Explicitly set 'shell' to true since we want to use the shell
     // for running the mesos-executor (and even though this is the
@@ -3909,7 +3915,11 @@ ExecutorInfo Slave::getExecutorInfo(
     if (path.isSome()) {
       if (hasRootfs) {
         executor.mutable_command()->set_shell(false);
-        executor.mutable_command()->add_arguments("mesos-executor");
+        if (flags.http_command_executor) {
+          executor.mutable_command()->add_arguments("mesos-http-executor");
+        } else {
+          executor.mutable_command()->add_arguments("mesos-executor");
+        }
         executor.mutable_command()->add_arguments(
             "--sandbox_directory=" + flags.sandbox_directory);
 
@@ -5864,12 +5874,22 @@ Executor::Executor(
 {
   CHECK_NOTNULL(slave);
 
+  // See if this is driver based command executor.
   Result<string> executorPath =
     os::realpath(path::join(slave->flags.launcher_dir, "mesos-executor"));
 
   if (executorPath.isSome()) {
     commandExecutor =
-      strings::contains(info.command().value(), executorPath.get());
+        strings::contains(info.command().value(), executorPath.get());
+  }
+
+  // See if this is HTTP based command executor.
+  if (!commandExecutor) {
+    executorPath = os::realpath(
+        path::join(slave->flags.launcher_dir, "mesos-http-executor"));
+
+    commandExecutor =
+        strings::contains(info.command().value(), executorPath.get());
   }
 }