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 2016/10/31 23:05:31 UTC
[1/2] mesos git commit: Added rlimit support to mesos-execute.
Repository: mesos
Updated Branches:
refs/heads/master 81b3eef35 -> 53389c90d
Added rlimit support to mesos-execute.
Review: https://reviews.apache.org/r/53152
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/53389c90
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/53389c90
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/53389c90
Branch: refs/heads/master
Commit: 53389c90dee3d1adbf47750bf4cc70bf54ae9c17
Parents: 6391a9e
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Oct 24 15:48:11 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Oct 31 16:05:27 2016 -0700
----------------------------------------------------------------------
src/cli/execute.cpp | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/53389c90/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index e694853..b265bc6 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -73,6 +73,7 @@ using mesos::v1::Label;
using mesos::v1::Labels;
using mesos::v1::Offer;
using mesos::v1::Resources;
+using mesos::v1::RLimitInfo;
using mesos::v1::TaskGroupInfo;
using mesos::v1::TaskID;
using mesos::v1::TaskInfo;
@@ -224,6 +225,24 @@ public:
" ]\n"
"}");
+ add(&Flags::rlimits,
+ "rlimits",
+ "JSON representation of resource limits for the command. For\n"
+ "example, the following sets the limit for CPU time to be one\n"
+ "second, and the size of created files to be unlimited:\n"
+ "{\n"
+ " \"rlimits\": [\n"
+ " {\n"
+ " \"type\":\"RLMT_CPU\",\n"
+ " \"soft\":\"1\",\n"
+ " \"hard\":\"1\"\n"
+ " },\n"
+ " {\n"
+ " \"type\":\"RLMT_FSIZE\"\n"
+ " }\n"
+ " ]\n"
+ "}");
+
add(&Flags::role,
"role",
"Role to use when registering.",
@@ -298,6 +317,7 @@ public:
Option<JSON::Array> volumes;
string containerizer;
Option<CapabilityInfo> capabilities;
+ Option<RLimitInfo> rlimits;
string role;
Option<Duration> kill_after;
Option<string> networks;
@@ -668,7 +688,8 @@ static Result<ContainerInfo> getContainerInfo(
const Option<string>& networks,
const Option<string>& appcImage,
const Option<string>& dockerImage,
- const Option<CapabilityInfo>& capabilities)
+ const Option<CapabilityInfo>& capabilities,
+ const Option<RLimitInfo>& rlimits)
{
if (containerizer.empty()) {
return None();
@@ -685,8 +706,9 @@ static Result<ContainerInfo> getContainerInfo(
// Mesos containerizer supports 'appc' and 'docker' images.
if (containerizer == "mesos") {
if (appcImage.isNone() &&
- capabilities.isNone() &&
dockerImage.isNone() &&
+ capabilities.isNone() &&
+ rlimits.isNone() &&
(networks.isNone() || networks->empty()) &&
(volumes.isNone() || volumes->empty())) {
return None();
@@ -738,6 +760,10 @@ static Result<ContainerInfo> getContainerInfo(
->CopyFrom(capabilities.get());
}
+ if (rlimits.isSome()) {
+ containerInfo.mutable_rlimit_info()->CopyFrom(rlimits.get());
+ }
+
return containerInfo;
} else if (containerizer == "docker") {
// 'docker' containerizer only supports 'docker' images.
@@ -1040,7 +1066,8 @@ int main(int argc, char** argv)
flags.networks,
appcImage,
dockerImage,
- flags.capabilities);
+ flags.capabilities,
+ flags.rlimits);
if (containerInfo.isError()){
EXIT(EXIT_FAILURE) << containerInfo.error();
[2/2] mesos git commit: Added a missing declaration to the v1 header.
Posted by ji...@apache.org.
Added a missing declaration to the v1 header.
Review: https://reviews.apache.org/r/53151
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6391a9eb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6391a9eb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6391a9eb
Branch: refs/heads/master
Commit: 6391a9eb20eae2fcd6b5995a38cb35c90100dadf
Parents: 81b3eef
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Oct 24 15:47:30 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Oct 31 16:05:27 2016 -0700
----------------------------------------------------------------------
include/mesos/v1/mesos.hpp | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6391a9eb/include/mesos/v1/mesos.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp
index 2ba72e9..0700742 100644
--- a/include/mesos/v1/mesos.hpp
+++ b/include/mesos/v1/mesos.hpp
@@ -275,6 +275,9 @@ std::ostream& operator<<(std::ostream& stream, const OfferID& offerId);
std::ostream& operator<<(std::ostream& stream, const RateLimits& limits);
+std::ostream& operator<<(std::ostream& stream, const RLimitInfo& limits);
+
+
std::ostream& operator<<(std::ostream& stream, const AgentID& agentId);