You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/08/15 21:58:07 UTC

[mesos] 01/02: Included task group's resources in the ExecutorInfo.

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

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

commit dd561ff40867336a1c252e86ec5de4aadfd0b7b4
Author: Qian Zhang <zh...@gmail.com>
AuthorDate: Thu Aug 15 14:04:17 2019 -0700

    Included task group's resources in the ExecutorInfo.
    
    Review: https://reviews.apache.org/r/71244/
    (cherry picked from commit 7232dc139fe1e41db8d9476a16383df5ddbe427a)
---
 src/slave/slave.cpp | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 30039b0..bf87be0 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -2987,15 +2987,21 @@ void Slave::__run(
         defaultExecutorCommandInfo(flags.launcher_dir, executor->user);
     }
 
-    // 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.
-    if (task.isSome()) {
-      *executorInfo_.mutable_resources() =
-        Resources(executorInfo.resources()) + task->resources();
+    // We modify the ExecutorInfo to include the task/task group's resources
+    // when launching the executor so that the containerizer has non-zero
+    // resources to work with when the executor has no resources. And this is
+    // also helpful for the executor to have enough resources to start because
+    // usually the resources that framework gives to executor are pretty small
+    // (e.g., Marathon/mesos-execute give 0.1 CPUs to the default executor) so
+    // the executor may be throttled by CFS, see MESOS-9925 for details.
+    Resources tasksResources;
+    foreach (const TaskInfo& _task, tasks) {
+      tasksResources += _task.resources();
     }
 
+    *executorInfo_.mutable_resources() =
+      Resources(executorInfo.resources()) + tasksResources;
+
     // Add the default container info to the executor info.
     // TODO(jieyu): Rename the flag to be default_mesos_container_info.
     if (!executorInfo_.has_container() &&