You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/08/10 23:32:29 UTC
[1/2] mesos git commit: Allowed all flags load methods to specify a
prefix.
Repository: mesos
Updated Branches:
refs/heads/master 12712c59b -> 853869eb3
Allowed all flags load methods to specify a prefix.
This also refactors the prefix logic into one place, so that's nice.
Required for the actual fix for passing work_dir in local.
Review: https://reviews.apache.org/r/50002/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0f797824
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0f797824
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0f797824
Branch: refs/heads/master
Commit: 0f797824a16f27629b1d0da5e4d0a359af72c577
Parents: 12712c5
Author: Ammar Askar <am...@ammaraskar.com>
Authored: Wed Aug 10 16:09:40 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Aug 10 16:09:40 2016 -0700
----------------------------------------------------------------------
3rdparty/stout/include/stout/flags/flags.hpp | 85 +++++++++++++----------
3rdparty/stout/tests/flags_tests.cpp | 34 +++++++++
2 files changed, 82 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f797824/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/stout/include/stout/flags/flags.hpp
index dd93627..4ca6c69 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -68,7 +68,7 @@ public:
bool unknowns = false,
bool duplicates = false);
- // Load any flags from the environment as above but remove processed
+ // Loads any flags from the environment as above but remove processed
// flags from 'argv' and update 'argc' appropriately. For example:
//
// argv = ["/path/program", "--arg1", "hi", "--arg2", "--", "bye"]
@@ -83,13 +83,29 @@ public:
bool unknowns = false,
bool duplicates = false);
+ // Loads flags from the given map where the keys represent the flag
+ // name and the values represent the flag values. For example:
+ //
+ // values = { 'arg1': 'hi',
+ // 'arg2': 'bye' }
+ //
+ // Optionally, if `prefix` is specified, flags will also be loaded
+ // from environment variables with the given prefix.
+ // Note that if a flag exists in both the environment and the values map,
+ // the latter takes precedence.
virtual Try<Warnings> load(
const std::map<std::string, Option<std::string>>& values,
- bool unknowns = false);
+ bool unknowns = false,
+ const Option<std::string>& prefix = None());
+ // Loads flags from the map and optionally the environment vars
+ // if a prefix is specified. Follows the behavior of the
+ // method `load(values, unknowns, prefix)` above in terms
+ // of precedence and load order.
virtual Try<Warnings> load(
const std::map<std::string, std::string>& values,
- bool unknowns = false);
+ bool unknowns = false,
+ const Option<std::string>& prefix = None());
// Returns a string describing the flags, preceded by a "usage
// message" that will be prepended to that description (see
@@ -372,9 +388,10 @@ private:
std::map<std::string, Option<std::string>> extract(const std::string& prefix);
Try<Warnings> load(
- const Multimap<std::string, Option<std::string>>& values,
+ Multimap<std::string, Option<std::string>>& values,
bool unknowns = false,
- bool duplicates = false);
+ bool duplicates = false,
+ const Option<std::string>& prefix = None());
// Maps flag's name to flag.
std::map<std::string, Flag> flags_;
@@ -783,19 +800,7 @@ inline Try<Warnings> FlagsBase::load(
values.put(name, value);
}
- if (prefix.isSome()) {
- // Merge in flags from the environment. Command-line
- // flags take precedence over environment flags.
- foreachpair (const std::string& name,
- const Option<std::string>& value,
- extract(prefix.get())) {
- if (!values.contains(name)) {
- values.put(name, value);
- }
- }
- }
-
- return load(values, unknowns, duplicates);
+ return load(values, unknowns, duplicates, prefix);
}
@@ -851,19 +856,7 @@ inline Try<Warnings> FlagsBase::load(
values.put(name, value);
}
- if (prefix.isSome()) {
- // Merge in flags from the environment. Command-line
- // flags take precedence over environment flags.
- foreachpair (const std::string& name,
- const Option<std::string>& value,
- extract(prefix.get())) {
- if (!values.contains(name)) {
- values.put(name, value);
- }
- }
- }
-
- Try<Warnings> result = load(values, unknowns, duplicates);
+ Try<Warnings> result = load(values, unknowns, duplicates, prefix);
// Update 'argc' and 'argv' if we successfully loaded the flags.
if (!result.isError()) {
@@ -887,7 +880,8 @@ inline Try<Warnings> FlagsBase::load(
inline Try<Warnings> FlagsBase::load(
const std::map<std::string, Option<std::string>>& values,
- bool unknowns)
+ bool unknowns,
+ const Option<std::string>& prefix)
{
Multimap<std::string, Option<std::string>> values_;
foreachpair (const std::string& name,
@@ -895,29 +889,46 @@ inline Try<Warnings> FlagsBase::load(
values) {
values_.put(name, value);
}
- return load(values_, unknowns);
+ return load(values_, unknowns, false, prefix);
}
inline Try<Warnings> FlagsBase::load(
const std::map<std::string, std::string>& values,
- bool unknowns)
+ bool unknowns,
+ const Option<std::string>& prefix)
{
Multimap<std::string, Option<std::string>> values_;
foreachpair (const std::string& name, const std::string& value, values) {
values_.put(name, Some(value));
}
- return load(values_, unknowns);
+ return load(values_, unknowns, false, prefix);
}
inline Try<Warnings> FlagsBase::load(
- const Multimap<std::string, Option<std::string>>& values,
+ Multimap<std::string, Option<std::string>>& values,
bool unknowns,
- bool duplicates)
+ bool duplicates,
+ const Option<std::string>& prefix)
{
Warnings warnings;
+ if (prefix.isSome()) {
+ // Merge in flags from the environment. Values in the
+ // map take precedence over environment flags.
+ //
+ // Other overloads parse command line flags into
+ // the values map and pass them into this method.
+ foreachpair (const std::string& name,
+ const Option<std::string>& value,
+ extract(prefix.get())) {
+ if (!values.contains(name)) {
+ values.put(name, value);
+ }
+ }
+ }
+
foreachpair (const std::string& name,
const Option<std::string>& value,
values) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f797824/3rdparty/stout/tests/flags_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/flags_tests.cpp b/3rdparty/stout/tests/flags_tests.cpp
index 848d707..94ba915 100644
--- a/3rdparty/stout/tests/flags_tests.cpp
+++ b/3rdparty/stout/tests/flags_tests.cpp
@@ -514,20 +514,54 @@ TEST(FlagsTest, DuplicatesFromEnvironment)
TestFlags flags;
os::setenv("FLAGSTEST_name1", "ben folds");
+ os::setenv("FLAGSTEST_name2", "50");
const char* argv[] = {
"/path/to/program",
"--name1=billy joel"
};
+ // `load(prefix, argc, argv)`.
Try<Warnings> load = flags.load("FLAGSTEST_", arraySize(argv), argv);
EXPECT_SOME(load);
EXPECT_EQ(0, load->warnings.size());
// The environment variables are overwritten by command line flags.
EXPECT_EQ(flags.name1, "billy joel");
+ EXPECT_EQ(flags.name2, 50);
+
+ {
+ flags = TestFlags();
+ std::map<std::string, std::string> values;
+ values["name1"] = "billy joel";
+
+ // `load(map<string, string>, unknowns, prefix)`.
+ load = flags.load(values, false, "FLAGSTEST_");
+ EXPECT_SOME(load);
+ EXPECT_EQ(0, load->warnings.size());
+
+ EXPECT_EQ(flags.name1, "billy joel");
+ EXPECT_EQ(flags.name2, 50);
+ }
+
+ {
+ flags = TestFlags();
+ std::map<std::string, Option<std::string>> values;
+ values["name1"] = "billy joel";
+ values["name2"] = "51";
+
+ // `load(map<string, Option<string>, unknowns, prefix)`.
+ load = flags.load(values, false, "FLAGSTEST_");
+
+ EXPECT_SOME(load);
+ EXPECT_EQ(0, load->warnings.size());
+
+ EXPECT_EQ(flags.name1, "billy joel");
+ EXPECT_EQ(flags.name2, 51);
+ }
os::unsetenv("FLAGSTEST_name1");
+ os::unsetenv("FLAGSTEST_name2");
}
[2/2] mesos git commit: Updated CHANGELOG for 1.0.1.
Posted by vi...@apache.org.
Updated CHANGELOG for 1.0.1.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/853869eb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/853869eb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/853869eb
Branch: refs/heads/master
Commit: 853869eb39c62c3a405b4588c82bfc2902575bdc
Parents: 0f79782
Author: Vinod Kone <vi...@gmail.com>
Authored: Wed Aug 10 16:32:10 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Aug 10 16:32:10 2016 -0700
----------------------------------------------------------------------
CHANGELOG | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/853869eb/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 3008e8b..4fd9364 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,21 +4,28 @@ Release Notes - Mesos - Version 1.0.1
All Issues:
** Bug
- * [MESOS-5388] - MesosContainerizerLaunch flags execute arbitrary commands via shell.
- * [MESOS-5911] - Webui redirection to leader in browser does not work.
- * [MESOS-5913] - Stale socket FD usage when using libevent + SSL.
- * [MESOS-5922] - mesos-agent --help exit status is 1
- * [MESOS-5923] - Ubuntu 14.04 LTS GPU Isolator "/run" directory is noexec.
- * [MESOS-5927] - Unable to run "scratch" Dockerfiles with Unified Containerizer.
- * [MESOS-5928] - Agent's '--version' flag doesn't work
- * [MESOS-5930] - Orphan tasks can shown up as running after they have finished.
- * [MESOS-5943] - Incremental http parsing of URLs leads to decoder error.
- * [MESOS-5945] - NvidiaVolume::create() should check for root before creating volume.
- * [MESOS-5959] - All non-root tests fail on GPU machine.
- * [MESOS-5969] - Linux 'MountInfoTable' entries not sorted as expected
- * [MESOS-5982] - NvidiaVolume errors out if any Nvidia binary is missing.
- * [MESOS-5986] - SSL Socket CHECK can fail after socket receives EOF.
- * [MESOS-5988] - PollSocketImpl can write to a stale file descriptor.
+ * [MESOS-5388] - MesosContainerizerLaunch flags execute arbitrary commands via shell.
+ * [MESOS-5862] - External links to .md files broken.
+ * [MESOS-5911] - Webui redirection to leader in browser does not work
+ * [MESOS-5913] - Stale socket FD usage when using libevent + SSL.
+ * [MESOS-5922] - mesos-agent --help exit status is 1
+ * [MESOS-5923] - Ubuntu 14.04 LTS GPU Isolator "/run" directory is noexec
+ * [MESOS-5927] - Unable to run "scratch" Dockerfiles with Unified Containerizer.
+ * [MESOS-5928] - Agent's '--version' flag doesn't work
+ * [MESOS-5930] - Orphan tasks can show up as running after they have finished.
+ * [MESOS-5943] - Incremental http parsing of URLs leads to decoder error
+ * [MESOS-5945] - NvidiaVolume::create() should check for root before creating volume
+ * [MESOS-5959] - All non-root tests fail on GPU machine
+ * [MESOS-5969] - Linux 'MountInfoTable' entries not sorted as expected
+ * [MESOS-5982] - NvidiaVolume errors out if any binary is missing
+ * [MESOS-5986] - SSL Socket CHECK can fail after socket receives EOF
+ * [MESOS-5988] - PollSocketImpl can write to a stale fd.
+
+** Improvement
+ * [MESOS-5830] - Make a sweep to trim excess space around angle brackets
+
+** Task
+ * [MESOS-5970] - Remove HTTP_PARSER_VERSION_MAJOR < 2 code in decoder.
Release Notes - Mesos - Version 1.0.0