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

[1/2] mesos git commit: Updated agent to correctly populate `CommandInfo` for default executor.

Repository: mesos
Updated Branches:
  refs/heads/master f728d537c -> fa1050246


Updated agent to correctly populate `CommandInfo` for default executor.

This change adds the relevant logic to ensure that agent correctly
populates the command info for default executors. Since, we
don't yet have the executable `mesos-default-execute`, added
a `TODO` to the test to add a check to ensure the command
has that information.


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

Branch: refs/heads/master
Commit: fa1050246fa47eef5cd57d34c6ee69d00af23422
Parents: fa3773b
Author: Anand Mazumdar <an...@apache.org>
Authored: Tue Sep 13 11:54:43 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Wed Sep 14 03:02:11 2016 -0700

----------------------------------------------------------------------
 src/slave/constants.hpp   |   3 ++
 src/slave/slave.cpp       |  45 +++++++++++++++--
 src/slave/slave.hpp       |   6 +++
 src/tests/slave_tests.cpp | 112 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 163 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fa105024/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 0ad59ad..2d8d49f 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -142,6 +142,9 @@ Duration DEFAULT_MASTER_PING_TIMEOUT();
 // (but not across reboots). This directory will be cleared on reboot.
 constexpr char DEFAULT_RUNTIME_DIRECTORY[] = "/var/run/mesos";
 
+// Name of the executable for default executor.
+constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";
+
 } // namespace slave {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/fa105024/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index c9a5497..863ab9d 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -2252,7 +2252,6 @@ void Slave::runTaskGroup(
     return;
   }
 
-  // TODO(anand): Populate command info correctly for the `DEFAULT` executor.
   run(frameworkInfo, executorInfo, None(), taskGroupInfo, UPID());
 }
 
