This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 603525654d2aea5ed46c47a9da2ce2dce07188ab
Author: Benjamin Bannier <[email protected]>
AuthorDate: Thu Jan 23 14:19:43 2020 +0100

    Decoupled detection of generated executors from Mesos install location.
    
    We previously were detecting executors generated for command tasks by
    checking whether their command matched the full path of
    `mesos-executor`.  This approach can lead to misdetection if e.g.,
    during an upgrade a new installation location is choosen.
    
    This patch adjusts the heuristic by now only relying on the fact that
    the executor command should end in `mesos-executor`. In order to cut
    down on false positives we now additionally check that the executor name
    looks similar to the ones we generate for command tasks.
    
    Review: https://reviews.apache.org/r/72033/
---
 src/slave/slave.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 96890d3..5e3ae0d 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -10562,13 +10562,9 @@ Executor::Executor(
   // hacky. We rely on the fact that docker executor launch command is
   // set in the docker containerizer so that this check is still valid
   // in the slave.
-  Result<string> executorPath =
-    os::realpath(path::join(slave->flags.launcher_dir, MESOS_EXECUTOR));
-
-  if (executorPath.isSome()) {
-    isGeneratedForCommandTask_ =
-      strings::contains(info.command().value(), executorPath.get());
-  }
+  isGeneratedForCommandTask_ =
+    strings::endsWith(info.command().value(), MESOS_EXECUTOR) &&
+    strings::startsWith(info.name(), "Command Executor");
 }
 
 

Reply via email to