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


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

This reverts commit fa1050246fa47eef5cd57d34c6ee69d00af23422.


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

Branch: refs/heads/master
Commit: 09f5f919addf49a7b27a1cc8f02a7de092383eff
Parents: fa10502
Author: Anand Mazumdar <an...@apache.org>
Authored: Wed Sep 14 03:05:57 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Wed Sep 14 03:05:57 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, 3 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/09f5f919/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 2d8d49f..0ad59ad 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -142,9 +142,6 @@ 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/09f5f919/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 863ab9d..c9a5497 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -2252,6 +2252,7 @@ void Slave::runTaskGroup(
     return;
   }
 
+  // TODO(anand): Populate command info correctly for the `DEFAULT` executor.
   run(frameworkInfo, executorInfo, None(), taskGroupInfo, UPID());
 }
 
@@ -6111,18 +6112,6 @@ 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
@@ -6154,7 +6143,7 @@ Executor* Framework::launchExecutor(
     launch = slave->containerizer->launch(
         containerId,
         None(),
-        executorInfo_,
+        executorInfo_, // Modified to include the task's resources, see above.
         executor->directory,
         user,
         slave->info.id(),
@@ -6172,7 +6161,7 @@ Executor* Framework::launchExecutor(
     launch = slave->containerizer->launch(
         containerId,
         taskInfo,
-        executorInfo_,
+        executorInfo_, // Modified to include the task's resources, see above.
         executor->directory,
         user,
         slave->info.id(),
@@ -6800,34 +6789,6 @@ 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/09f5f919/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 13c76d1..e659c44 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -1016,12 +1016,6 @@ 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/09f5f919/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index e8b7dc0..2f3fa5f 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -4622,118 +4622,6 @@ 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 {

Reply via email to