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 2013/03/04 23:27:08 UTC

svn commit: r1452574 - in /incubator/mesos/trunk/src: common/type_utils.hpp examples/balloon_framework.cpp examples/java/TestFramework.java examples/python/test_framework.py examples/test_framework.cpp

Author: vinodkone
Date: Mon Mar  4 22:27:07 2013
New Revision: 1452574

URL: http://svn.apache.org/r1452574
Log:
Fixed ExecutorInfo comparision and example tests.

Review: https://reviews.apache.org/r/9723

Modified:
    incubator/mesos/trunk/src/common/type_utils.hpp
    incubator/mesos/trunk/src/examples/balloon_framework.cpp
    incubator/mesos/trunk/src/examples/java/TestFramework.java
    incubator/mesos/trunk/src/examples/python/test_framework.py
    incubator/mesos/trunk/src/examples/test_framework.cpp

Modified: incubator/mesos/trunk/src/common/type_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/type_utils.hpp?rev=1452574&r1=1452573&r2=1452574&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/type_utils.hpp (original)
+++ incubator/mesos/trunk/src/common/type_utils.hpp Mon Mar  4 22:27:07 2013
@@ -242,9 +242,16 @@ inline bool operator == (const CommandIn
 inline bool operator == (const ExecutorInfo& left, const ExecutorInfo& right)
 {
   return left.executor_id() == right.executor_id() &&
+    left.has_framework_id() == right.has_framework_id() &&
+    (!left.has_framework_id() ||
+    (left.framework_id() == right.framework_id())) &&
     left.command() == right.command() &&
     internal::Resources(left.resources()) ==
     internal::Resources(right.resources()) &&
+    left.has_name() == right.has_name() &&
+    (!left.has_name() || (left.name() == right.name())) &&
+    left.has_source() == right.has_source() &&
+    (!left.has_source() || (left.source() == right.source())) &&
     left.has_data() == right.has_data() &&
     (!left.has_data() || (left.data() == right.data()));
 }

Modified: incubator/mesos/trunk/src/examples/balloon_framework.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/balloon_framework.cpp?rev=1452574&r1=1452573&r2=1452574&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/balloon_framework.cpp (original)
+++ incubator/mesos/trunk/src/examples/balloon_framework.cpp Mon Mar  4 22:27:07 2013
@@ -92,7 +92,6 @@ public:
         task.mutable_task_id()->set_value("1");
         task.mutable_slave_id()->MergeFrom(offer.slave_id());
         task.mutable_executor()->MergeFrom(executor);
-        task.mutable_executor()->set_source("task_1");
         task.set_data(stringify<size_t>(balloonLimit));
 
         // Use up all the memory from the offer.
@@ -198,6 +197,7 @@ int main(int argc, char** argv)
   executor.mutable_executor_id()->set_value("default");
   executor.mutable_command()->set_value(uri);
   executor.set_name("Balloon Executor");
+  executor.set_source("balloon_test");
 
   Resource* mem = executor.add_resources();
   mem->set_name("mem");

Modified: incubator/mesos/trunk/src/examples/java/TestFramework.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/java/TestFramework.java?rev=1452574&r1=1452573&r2=1452574&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/java/TestFramework.java (original)
+++ incubator/mesos/trunk/src/examples/java/TestFramework.java Mon Mar  4 22:27:07 2013
@@ -75,8 +75,7 @@ public class TestFramework {
                           .setName("mem")
                           .setType(Value.Type.SCALAR)
                           .setScalar(Value.Scalar.newBuilder().setValue(128)))
-            .setExecutor(ExecutorInfo.newBuilder(executor)
-                         .setSource("task_" + taskId.getValue()))
+            .setExecutor(ExecutorInfo.newBuilder(executor))
             .build();
           tasks.add(task);
         }
@@ -143,6 +142,7 @@ public class TestFramework {
       .setExecutorId(ExecutorID.newBuilder().setValue("default"))
       .setCommand(CommandInfo.newBuilder().setValue(uri))
       .setName("Test Executor (Java)")
+      .setSource("java_test")
       .build();
 
     FrameworkInfo framework = FrameworkInfo.newBuilder()

Modified: incubator/mesos/trunk/src/examples/python/test_framework.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/python/test_framework.py?rev=1452574&r1=1452573&r2=1452574&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/python/test_framework.py (original)
+++ incubator/mesos/trunk/src/examples/python/test_framework.py Mon Mar  4 22:27:07 2013
@@ -56,7 +56,6 @@ class TestScheduler(mesos.Scheduler):
         task.slave_id.value = offer.slave_id.value
         task.name = "task %d" % tid
         task.executor.MergeFrom(self.executor)
-        task.executor.source = "task_%d" % tid
 
         cpus = task.resources.add()
         cpus.name = "cpus"
@@ -124,6 +123,7 @@ if __name__ == "__main__":
   executor.executor_id.value = "default"
   executor.command.value = os.path.abspath("./test-executor")
   executor.name = "Test Executor (Python)"
+  executor.source = "python_test"
 
   framework = mesos_pb2.FrameworkInfo()
   framework.user = "" # Have Mesos fill in the current user.

Modified: incubator/mesos/trunk/src/examples/test_framework.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/test_framework.cpp?rev=1452574&r1=1452573&r2=1452574&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/test_framework.cpp (original)
+++ incubator/mesos/trunk/src/examples/test_framework.cpp Mon Mar  4 22:27:07 2013
@@ -103,7 +103,6 @@ public:
         task.mutable_task_id()->set_value(lexical_cast<string>(taskId));
         task.mutable_slave_id()->MergeFrom(offer.slave_id());
         task.mutable_executor()->MergeFrom(executor);
-        task.mutable_executor()->set_source("task_" + stringify(taskId));
 
         Resource* resource;
 
@@ -183,6 +182,7 @@ int main(int argc, char** argv)
   executor.mutable_executor_id()->set_value("default");
   executor.mutable_command()->set_value(uri);
   executor.set_name("Test Executor (C++)");
+  executor.set_source("cpp_test");
 
   TestScheduler scheduler(executor);