You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/08/29 00:18:08 UTC
git commit: Modifed execute cli to run docker images.
Repository: mesos
Updated Branches:
refs/heads/master 0071a9020 -> e28858eb5
Modifed execute cli to run docker images.
Review: https://reviews.apache.org/r/24808
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e28858eb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e28858eb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e28858eb
Branch: refs/heads/master
Commit: e28858eb5b2b0ffbb49cfbb7b7b2c0317d9733b6
Parents: 0071a90
Author: Timothy Chen <tn...@apache.org>
Authored: Thu Aug 28 11:44:45 2014 -0700
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Thu Aug 28 11:44:45 2014 -0700
----------------------------------------------------------------------
src/cli/execute.cpp | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e28858eb/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index 7e20f4c..ddaa20d 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -102,6 +102,11 @@ public:
"checkpoint",
"Enable checkpointing for the framework (requires slave checkpointing)",
false);
+
+ add(&docker_image,
+ "docker_image",
+ "Docker image that follows the Docker CLI naming <image>:<tag>."
+ "(ie: ubuntu, busybox:latest).");
}
Option<string> master;
@@ -113,6 +118,7 @@ public:
Option<string> package;
bool overwrite;
bool checkpoint;
+ Option<string> docker_image;
};
@@ -123,11 +129,13 @@ public:
const string& _name,
const string& _command,
const string& _resources,
- const Option<string>& _uri)
+ const Option<string>& _uri,
+ const Option<string>& _dockerImage)
: name(_name),
command(_command),
resources(_resources),
uri(_uri),
+ dockerImage(_dockerImage),
launched(false) {}
virtual ~CommandScheduler() {}
@@ -173,6 +181,17 @@ public:
task.mutable_command()->add_uris()->set_value(uri.get());
}
+ if (dockerImage.isSome()) {
+ ContainerInfo containerInfo;
+ containerInfo.set_type(ContainerInfo::DOCKER);
+
+ ContainerInfo::DockerInfo dockerInfo;
+ dockerInfo.set_image(dockerImage.get());
+
+ containerInfo.mutable_docker()->CopyFrom(dockerInfo);
+ task.mutable_container()->CopyFrom(containerInfo);
+ }
+
vector<TaskInfo> tasks;
tasks.push_back(task);
@@ -228,7 +247,7 @@ private:
const string command;
const string resources;
const Option<string> uri;
-
+ const Option<string> dockerImage;
bool launched;
};
@@ -336,11 +355,18 @@ int main(int argc, char** argv)
uri = "hdfs://" + flags.hdfs + path;
}
+ Option<string> dockerImage;
+
+ if (flags.docker_image.isSome()) {
+ dockerImage = flags.docker_image.get();
+ }
+
CommandScheduler scheduler(
flags.name.get(),
flags.command.get(),
flags.resources,
- uri);
+ uri,
+ dockerImage);
FrameworkInfo framework;
framework.set_user(user.get());