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/12 22:18:47 UTC

[3/8] mesos git commit: Made the `TaskInfo` argument in `launchExecutor()` optional.

Made the `TaskInfo` argument in `launchExecutor()` optional.

Launching a task group requires just the `ExecutorInfo`. We had
already refactored the containerizer `launch()` interface to make
`TaskInfo` as an optional. This change funnels it through.

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


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

Branch: refs/heads/master
Commit: 3e9ea3b2090236514bfd5c6a47b9d42e6e306aad
Parents: 9482755
Author: Anand Mazumdar <an...@apache.org>
Authored: Mon Sep 12 14:21:23 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Mon Sep 12 15:17:02 2016 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 12 ++++++++----
 src/slave/slave.hpp |  4 +++-
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3e9ea3b2/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 2da5a29..fa3610d 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -5727,7 +5727,7 @@ Framework::~Framework()
 // Create and launch an executor.
 Executor* Framework::launchExecutor(
     const ExecutorInfo& executorInfo,
-    const TaskInfo& taskInfo)
+    const Option<TaskInfo>& taskInfo)
 {
   // Generate an ID for the executor's container.
   // TODO(idownes) This should be done by the containerizer but we
@@ -5800,13 +5800,17 @@ Executor* Framework::launchExecutor(
     .onAny(defer(slave, &Slave::fileAttached, lambda::_1, executor->directory));
 
   // Tell the containerizer to launch the executor.
+  ExecutorInfo executorInfo_ = executor->info;
+  Resources resources = executorInfo_.resources();
+
   // NOTE: We modify the ExecutorInfo to include the task's
   // resources when launching the executor so that the containerizer
   // has non-zero resources to work with when the executor has
   // no resources. This should be revisited after MESOS-600.
-  ExecutorInfo executorInfo_ = executor->info;
-  Resources resources = executorInfo_.resources();
-  resources += taskInfo.resources();
+  if (taskInfo.isSome()) {
+    resources += taskInfo->resources();
+  }
+
   executorInfo_.mutable_resources()->CopyFrom(resources);
 
   // Prepare environment variables for the executor.

http://git-wip-us.apache.org/repos/asf/mesos/blob/3e9ea3b2/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 4add4c0..ec02f63 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -922,9 +922,11 @@ struct Framework
 
   ~Framework();
 
+  // If an executor is launched for a task group, `taskInfo` would
+  // not be set.
   Executor* launchExecutor(
       const ExecutorInfo& executorInfo,
-      const TaskInfo& taskInfo);
+      const Option<TaskInfo>& taskInfo);
   void destroyExecutor(const ExecutorID& executorId);
   Executor* getExecutor(const ExecutorID& executorId);
   Executor* getExecutor(const TaskID& taskId);