You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 07:45:04 UTC
svn commit: r1131888 - in /incubator/mesos/trunk/src: ./ tests/
Author: benh
Date: Sun Jun 5 05:45:04 2011
New Revision: 1131888
URL: http://svn.apache.org/viewvc?rev=1131888&view=rev
Log:
Renamed Configuration to Configurator
Added:
incubator/mesos/trunk/src/configurator.cpp
- copied, changed from r1131887, incubator/mesos/trunk/src/configuration.cpp
incubator/mesos/trunk/src/configurator.hpp
- copied, changed from r1131887, incubator/mesos/trunk/src/configuration.hpp
incubator/mesos/trunk/src/tests/test_configurator.cpp
- copied, changed from r1131887, incubator/mesos/trunk/src/tests/test_configuration.cpp
Removed:
incubator/mesos/trunk/src/configuration.cpp
incubator/mesos/trunk/src/configuration.hpp
incubator/mesos/trunk/src/tests/test_configuration.cpp
Modified:
incubator/mesos/trunk/src/Makefile.in
incubator/mesos/trunk/src/master.cpp
incubator/mesos/trunk/src/master.hpp
incubator/mesos/trunk/src/master_main.cpp
incubator/mesos/trunk/src/nexus_local.cpp
incubator/mesos/trunk/src/slave.cpp
incubator/mesos/trunk/src/slave.hpp
incubator/mesos/trunk/src/slave_main.cpp
Modified: incubator/mesos/trunk/src/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.in?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/Makefile.in (original)
+++ incubator/mesos/trunk/src/Makefile.in Sun Jun 5 05:45:04 2011
@@ -93,7 +93,7 @@ LIBS += -lglog -lgtest -lprocess -lev -l
NEXUS_EXES = nexus-master nexus-slave nexus-local nexus-launcher \
test-framework test-executor cpp-test-framework cpp-test-executor \
- memhog memhog-executor scheduled-memhog
+ memhog memhog-executor
ifeq ($(OS_NAME),solaris)
NEXUS_EXES += nexus-projd
@@ -110,12 +110,13 @@ NEXUS_LIBS = $(SCHED_LIB) $(EXEC_LIB) $(
MASTER_OBJ = master.o allocator_factory.o simple_allocator.o
SLAVE_OBJ = slave.o launcher.o isolation_module.o \
process_based_isolation_module.o
-COMMON_OBJ = fatal.o hash_pid.o messages.o lock.o master_detector.o url_processor.o zookeeper.o
+COMMON_OBJ = fatal.o hash_pid.o messages.o lock.o master_detector.o \
+ url_processor.o zookeeper.o configurator.o
EXEC_LIB_OBJ = nexus_exec.o
SCHED_LIB_OBJ = nexus_sched.o nexus_local.o params.o
TEST_OBJ = tests/main.o tests/test_master.o tests/test_resources.o \
tests/external_test.o tests/test_sample_frameworks.o \
- tests/test_lxc_isolation.o
+ tests/testing_utils.o tests/test_configurator.o
ifeq ($(OS_NAME),solaris)
SLAVE_OBJ += solaris_project_isolation_module.o
@@ -225,9 +226,6 @@ memhog: memhog.cpp $(NEXUS_LIB) third_pa
memhog-executor: memhog_executor.cpp $(NEXUS_LIB) third_party/libprocess/libprocess.a
$(CXX) $(CXXFLAGS) -o $@ $< -L. $(LDFLAGS) -lnexus++ $(LIBS)
-scheduled-memhog: scheduled_memhog.cpp $(NEXUS_LIB) third_party/libprocess/libprocess.a
- $(CXX) $(CXXFLAGS) -o $@ $< -L. $(LDFLAGS) -lnexus++ $(LIBS)
-
java: $(JAVA_LIB) swig/java/nexus.jar swig/java/TestFramework.class swig/java/TestExecutor.class swig/java/TestExceptionFramework.class swig/java/TestExceptionExecutor.class
python: $(PYTHON_LIB)
Copied: incubator/mesos/trunk/src/configurator.cpp (from r1131887, incubator/mesos/trunk/src/configuration.cpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator.cpp?p2=incubator/mesos/trunk/src/configurator.cpp&p1=incubator/mesos/trunk/src/configuration.cpp&r1=1131887&r2=1131888&rev=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configuration.cpp (original)
+++ incubator/mesos/trunk/src/configurator.cpp Sun Jun 5 05:45:04 2011
@@ -5,7 +5,7 @@
#include <algorithm>
#include <iostream>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "foreach.hpp"
#include "params.hpp"
@@ -15,12 +15,12 @@ extern char** environ; // libc's envir
using namespace nexus::internal;
-const char* Configuration::DEFAULT_CONFIG_DIR = "conf";
-const char* Configuration::CONFIG_FILE_NAME = "mesos.conf";
-const char* Configuration::ENV_VAR_PREFIX = "MESOS_";
+const char* Configurator::DEFAULT_CONFIG_DIR = "conf";
+const char* Configurator::CONFIG_FILE_NAME = "mesos.conf";
+const char* Configurator::ENV_VAR_PREFIX = "MESOS_";
-void Configuration::validate()
+void Configurator::validate()
{
foreachpair (const string& key, const Option& opt, options) {
if (params.contains(key) && opt.validator && !opt.validator->isValid(params[key])) {
@@ -30,7 +30,7 @@ void Configuration::validate()
}
-void Configuration::load(int argc, char** argv, bool inferMesosHomeFromArg0)
+void Configurator::load(int argc, char** argv, bool inferMesosHomeFromArg0)
{
loadEnv();
loadCommandLine(argc, argv, inferMesosHomeFromArg0);
@@ -39,7 +39,7 @@ void Configuration::load(int argc, char*
}
-void Configuration::load()
+void Configurator::load()
{
loadEnv();
loadConfigFileIfGiven();
@@ -47,7 +47,7 @@ void Configuration::load()
}
-void Configuration::load(const map<string, string>& _params)
+void Configurator::load(const map<string, string>& _params)
{
loadEnv();
params.loadMap(_params);
@@ -56,7 +56,7 @@ void Configuration::load(const map<strin
}
-void Configuration::loadConfigFileIfGiven(bool overwrite) {
+void Configurator::loadConfigFileIfGiven(bool overwrite) {
string confDir = "";
if (params.contains("conf"))
confDir = params["conf"];
@@ -67,7 +67,7 @@ void Configuration::loadConfigFileIfGive
}
-void Configuration::loadEnv(bool overwrite)
+void Configurator::loadEnv(bool overwrite)
{
int i = 0;
while (environ[i] != NULL) {
@@ -89,7 +89,7 @@ void Configuration::loadEnv(bool overwri
}
-void Configuration::loadCommandLine(int argc,
+void Configurator::loadCommandLine(int argc,
char** argv,
bool inferMesosHomeFromArg0,
bool overwrite)
@@ -143,7 +143,7 @@ void Configuration::loadCommandLine(int
}
-void Configuration::loadConfigFile(const string& fname, bool overwrite)
+void Configurator::loadConfigFile(const string& fname, bool overwrite)
{
ifstream cfg(fname.c_str(), std::ios::in);
if (!cfg.is_open()) {
@@ -171,7 +171,7 @@ void Configuration::loadConfigFile(const
}
-string Configuration::getUsage() const
+string Configurator::getUsage() const
{
const int PAD = 10;
const int LONG_PAD = string("--=VAL").size();
@@ -224,7 +224,7 @@ string Configuration::getUsage() const
}
-vector<string> Configuration::getOptions() const
+vector<string> Configurator::getOptions() const
{
vector<string> ret;
foreachpair (const string& key, _, options) {
@@ -234,12 +234,12 @@ vector<string> Configuration::getOptions
}
-Params& Configuration::getParams()
+Params& Configurator::getParams()
{
return params;
}
-string Configuration::getLongName(char shortName) const
+string Configurator::getLongName(char shortName) const
{
foreachpair (const string& key, const Option& opt, options) {
if (opt.hasShortName && opt.shortName == shortName)
Copied: incubator/mesos/trunk/src/configurator.hpp (from r1131887, incubator/mesos/trunk/src/configuration.hpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator.hpp?p2=incubator/mesos/trunk/src/configurator.hpp&p1=incubator/mesos/trunk/src/configuration.hpp&r1=1131887&r2=1131888&rev=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configuration.hpp (original)
+++ incubator/mesos/trunk/src/configurator.hpp Sun Jun 5 05:45:04 2011
@@ -1,5 +1,5 @@
-#ifndef __CONFIGURATION_HPP__
-#define __CONFIGURATION_HPP__
+#ifndef __CONFIGURATOR_HPP__
+#define __CONFIGURATOR_HPP__
#include <algorithm>
#include <iostream>
@@ -24,7 +24,7 @@ using boost::bad_lexical_cast;
/**
- * Exception type thrown by Configuration.
+ * Exception type thrown by Configurator.
*/
struct ConfigurationException : std::exception
{
@@ -46,7 +46,7 @@ struct ConfigurationException : std::exc
* MESOS_CONF or via command line --conf=file. Otherwise, it looks for
* "mesos.conf" in MESOS_HOME/conf.
**/
-class Configuration
+class Configurator
{
public:
static const char* DEFAULT_CONFIG_DIR;
@@ -62,11 +62,11 @@ public:
/**
* Initializes an empty Params
**/
- Configuration() {}
+ Configurator() {}
/**
- * Returns the Params object parsed by this Configuration.
+ * Returns the Params object parsed by this Configurator.
* @return Params populated params object
**/
Params& getParams();
Modified: incubator/mesos/trunk/src/master.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master.cpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master.cpp (original)
+++ incubator/mesos/trunk/src/master.cpp Sun Jun 5 05:45:04 2011
@@ -149,7 +149,7 @@ Master::~Master()
}
-void Master::registerOptions(Configuration* conf)
+void Master::registerOptions(Configurator* conf)
{
conf->addOption<string>("allocator", 'a', "Allocation module name", "simple");
}
Modified: incubator/mesos/trunk/src/master.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master.hpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master.hpp (original)
+++ incubator/mesos/trunk/src/master.hpp Sun Jun 5 05:45:04 2011
@@ -21,7 +21,7 @@
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "fatal.hpp"
#include "foreach.hpp"
#include "hash_pid.hpp"
@@ -293,7 +293,7 @@ public:
~Master();
- static void registerOptions(Configuration* conf);
+ static void registerOptions(Configurator* conf);
state::MasterState *getState();
Modified: incubator/mesos/trunk/src/master_main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master_main.cpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master_main.cpp (original)
+++ incubator/mesos/trunk/src/master_main.cpp Sun Jun 5 05:45:04 2011
@@ -1,7 +1,7 @@
#include <getopt.h>
#include <libgen.h>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "master.hpp"
#include "master_webui.hpp"
@@ -13,7 +13,7 @@ using boost::bad_lexical_cast;
using namespace nexus::internal::master;
-void usage(const char* progName, const Configuration& conf)
+void usage(const char* progName, const Configurator& conf)
{
cerr << "Usage: " << progName << " [--port=PORT] [--url=URL] [...]" << endl
<< endl
@@ -28,7 +28,7 @@ void usage(const char* progName, const C
int main(int argc, char **argv)
{
- Configuration conf;
+ Configurator conf;
conf.addOption<string>("url", 'u', "URL used for leader election");
conf.addOption<int>("port", 'p', "Port to listen on", 50010);
conf.addOption<bool>("quiet", 'q', "Disable logging to stderr", false);
Modified: incubator/mesos/trunk/src/nexus_local.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/nexus_local.cpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/nexus_local.cpp (original)
+++ incubator/mesos/trunk/src/nexus_local.cpp Sun Jun 5 05:45:04 2011
@@ -6,7 +6,7 @@
#include <map>
#include <vector>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "foreach.hpp"
#include "nexus_local.hpp"
#include "process_based_isolation_module.hpp"
Modified: incubator/mesos/trunk/src/slave.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave.cpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave.cpp (original)
+++ incubator/mesos/trunk/src/slave.cpp Sun Jun 5 05:45:04 2011
@@ -73,7 +73,7 @@ Slave::Slave(const Params& _conf, Resour
isolationModule(_isolationModule) {}
-void Slave::registerOptions(Configuration* conf)
+void Slave::registerOptions(Configurator* conf)
{
}
Modified: incubator/mesos/trunk/src/slave.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave.hpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave.hpp (original)
+++ incubator/mesos/trunk/src/slave.hpp Sun Jun 5 05:45:04 2011
@@ -28,7 +28,7 @@
#include <reliable.hpp>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "fatal.hpp"
#include "foreach.hpp"
#include "isolation_module.hpp"
@@ -185,7 +185,7 @@ public:
virtual ~Slave();
- static void registerOptions(Configuration* conf);
+ static void registerOptions(Configurator* conf);
state::SlaveState *getState();
Modified: incubator/mesos/trunk/src/slave_main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave_main.cpp?rev=1131888&r1=1131887&r2=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave_main.cpp (original)
+++ incubator/mesos/trunk/src/slave_main.cpp Sun Jun 5 05:45:04 2011
@@ -1,5 +1,6 @@
#include <getopt.h>
+#include "configurator.hpp"
#include "isolation_module_factory.hpp"
#include "slave.hpp"
#include "slave_webui.hpp"
@@ -12,7 +13,7 @@ using namespace std;
using namespace nexus::internal::slave;
-void usage(const char *programName, const Configuration& conf)
+void usage(const char *programName, const Configurator& conf)
{
cerr << "Usage: " << programName
<< " --url=MASTER_URL [--cpus=NUM] [--mem=NUM] [...]" << endl
@@ -28,7 +29,7 @@ void usage(const char *programName, cons
int main(int argc, char **argv)
{
- Configuration conf;
+ Configurator conf;
conf.addOption<string>("url", 'u', "Master URL");
conf.addOption<int>("port", 'p', "Port to listen on (default: random)");
conf.addOption<bool>("quiet", 'q', "Disable logging to stderr", false);
Copied: incubator/mesos/trunk/src/tests/test_configurator.cpp (from r1131887, incubator/mesos/trunk/src/tests/test_configuration.cpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/test_configurator.cpp?p2=incubator/mesos/trunk/src/tests/test_configurator.cpp&p1=incubator/mesos/trunk/src/tests/test_configuration.cpp&r1=1131887&r2=1131888&rev=1131888&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/test_configuration.cpp (original)
+++ incubator/mesos/trunk/src/tests/test_configurator.cpp Sun Jun 5 05:45:04 2011
@@ -4,7 +4,7 @@
#include <boost/lexical_cast.hpp>
-#include "configuration.hpp"
+#include "configurator.hpp"
#include "testing_utils.hpp"
using std::ofstream;
@@ -19,10 +19,10 @@ using namespace nexus::internal;
using namespace nexus::internal::test;
-TEST(ConfigurationTest, Environment)
+TEST(ConfiguratorTest, Environment)
{
setenv("MESOS_TEST", "working", true);
- Configuration conf;
+ Configurator conf;
conf.load();
unsetenv("MESOS_TEST");
@@ -30,7 +30,7 @@ TEST(ConfigurationTest, Environment)
}
-TEST(ConfigurationTest, DefaultOptions)
+TEST(ConfiguratorTest, DefaultOptions)
{
const int ARGC = 4;
char* argv[ARGC];
@@ -39,7 +39,7 @@ TEST(ConfigurationTest, DefaultOptions)
argv[2] = (char*) "--test2";
argv[3] = (char*) "--excp=txt";
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( {
conf.addOption<int>("test1", "Testing option", 500);
@@ -64,7 +64,7 @@ TEST(ConfigurationTest, DefaultOptions)
}
-TEST(ConfigurationTest, CommandLine)
+TEST(ConfiguratorTest, CommandLine)
{
const int ARGC = 8;
char* argv[ARGC];
@@ -77,7 +77,7 @@ TEST(ConfigurationTest, CommandLine)
argv[6] = (char*) "--cAsE=4";
argv[7] = (char*) "--space=Long String";
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( {
conf.addOption<int>("negative", 'N', "some val", -30);
conf.addOption<string>("test1", "textual value", "text2");
@@ -95,7 +95,7 @@ TEST(ConfigurationTest, CommandLine)
// Check whether specifying MESOS_HOME allows a config file to be loaded
// from the default config directory (MESOS_HOME/conf)
-TEST_WITH_WORKDIR(ConfigurationTest, ConfigFileWithMesosHome)
+TEST_WITH_WORKDIR(ConfiguratorTest, ConfigFileWithMesosHome)
{
if (mkdir("conf", 0755) != 0)
FAIL() << "Failed to create directory conf";
@@ -106,7 +106,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
file.close();
setenv("MESOS_HOME", ".", 1);
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( conf.load() );
unsetenv("MESOS_HOME");
@@ -116,7 +116,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
// Check whether specifying just MESOS_CONF allows a config file to be loaded
-TEST_WITH_WORKDIR(ConfigurationTest, ConfigFileWithConfDir)
+TEST_WITH_WORKDIR(ConfiguratorTest, ConfigFileWithConfDir)
{
if (mkdir("conf2", 0755) != 0)
FAIL() << "Failed to create directory conf2";
@@ -126,7 +126,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
file << "test4=milk\n";
file.close();
setenv("MESOS_CONF", "conf2", 1);
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( conf.load() );
unsetenv("MESOS_CONF");
@@ -137,7 +137,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
// Check that setting MESOS_CONF variable overrides the default location
// of conf directory relative in MESOS_HOME/conf.
-TEST_WITH_WORKDIR(ConfigurationTest, ConfigFileWithHomeAndDir)
+TEST_WITH_WORKDIR(ConfiguratorTest, ConfigFileWithHomeAndDir)
{
if (mkdir("conf2", 0755) != 0)
FAIL() << "Failed to create directory conf2";
@@ -148,7 +148,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
file.close();
setenv("MESOS_HOME", ".", 1);
setenv("MESOS_CONF", "conf2", 1);
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( conf.load() );
unsetenv("MESOS_CONF");
unsetenv("MESOS_HOME");
@@ -160,7 +160,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Con
// Check that when we specify a conf directory on the command line,
// we load values from the config file first and then the command line
-TEST_WITH_WORKDIR(ConfigurationTest, CommandLineConfFlag)
+TEST_WITH_WORKDIR(ConfiguratorTest, CommandLineConfFlag)
{
if (mkdir("conf2", 0755) != 0)
FAIL() << "Failed to create directory conf2";
@@ -177,7 +177,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Com
argv[2] = (char*) "--b=overridden";
argv[3] = (char*) "--d=fromCmdLine";
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( conf.load(ARGC, argv, false) );
EXPECT_EQ("1", conf.getParams()["a"]);
@@ -191,7 +191,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Com
// environment variable, a config file element , and a config flag
// are all present. Command line flags should have the highest priority,
// second should be environment variables, and last should be the file.
-TEST_WITH_WORKDIR(ConfigurationTest, LoadingPriorities)
+TEST_WITH_WORKDIR(ConfiguratorTest, LoadingPriorities)
{
// Create a file which contains parameters a, b, c and d
if (mkdir("conf", 0755) != 0)
@@ -215,7 +215,7 @@ TEST_WITH_WORKDIR(ConfigurationTest, Loa
argv[1] = (char*) "--a=fromCmdLine";
argv[2] = (char*) "--c=fromCmdLine";
- Configuration conf;
+ Configurator conf;
EXPECT_NO_THROW( conf.load(ARGC, argv, false) );
// Clear the environment vars set above