You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/12/19 04:01:59 UTC
mesos git commit: Updated the master to transform allocations.
Repository: mesos
Updated Branches:
refs/heads/master 1d5380e4a -> 37000fbe3
Updated the master to transform allocations.
Review: https://reviews.apache.org/r/29234
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/37000fbe
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/37000fbe
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/37000fbe
Branch: refs/heads/master
Commit: 37000fbe3770dfe0d873fe574c4925c8c8fa083e
Parents: 1d5380e
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Dec 18 18:06:13 2014 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Dec 18 19:00:42 2014 -0800
----------------------------------------------------------------------
src/master/hierarchical_allocator_process.hpp | 1 +
src/master/master.cpp | 21 ++++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/37000fbe/src/master/hierarchical_allocator_process.hpp
----------------------------------------------------------------------
diff --git a/src/master/hierarchical_allocator_process.hpp b/src/master/hierarchical_allocator_process.hpp
index df55a57..ccd37b4 100644
--- a/src/master/hierarchical_allocator_process.hpp
+++ b/src/master/hierarchical_allocator_process.hpp
@@ -606,6 +606,7 @@ HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::transformAllocation(
// CHECK_EQ(slaves[slaveId].total - transformedSlaveAllocation,
// slaves[slaveId].available);
+ // TODO(jieyu): Do not log if there is no transformation.
LOG(INFO) << "Updated allocation of framework " << frameworkId
<< " on slave " << slaveId
<< " from " << allocation << " to " << transformedAllocation.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/37000fbe/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index a03469c..d6651e2 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -35,6 +35,7 @@
#include <process/limiter.hpp>
#include <process/owned.hpp>
#include <process/run.hpp>
+#include <process/shared.hpp>
#include <process/metrics/metrics.hpp>
@@ -91,6 +92,7 @@ using process::Owned;
using process::PID;
using process::Process;
using process::Promise;
+using process::Shared;
using process::Time;
using process::Timer;
using process::UPID;
@@ -2775,26 +2777,35 @@ void Master::_launchTasks(
// We allow frameworks to implicitly acquire persistent disk
// through resources, meaning that they can transform the
// offered resources. We need to infer those acquisitions.
- Resources::CompositeTransformation transformation;
+ Owned<Resources::CompositeTransformation> transformation(
+ new Resources::CompositeTransformation());
+
foreach (const Resource& disk, usedResources.persistentDisks()) {
if (!transformedOfferedResources.contains(disk)) {
// NOTE: No need to check duplicated persistence ID because
// it should have been validated in ResourceUsageValidator.
- transformation.add(Resources::AcquirePersistentDisk(disk));
+ transformation->add(Resources::AcquirePersistentDisk(disk));
}
}
// Adjust the total resources by applying the transformation.
Try<Resources> _transformedOfferedResources =
- transformation(transformedOfferedResources);
+ (*transformation)(transformedOfferedResources);
// NOTE: The transformation should have also been validated in
// ResourceUsageValidator.
CHECK_SOME(_transformedOfferedResources);
transformedOfferedResources = _transformedOfferedResources.get();
- // TODO(jieyu): Call 'allocator->transformAllocation(...)' here
- // to update the allocator.
+ // TODO(jieyu): Ideally, we should just call 'share()' here.
+ // However, Shared currently does not support implicit upcast
+ // (i.e., we cannot implicitly convert from Shared<Derived> to
+ // Shared<Base>). Revisit this once Shared starts to support
+ // implicit upcast.
+ allocator->transformAllocation(
+ frameworkId,
+ slaveId,
+ Shared<Resources::Transformation>(transformation.release()));
// TODO(bmahler): Consider updating this log message to indicate
// when the executor is also being launched.