You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2014/06/16 19:19:20 UTC

[2/3] git commit: Give the command executor some cpu and memory.

Give the command executor some cpu and memory.

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


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

Branch: refs/heads/master
Commit: 75798d437f5f1f7d08b61388c9f1018a54553908
Parents: 6215725
Author: Ian Downes <id...@twitter.com>
Authored: Wed Jun 4 16:19:54 2014 -0700
Committer: Ian Downes <id...@twitter.com>
Committed: Mon Jun 16 10:01:44 2014 -0700

----------------------------------------------------------------------
 src/slave/constants.hpp | 6 ++++++
 src/slave/slave.cpp     | 7 +++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/75798d43/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index ace4590..c65a62d 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -80,6 +80,12 @@ extern const Bytes DEFAULT_DISK;
 // Default ports range offered by the slave.
 extern const std::string DEFAULT_PORTS;
 
+// Default cpu resource given to a command executor.
+const double DEFAULT_EXECUTOR_CPUS = 0.1;
+
+// Default memory resource given to a command executor.
+const Bytes DEFAULT_EXECUTOR_MEM = Megabytes(32);
+
 } // namespace slave {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/75798d43/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 643c088..423974c 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -2297,6 +2297,13 @@ ExecutorInfo Slave::getExecutorInfo(
           "'; exit 1");
     }
 
+    // Add an allowance for the command executor. This does lead to a
+    // small overcommit of resources.
+    executor.mutable_resources()->MergeFrom(
+        Resources::parse(
+          "cpus:" + stringify(DEFAULT_EXECUTOR_CPUS) + ";" +
+          "mem:" + stringify(DEFAULT_EXECUTOR_MEM.megabytes())).get());
+
     return executor;
   }