@@ -6112,6 +6111,18 @@ Executor* Framework::launchExecutor(
 
   // Tell the containerizer to launch the executor.
   ExecutorInfo executorInfo_ = executor->info;
+
+  // Populate the command info for default executor. We modify the ExecutorInfo
+  // to avoid resetting command info upon re-registering with the master since
+  // the master doesn't store them; they are generated by the slave.
+  if (executorInfo_.has_type() &&
+      executorInfo_.type() == ExecutorInfo::DEFAULT) {
+    CHECK(!executorInfo_.has_command());
+
+    executorInfo_.mutable_command()->CopyFrom(
+        defaultExecutorCommandInfo(slave->flags.launcher_dir, user));
+  }
+
   Resources resources = executorInfo_.resources();
 
   // NOTE: We modify the ExecutorInfo to include the task's
@@ -6143,7 +6154,7 @@ Executor* Framework::launchExecutor(
     launch = slave->containerizer->launch(
         containerId,
         None(),
-        executorInfo_, // Modified to include the task's resources, see above.
+        executorInfo_,
         executor->directory,
         user,
         slave->info.id(),
@@ -6161,7 +6172,7 @@ Executor* Framework::launchExecutor(
     launch = slave->containerizer->launch(
         containerId,
         taskInfo,
-        executorInfo_, // Modified to include the task's resources, see above.
+        executorInfo_,
         executor->directory,
         user,
         slave->info.id(),
@@ -6789,6 +6800,34 @@ map<string, string> executorEnvironment(
 }
 
 
+CommandInfo defaultExecutorCommandInfo(
+    const string& launcherDir,
+    const Option<string>& user)
+{
+  Result<string> path = os::realpath(
+      path::join(launcherDir, MESOS_DEFAULT_EXECUTOR));
+
+  CommandInfo commandInfo;
+  if (path.isSome()) {
+    commandInfo.set_shell(false);
+    commandInfo.set_value(path.get());
+    commandInfo.add_arguments(MESOS_DEFAULT_EXECUTOR);
+  } else {
+    commandInfo.set_shell(true);
+    commandInfo.set_value(
+        "echo '" +
+        (path.isError() ? path.error() : "No such file or directory") +
+        "'; exit 1");
+  }
+
+  if (user.isSome()) {
+    commandInfo.set_user(user.get());
+  }
+
+  return commandInfo;
+}
+
+
 std::ostream& operator<<(std::ostream& stream, const Executor& executor)
 {
   stream << "'" << executor.id << "' of framework " << executor.frameworkId;

http://git-wip-us.apache.org/repos/asf/mesos/blob/fa105024/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index e659c44..13c76d1 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -1016,6 +1016,12 @@ std::map<std::string, std::string> executorEnvironment(
     bool checkpoint);
 
 
+// Returns the command info for default executor.
+CommandInfo defaultExecutorCommandInfo(
+    const std::string& launcherDir,
+    const Option<std::string>& user);
+
+
 std::ostream& operator<<(std::ostream& stream, Slave::State state);
 std::ostream& operator<<(std::ostream& stream, Framework::State state);
 std::ostream& operator<<(std::ostream& stream, Executor::State state);

http://git-wip-us.apache.org/repos/asf/mesos/blob/fa105024/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 2f3fa5f..e8b7dc0 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -4622,6 +4622,118 @@ TEST_F(SlaveTest, KillTaskGroupBetweenRunTaskParts)
   wait(slave);
 }
 
+
+// This test verifies that the agent correctly populates the
+// command info for default executor.
+TEST_F(SlaveTest, DefaultExecutorCommandInfo)
+{
+  Try<Owned<cluster::Master>> master = StartMaster();
+  ASSERT_SOME(master);
+
+  auto scheduler = std::make_shared<MockV1HTTPScheduler>();
+  auto executor = std::make_shared<MockV1HTTPExecutor>();
+
+  Resources resources =
+    Resources::parse("cpus:0.1;mem:32;disk:32").get();
+
+  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+
+  ExecutorInfo executorInfo;
+  executorInfo.set_type(ExecutorInfo::DEFAULT);
+
+  executorInfo.mutable_executor_id()->CopyFrom(DEFAULT_EXECUTOR_ID);
+  executorInfo.mutable_resources()->CopyFrom(resources);
+
+  const ExecutorID& executorId = executorInfo.executor_id();
+  TestContainerizer containerizer(executorId, executor);
+
+  Owned<MasterDetector> detector = master.get()->createDetector();
+  Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), &containerizer);
+  ASSERT_SOME(slave);
+
+  Future<Nothing> connected;
+  EXPECT_CALL(*scheduler, connected(_))
+    .WillOnce(FutureSatisfy(&connected));
+
+  scheduler::TestV1Mesos mesos(
+      master.get()->pid, ContentType::PROTOBUF, scheduler);
+
+  AWAIT_READY(connected);
+
+  Future<v1::scheduler::Event::Subscribed> subscribed;
+  EXPECT_CALL(*scheduler, subscribed(_, _))
+    .WillOnce(FutureArg<1>(&subscribed));
+
+  Future<v1::scheduler::Event::Offers> offers;
+  EXPECT_CALL(*scheduler, offers(_, _))
+    .WillOnce(FutureArg<1>(&offers))
+    .WillRepeatedly(Return());
+
+  EXPECT_CALL(*scheduler, heartbeat(_))
+    .WillRepeatedly(Return()); // Ignore heartbeats.
+
+  {
+    Call call;
+    call.set_type(Call::SUBSCRIBE);
+    Call::Subscribe* subscribe = call.mutable_subscribe();
+    subscribe->mutable_framework_info()->CopyFrom(evolve(frameworkInfo));
+
+    mesos.send(call);
+  }
+
+  AWAIT_READY(subscribed);
+
+  v1::FrameworkID frameworkId(subscribed->framework_id());
+
+  // Update `executorInfo` with the subscribed `frameworkId`.
+  executorInfo.mutable_framework_id()->CopyFrom(devolve(frameworkId));
+
+  AWAIT_READY(offers);
+  EXPECT_NE(0, offers->offers().size());
+
+  Future<ExecutorInfo> executorInfo_;
+  EXPECT_CALL(containerizer, launch(_, _, _, _, _, _, _, _))
+    .WillOnce(DoAll(FutureArg<2>(&executorInfo_),
+                    Return(Future<bool>())));
+
+  const v1::Offer& offer = offers->offers(0);
+  const SlaveID slaveId = devolve(offer.agent_id());
+
+  v1::TaskInfo taskInfo =
+    evolve(createTask(slaveId, resources, ""));
+
+  v1::TaskGroupInfo taskGroup;
+  taskGroup.add_tasks()->CopyFrom(taskInfo);
+
+  {
+    Call call;
+    call.mutable_framework_id()->CopyFrom(frameworkId);
+    call.set_type(Call::ACCEPT);
+
+    Call::Accept* accept = call.mutable_accept();
+    accept->add_offer_ids()->CopyFrom(offer.id());
+
+    v1::Offer::Operation* operation = accept->add_operations();
+    operation->set_type(v1::Offer::Operation::LAUNCH_GROUP);
+
+    v1::Offer::Operation::LaunchGroup* launchGroup =
+      operation->mutable_launch_group();
+
+    launchGroup->mutable_executor()->CopyFrom(evolve(executorInfo));
+    launchGroup->mutable_task_group()->CopyFrom(taskGroup);
+
+    mesos.send(call);
+  }
+
+  AWAIT_READY(executorInfo_);
+
+  // TODO(anand): Add a `strings::contains()` check to ensure
+  // `MESOS_DEFAULT_EXECUTOR` is present in the command when
+  // we add the executable for default executor.
+  ASSERT_TRUE(executorInfo_->has_command());
+  EXPECT_EQ(frameworkInfo.user(), executorInfo_->command().user());
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {


[2/2] mesos git commit: Cleaned up `getExecutorInfo()` function in the agent.

Posted by an...@apache.org.
Cleaned up `getExecutorInfo()` function in the agent.

The code was un-necessarily nested thereby making it less readable.
This change returns early if its a custom executor and then moves
all the nested code for command executor out of the `if` block.


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

Branch: refs/heads/master
Commit: fa3773b510807814631fc6febf61e55beb956ad9
Parents: f728d53
Author: Anand Mazumdar <an...@apache.org>
Authored: Tue Sep 13 07:07:46 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Wed Sep 14 03:02:11 2016 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 304 +++++++++++++++++++++++------------------------
 1 file changed, 152 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fa3773b5/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 2c7b5ad..c9a5497 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -4150,183 +4150,183 @@ ExecutorInfo Slave::getExecutorInfo(
     << "Task " << task.task_id()
     << " should have either CommandInfo or ExecutorInfo set but not both";
 
-  if (task.has_command()) {
-    ExecutorInfo executor;
-
-    // Command executors share the same id as the task.
-    executor.mutable_executor_id()->set_value(task.task_id().value());
-    executor.mutable_framework_id()->CopyFrom(frameworkInfo.id());
-
-    if (task.has_container()) {
-      // Store the container info in the executor info so it will
-      // be checkpointed. This allows the correct containerizer to
-      // recover this task on restart.
-      executor.mutable_container()->CopyFrom(task.container());
-    }
+  if (task.has_executor()) {
+    return task.executor();
+  }
 
-    // TODO(jieyu): We should move those Mesos containerizer specific
-    // logic (e.g., 'hasRootfs') to Mesos containerizer.
-    bool hasRootfs = task.has_container() &&
-                     task.container().type() == ContainerInfo::MESOS &&
-                     task.container().mesos().has_image();
+  ExecutorInfo executor;
 
-    if (hasRootfs) {
-      ContainerInfo* container = executor.mutable_container();
-
-      // For command tasks, we are now copying the entire
-      // `task.container` into the `executorInfo`. Thus,
-      // `executor.container` now has the image if `task.container`
-      // had one. However, in the case of Mesos container with rootfs,
-      // we want to run the command executor in the host filesystem
-      // and let the command executor pivot_root to the rootfs for its
-      // task. For this reason, we need to strip the image in
-      // `executor.container.mesos`.
-      container->mutable_mesos()->clear_image();
-
-      // We need to set the executor user as root as it needs to
-      // perform chroot (even when switch_user is set to false).
-      executor.mutable_command()->set_user("root");
-    }
+  // Command executors share the same id as the task.
+  executor.mutable_executor_id()->set_value(task.task_id().value());
+  executor.mutable_framework_id()->CopyFrom(frameworkInfo.id());
+
+  if (task.has_container()) {
+    // Store the container info in the executor info so it will
+    // be checkpointed. This allows the correct containerizer to
+    // recover this task on restart.
+    executor.mutable_container()->CopyFrom(task.container());
+  }
+
+  // TODO(jieyu): We should move those Mesos containerizer specific
+  // logic (e.g., 'hasRootfs') to Mesos containerizer.
+  bool hasRootfs = task.has_container() &&
+                   task.container().type() == ContainerInfo::MESOS &&
+                   task.container().mesos().has_image();
 
-    // Prepare an executor name which includes information on the
-    // command being launched.
-    string name = "(Task: " + task.task_id().value() + ") ";
+  if (hasRootfs) {
+    ContainerInfo* container = executor.mutable_container();
 
-    if (task.command().shell()) {
-      if (!task.command().has_value()) {
-        name += "(Command: NO COMMAND)";
+    // For command tasks, we are now copying the entire
+    // `task.container` into the `executorInfo`. Thus,
+    // `executor.container` now has the image if `task.container`
+    // had one. However, in the case of Mesos container with rootfs,
+    // we want to run the command executor in the host filesystem
+    // and let the command executor pivot_root to the rootfs for its
+    // task. For this reason, we need to strip the image in
+    // `executor.container.mesos`.
+    container->mutable_mesos()->clear_image();
+
+    // We need to set the executor user as root as it needs to
+    // perform chroot (even when switch_user is set to false).
+    executor.mutable_command()->set_user("root");
+  }
+
+  // Prepare an executor name which includes information on the
+  // command being launched.
+  string name = "(Task: " + task.task_id().value() + ") ";
+
+  if (task.command().shell()) {
+    if (!task.command().has_value()) {
+      name += "(Command: NO COMMAND)";
+    } else {
+      name += "(Command: sh -c '";
+      if (task.command().value().length() > 15) {
+        name += task.command().value().substr(0, 12) + "...')";
       } else {
-        name += "(Command: sh -c '";
-        if (task.command().value().length() > 15) {
-          name += task.command().value().substr(0, 12) + "...')";
-        } else {
-          name += task.command().value() + "')";
-        }
+        name += task.command().value() + "')";
       }
+    }
+  } else {
+    if (!task.command().has_value()) {
+      name += "(Command: NO EXECUTABLE)";
     } else {
-      if (!task.command().has_value()) {
-        name += "(Command: NO EXECUTABLE)";
-      } else {
-        string args =
-          task.command().value() + ", " +
-          strings::join(", ", task.command().arguments());
+      string args =
+        task.command().value() + ", " +
+        strings::join(", ", task.command().arguments());
 
-        if (args.length() > 15) {
-          name += "(Command: [" + args.substr(0, 12) + "...])";
-        } else {
-          name += "(Command: [" + args + "])";
-        }
+      if (args.length() > 15) {
+        name += "(Command: [" + args.substr(0, 12) + "...])";
+      } else {
+        name += "(Command: [" + args + "])";
       }
     }
+  }
 
-    executor.set_name("Command Executor " + name);
-    executor.set_source(task.task_id().value());
-
-    // Copy the [uris, environment, container, user] fields from the
-    // CommandInfo to get the URIs we need to download, the
-    // environment variables that should get set, the necessary
-    // container information, and the user to run the executor as but
-    // nothing else because we need to set up the rest of the executor
-    // command ourselves in order to invoke 'mesos-executor'.
-    executor.mutable_command()->mutable_uris()->MergeFrom(
-        task.command().uris());
-
-    if (task.command().has_environment()) {
-      executor.mutable_command()->mutable_environment()->MergeFrom(
-          task.command().environment());
-    }
+  executor.set_name("Command Executor " + name);
+  executor.set_source(task.task_id().value());
 
-    // Add fields which can be relevant (depending on Authorizer) for
-    // authorization.
+  // Copy the [uris, environment, container, user] fields from the
+  // CommandInfo to get the URIs we need to download, the
+  // environment variables that should get set, the necessary
+  // container information, and the user to run the executor as but
+  // nothing else because we need to set up the rest of the executor
+  // command ourselves in order to invoke 'mesos-executor'.
+  executor.mutable_command()->mutable_uris()->MergeFrom(
+      task.command().uris());
 
-    if (task.has_labels()) {
-      executor.mutable_labels()->MergeFrom(task.labels());
-    }
+  if (task.command().has_environment()) {
+    executor.mutable_command()->mutable_environment()->MergeFrom(
+        task.command().environment());
+  }
 
-    if (task.has_discovery()) {
-      executor.mutable_discovery()->MergeFrom(task.discovery());
-    }
+  // Add fields which can be relevant (depending on Authorizer) for
+  // authorization.
 
-    // Adjust the executor shutdown grace period if the kill policy is
-    // set. We add a small buffer of time to avoid destroying the
-    // container before `TASK_KILLED` is sent by the executor.
-    //
-    // TODO(alexr): Remove `MAX_REAP_INTERVAL` once the reaper signals
-    // immediately after the watched process has exited.
-    if (task.has_kill_policy() &&
-        task.kill_policy().has_grace_period()) {
-      Duration gracePeriod =
-        Nanoseconds(task.kill_policy().grace_period().nanoseconds()) +
-        process::MAX_REAP_INTERVAL() +
-        Seconds(1);
-
-      executor.mutable_shutdown_grace_period()->set_nanoseconds(
-          gracePeriod.ns());
-    }
+  if (task.has_labels()) {
+    executor.mutable_labels()->MergeFrom(task.labels());
+  }
 
-    // We skip setting the user for the command executor that has
-    // a rootfs image since we need root permissions to chroot.
-    // We assume command executor will change to the correct user
-    // later on.
-    if (!hasRootfs && task.command().has_user()) {
-      executor.mutable_command()->set_user(task.command().user());
-    }
+  if (task.has_discovery()) {
+    executor.mutable_discovery()->MergeFrom(task.discovery());
+  }
 
-    Result<string> path = os::realpath(
-        path::join(flags.launcher_dir, MESOS_EXECUTOR));
+  // Adjust the executor shutdown grace period if the kill policy is
+  // set. We add a small buffer of time to avoid destroying the
+  // container before `TASK_KILLED` is sent by the executor.
+  //
+  // TODO(alexr): Remove `MAX_REAP_INTERVAL` once the reaper signals
+  // immediately after the watched process has exited.
+  if (task.has_kill_policy() &&
+      task.kill_policy().has_grace_period()) {
+    Duration gracePeriod =
+      Nanoseconds(task.kill_policy().grace_period().nanoseconds()) +
+      process::MAX_REAP_INTERVAL() +
+      Seconds(1);
 
-    if (path.isSome()) {
-      executor.mutable_command()->set_shell(false);
-      executor.mutable_command()->set_value(path.get());
-      executor.mutable_command()->add_arguments(MESOS_EXECUTOR);
-      executor.mutable_command()->add_arguments(
-          "--launcher_dir=" + flags.launcher_dir);
+    executor.mutable_shutdown_grace_period()->set_nanoseconds(
+        gracePeriod.ns());
+  }
 
-      if (hasRootfs) {
-        executor.mutable_command()->add_arguments(
-            "--sandbox_directory=" + flags.sandbox_directory);
+  // We skip setting the user for the command executor that has
+  // a rootfs image since we need root permissions to chroot.
+  // We assume command executor will change to the correct user
+  // later on.
+  if (!hasRootfs && task.command().has_user()) {
+    executor.mutable_command()->set_user(task.command().user());
+  }
 
-#ifndef __WINDOWS__
-        // NOTE: if switch_user flag is false and the slave runs under
-        // a non-root user, the task will be rejected by the Posix
-        // filesystem isolator. Linux filesystem isolator requires slave
-        // to have root permission.
-        if (flags.switch_user) {
-          string user;
-          if (task.command().has_user()) {
-            user = task.command().user();
-          } else {
-            user = frameworkInfo.user();
-          }
+  Result<string> path = os::realpath(
+      path::join(flags.launcher_dir, MESOS_EXECUTOR));
+
+  if (path.isSome()) {
+    executor.mutable_command()->set_shell(false);
+    executor.mutable_command()->set_value(path.get());
+    executor.mutable_command()->add_arguments(MESOS_EXECUTOR);
+    executor.mutable_command()->add_arguments(
+        "--launcher_dir=" + flags.launcher_dir);
+
+    if (hasRootfs) {
+      executor.mutable_command()->add_arguments(
+          "--sandbox_directory=" + flags.sandbox_directory);
 
-          executor.mutable_command()->add_arguments("--user=" + user);
+#ifndef __WINDOWS__
+      // NOTE: if switch_user flag is false and the slave runs under
+      // a non-root user, the task will be rejected by the Posix
+      // filesystem isolator. Linux filesystem isolator requires slave
+      // to have root permission.
+      if (flags.switch_user) {
+        string user;
+        if (task.command().has_user()) {
+          user = task.command().user();
+        } else {
+          user = frameworkInfo.user();
         }
-#endif // __WINDOWS__
+
+        executor.mutable_command()->add_arguments("--user=" + user);
       }
-    } else {
-      executor.mutable_command()->set_shell(true);
-      executor.mutable_command()->set_value(
-          "echo '" +
-          (path.isError() ? path.error() : "No such file or directory") +
-          "'; exit 1");
+#endif // __WINDOWS__
     }
+  } else {
+    executor.mutable_command()->set_shell(true);
+    executor.mutable_command()->set_value(
+        "echo '" +
+        (path.isError() ? path.error() : "No such file or directory") +
+        "'; exit 1");
+  }
+
+  // Add an allowance for the command executor. This does lead to a
+  // small overcommit of resources.
+  // TODO(vinod): If a task is using revocable resources, mark the
+  // corresponding executor resource (e.g., cpus) to be also
+  // revocable. Currently, it is OK because the containerizer is
+  // given task + executor resources on task launch resulting in
+  // the container being correctly marked as revocable.
+  executor.mutable_resources()->MergeFrom(
+      Resources::parse(
+        "cpus:" + stringify(DEFAULT_EXECUTOR_CPUS) + ";" +
+        "mem:" + stringify(DEFAULT_EXECUTOR_MEM.megabytes())).get());
 
-    // Add an allowance for the command executor. This does lead to a
-    // small overcommit of resources.
-    // TODO(vinod): If a task is using revocable resources, mark the
-    // corresponding executor resource (e.g., cpus) to be also
-    // revocable. Currently, it is OK because the containerizer is
-    // given task + executor resources on task launch resulting in
-    // the container being correctly marked as revocable.
-    executor.mutable_resources()->MergeFrom(
-        Resources::parse(
-          "cpus:" + stringify(DEFAULT_EXECUTOR_CPUS) + ";" +
-          "mem:" + stringify(DEFAULT_EXECUTOR_MEM.megabytes())).get());
-
-    return executor;
-  }
-
-  return task.executor();
+  return executor;
 }