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:29:25 UTC

svn commit: r1131785 - in /incubator/mesos/trunk: include/nexus_exec.h include/nexus_exec.hpp src/cpp_test_executor.cpp src/messages.hpp src/nexus_exec.cpp src/slave.cpp src/test_exec.cpp

Author: benh
Date: Sun Jun  5 05:29:25 2011
New Revision: 1131785

URL: http://svn.apache.org/viewvc?rev=1131785&view=rev
Log:
Added hostname field to ExecutorArgs.

Modified:
    incubator/mesos/trunk/include/nexus_exec.h
    incubator/mesos/trunk/include/nexus_exec.hpp
    incubator/mesos/trunk/src/cpp_test_executor.cpp
    incubator/mesos/trunk/src/messages.hpp
    incubator/mesos/trunk/src/nexus_exec.cpp
    incubator/mesos/trunk/src/slave.cpp
    incubator/mesos/trunk/src/test_exec.cpp

Modified: incubator/mesos/trunk/include/nexus_exec.h
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/nexus_exec.h?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/include/nexus_exec.h (original)
+++ incubator/mesos/trunk/include/nexus_exec.h Sun Jun  5 05:29:25 2011
@@ -11,6 +11,7 @@ extern "C" {
 struct nexus_exec {
   void (*init) (struct nexus_exec*,
                 slave_id,
+                const char*,  // hostname
                 framework_id,
                 const char*,  // framework_name
                 const void*,  // init_arg

Modified: incubator/mesos/trunk/include/nexus_exec.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/nexus_exec.hpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/include/nexus_exec.hpp (original)
+++ incubator/mesos/trunk/include/nexus_exec.hpp Sun Jun  5 05:29:25 2011
@@ -20,12 +20,14 @@ struct ExecutorArgs
 {
   ExecutorArgs() {}
 
-  ExecutorArgs(SlaveID _slaveId, FrameworkID _frameworkId,
-      const std::string& _frameworkName, const data_string& _data)
-    : slaveId(_slaveId), frameworkId(_frameworkId),
+  ExecutorArgs(SlaveID _slaveId, const std::string& _host,
+      FrameworkID _frameworkId, const std::string& _frameworkName,
+      const data_string& _data)
+    : slaveId(_slaveId), host(_host), frameworkId(_frameworkId),
       frameworkName(_frameworkName), data(_data) {};
 
   SlaveID slaveId;
+  std::string host;
   FrameworkID frameworkId;
   std::string frameworkName;
   data_string data;

Modified: incubator/mesos/trunk/src/cpp_test_executor.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/cpp_test_executor.cpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/src/cpp_test_executor.cpp (original)
+++ incubator/mesos/trunk/src/cpp_test_executor.cpp Sun Jun  5 05:29:25 2011
@@ -13,7 +13,7 @@ public:
   virtual ~MyExecutor() {}
 
   virtual void init(ExecutorDriver*, const ExecutorArgs& args) {
-    cout << "Init" << endl;
+    cout << "Initalized executor on " << args.host << endl;
   }
 
   virtual void launchTask(ExecutorDriver* d, const TaskDescription& task) {

Modified: incubator/mesos/trunk/src/messages.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/messages.hpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/src/messages.hpp (original)
+++ incubator/mesos/trunk/src/messages.hpp Sun Jun  5 05:29:25 2011
@@ -287,6 +287,7 @@ TUPLE(E2S_FRAMEWORK_MESSAGE,
 
 TUPLE(S2E_REGISTER_REPLY,
       (SlaveID,
+       std::string /*hostname*/,
        std::string /*frameworkName*/,
        std::string /*initArg*/));
 

Modified: incubator/mesos/trunk/src/nexus_exec.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/nexus_exec.cpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/src/nexus_exec.cpp (original)
+++ incubator/mesos/trunk/src/nexus_exec.cpp Sun Jun  5 05:29:25 2011
@@ -62,10 +62,11 @@ protected:
       // a timely manner (if at all).
       switch(receive()) {
         case S2E_REGISTER_REPLY: {
-          string name;
+          string host;
+          string fwName;
           string args;
-          unpack<S2E_REGISTER_REPLY>(sid, name, args);
-          ExecutorArgs execArg(sid, fid, name, args);
+          unpack<S2E_REGISTER_REPLY>(sid, host, fwName, args);
+          ExecutorArgs execArg(sid, host, fid, fwName, args);
           invoke(bind(&Executor::init, executor, driver, ref(execArg)));
           break;
         }
@@ -273,6 +274,7 @@ public:
   {
     exec->init(exec,
                args.slaveId.c_str(),
+               args.host.c_str(),
                args.frameworkId.c_str(),
                args.frameworkName.c_str(),
                args.data.data(),

Modified: incubator/mesos/trunk/src/slave.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave.cpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave.cpp (original)
+++ incubator/mesos/trunk/src/slave.cpp Sun Jun  5 05:29:25 2011
@@ -329,6 +329,7 @@ void Slave::operator () ()
           isolationModule->resourcesChanged(fw);
           // Tell executor that it's registered and give it its queued tasks
           send(from(), pack<S2E_REGISTER_REPLY>(this->id,
+                                                hostname,
                                                 fw->name,
                                                 fw->executorInfo.initArg));
           sendQueuedTasks(fw);

Modified: incubator/mesos/trunk/src/test_exec.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/test_exec.cpp?rev=1131785&r1=1131784&r2=1131785&view=diff
==============================================================================
--- incubator/mesos/trunk/src/test_exec.cpp (original)
+++ incubator/mesos/trunk/src/test_exec.cpp Sun Jun  5 05:29:25 2011
@@ -12,13 +12,14 @@ using std::endl;
 
 void init(struct nexus_exec* exec,
           slave_id sid,
+          const char* host,
           framework_id fid,
           const char* name,
           const void* init_arg,
           int init_arg_len)
 {
-  cout << "init with slave ID " << sid << " framework ID " << fid
-       << " and name " << name << endl;
+  cout << "init executor on " << host << " (slave ID " << sid << ") "
+       << "for framework " << name << " (framework ID " << fid << ")" << endl;
 }