Flattened the executor resoures when launching executors.

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


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

Branch: refs/heads/master
Commit: 27b6e877538eb8c778fabf8ec485f599a3fc8086
Parents: b71dc72
Author: Benjamin Mahler <[email protected]>
Authored: Mon Aug 18 15:12:39 2014 -0700
Committer: Benjamin Mahler <[email protected]>
Committed: Wed Sep 3 14:01:16 2014 -0700

----------------------------------------------------------------------
 include/mesos/resources.hpp | 2 ++
 src/slave/slave.cpp         | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/27b6e877/include/mesos/resources.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp
index d7a9e8a..0e37170 100644
--- a/include/mesos/resources.hpp
+++ b/include/mesos/resources.hpp
@@ -67,6 +67,8 @@ bool matches(const Resource& left, const Resource& right);
 std::ostream& operator << (std::ostream& stream, const Resource& resource);
 
 
+// TODO(bmahler): Ensure that the underlying resources are kept
+// in a flattened state: MESOS-1714.
 class Resources
 {
 public:

http://git-wip-us.apache.org/repos/asf/mesos/blob/27b6e877/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index ebde265..bd31831 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -3608,7 +3608,9 @@ Executor* Framework::launchExecutor(
   // has non-zero resources to work with when the executor has
   // no resources. This should be revisited after MESOS-600.
   ExecutorInfo executorInfo_ = executor->info;
-  executorInfo_.mutable_resources()->MergeFrom(taskInfo.resources());
+  Resources resources = executorInfo_.resources();
+  resources += taskInfo.resources();
+  executorInfo_.mutable_resources()->CopyFrom(resources);
 
   // The command (either in form of task or executor command) can
   // define a specific user to run as. If present, this precedes the

Reply via email to