You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/10/31 14:20:53 UTC
mesos git commit: Added the '--launcher_dir' flag to the default
executor.
Repository: mesos
Updated Branches:
refs/heads/master c6a2ad8c2 -> 1e57459b7
Added the '--launcher_dir' flag to the default executor.
Review: https://reviews.apache.org/r/53227/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1e57459b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1e57459b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1e57459b
Branch: refs/heads/master
Commit: 1e57459b7d3f571bdf18fec29b070e78ce719319
Parents: c6a2ad8
Author: Gast�n Kleiman <ga...@mesosphere.com>
Authored: Mon Oct 31 12:35:13 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Oct 31 14:21:27 2016 +0100
----------------------------------------------------------------------
src/launcher/default_executor.cpp | 44 +++++++++++++++++++++++++++++++---
src/slave/slave.cpp | 1 +
2 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1e57459b/src/launcher/default_executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/default_executor.cpp b/src/launcher/default_executor.cpp
index af4a97f..f5ff02a 100644
--- a/src/launcher/default_executor.cpp
+++ b/src/launcher/default_executor.cpp
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <iostream>
#include <list>
#include <queue>
#include <string>
@@ -34,6 +35,7 @@
#include <process/process.hpp>
#include <process/protobuf.hpp>
+#include <stout/flags.hpp>
#include <stout/fs.hpp>
#include <stout/linkedhashmap.hpp>
#include <stout/option.hpp>
@@ -63,6 +65,9 @@ using process::http::Request;
using process::http::Response;
using process::http::URL;
+using std::cerr;
+using std::cout;
+using std::endl;
using std::list;
using std::queue;
using std::string;
@@ -78,7 +83,8 @@ public:
const FrameworkID& _frameworkId,
const ExecutorID& _executorId,
const ::URL& _agent,
- const string& _sandboxDirectory)
+ const string& _sandboxDirectory,
+ const string& _launcherDirectory)
: ProcessBase(process::ID::generate("default-executor")),
state(DISCONNECTED),
contentType(ContentType::PROTOBUF),
@@ -90,7 +96,8 @@ public:
frameworkId(_frameworkId),
executorId(_executorId),
agent(_agent),
- sandboxDirectory(_sandboxDirectory) {}
+ sandboxDirectory(_sandboxDirectory),
+ launcherDirectory(_launcherDirectory) {}
virtual ~DefaultExecutor() = default;
@@ -981,6 +988,7 @@ private:
Owned<Mesos> mesos;
const ::URL agent; // Agent API URL.
const string sandboxDirectory;
+ const string launcherDirectory;
LinkedHashMap<UUID, Call::Update> updates; // Unacknowledged updates.
LinkedHashMap<TaskID, TaskInfo> tasks; // Unacknowledged tasks.
@@ -1009,14 +1017,43 @@ private:
} // namespace mesos {
+class Flags : public virtual flags::FlagsBase
+{
+public:
+ Flags()
+ {
+ add(&Flags::launcher_dir,
+ "launcher_dir",
+ "Directory path of Mesos binaries.",
+ PKGLIBEXECDIR);
+ }
+
+ string launcher_dir;
+};
+
+
int main(int argc, char** argv)
{
+ Flags flags;
mesos::FrameworkID frameworkId;
mesos::ExecutorID executorId;
string scheme = "http"; // Default scheme.
::URL agent;
string sandboxDirectory;
+ // Load flags from command line.
+ Try<flags::Warnings> load = flags.load(None(), &argc, &argv);
+
+ if (flags.help) {
+ cout << flags.usage() << endl;
+ return EXIT_SUCCESS;
+ }
+
+ if (load.isError()) {
+ cerr << flags.usage(load.error()) << endl;
+ return EXIT_FAILURE;
+ }
+
Option<string> value = os::getenv("MESOS_FRAMEWORK_ID");
if (value.isNone()) {
EXIT(EXIT_FAILURE)
@@ -1063,7 +1100,8 @@ int main(int argc, char** argv)
frameworkId,
executorId,
agent,
- sandboxDirectory));
+ sandboxDirectory,
+ flags.launcher_dir));
process::spawn(executor.get());
process::wait(executor.get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/1e57459b/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 881c10a..d6c3373 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7054,6 +7054,7 @@ CommandInfo defaultExecutorCommandInfo(
commandInfo.set_shell(false);
commandInfo.set_value(path.get());
commandInfo.add_arguments(MESOS_DEFAULT_EXECUTOR);
+ commandInfo.add_arguments("--launcher_dir=" + launcherDir);
} else {
commandInfo.set_shell(true);
commandInfo.set_value(