You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2014/06/10 00:01:38 UTC

git commit: Updated Mesos codebase to set the framework principal in FrameworkInfo.

Repository: mesos
Updated Branches:
  refs/heads/master 5172630ae -> efb4763a3


Updated Mesos codebase to set the framework principal in FrameworkInfo.

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


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/efb4763a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/efb4763a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/efb4763a

Branch: refs/heads/master
Commit: efb4763a3ae0a42bf927fe45c233899e85701b26
Parents: 5172630
Author: Jiang Yan Xu <ya...@jxu.me>
Authored: Wed Jun 4 17:11:54 2014 -0700
Committer: Jiang Yan Xu <ya...@jxu.me>
Committed: Mon Jun 9 15:00:15 2014 -0700

----------------------------------------------------------------------
 src/examples/balloon_framework.cpp              |  4 ++
 src/examples/java/TestExceptionFramework.java   | 13 +++---
 src/examples/java/TestFramework.java            | 10 +++--
 .../java/TestMultipleExecutorsFramework.java    |  1 +
 src/examples/long_lived_framework.cpp           |  4 ++
 src/examples/no_executor_framework.cpp          |  4 ++
 src/examples/python/test_framework.py           |  4 ++
 src/examples/test_framework.cpp                 |  4 ++
 src/tests/allocator_tests.cpp                   | 45 +++++++++++++-------
 9 files changed, 65 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp b/src/examples/balloon_framework.cpp
index 400764d..2b68b99 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -244,9 +244,13 @@ int main(int argc, char** argv)
     credential.set_principal(getenv("DEFAULT_PRINCIPAL"));
     credential.set_secret(getenv("DEFAULT_SECRET"));
 
+    framework.set_principal(getenv("DEFAULT_PRINCIPAL"));
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1], credential);
   } else {
+    framework.set_principal("balloon-framework-cpp");
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1]);
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/java/TestExceptionFramework.java
----------------------------------------------------------------------
diff --git a/src/examples/java/TestExceptionFramework.java b/src/examples/java/TestExceptionFramework.java
index 464b3b0..78720b0 100644
--- a/src/examples/java/TestExceptionFramework.java
+++ b/src/examples/java/TestExceptionFramework.java
@@ -80,10 +80,9 @@ public class TestExceptionFramework {
       System.exit(1);
     }
 
-    FrameworkInfo framework = FrameworkInfo.newBuilder()
+    FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder()
         .setUser("") // Have Mesos fill in the current user.
-        .setName("Exception Framework (Java)")
-        .build();
+        .setName("Exception Framework (Java)");
 
     MesosSchedulerDriver driver = null;
     if (System.getenv("MESOS_AUTHENTICATE") != null) {
@@ -104,15 +103,19 @@ public class TestExceptionFramework {
         .setSecret(ByteString.copyFrom(System.getenv("DEFAULT_SECRET").getBytes()))
         .build();
 
+      frameworkBuilder.setPrincipal(System.getenv("DEFAULT_PRINCIPAL"));
+
       driver = new MesosSchedulerDriver(
           new TestExceptionScheduler(),
-          framework,
+          frameworkBuilder.build(),
           args[0],
           credential);
     } else {
+      frameworkBuilder.setPrincipal("exception-framework-java");
+
       driver = new MesosSchedulerDriver(
           new TestExceptionScheduler(),
-          framework,
+          frameworkBuilder.build(),
           args[0]);
     }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/java/TestFramework.java
----------------------------------------------------------------------
diff --git a/src/examples/java/TestFramework.java b/src/examples/java/TestFramework.java
index 65ee2dc..e01b27c 100644
--- a/src/examples/java/TestFramework.java
+++ b/src/examples/java/TestFramework.java
@@ -157,8 +157,6 @@ public class TestFramework {
       frameworkBuilder.setCheckpoint(true);
     }
 
-    FrameworkInfo framework = frameworkBuilder.build();
-
     Scheduler scheduler = args.length == 1
         ? new TestScheduler(executor)
         : new TestScheduler(executor, Integer.parseInt(args[1]));
@@ -182,9 +180,13 @@ public class TestFramework {
         .setSecret(ByteString.copyFrom(System.getenv("DEFAULT_SECRET").getBytes()))
         .build();
 
-      driver = new MesosSchedulerDriver(scheduler, framework, args[0], credential);
+      frameworkBuilder.setPrincipal(System.getenv("DEFAULT_PRINCIPAL"));
+
+      driver = new MesosSchedulerDriver(scheduler, frameworkBuilder.build(), args[0], credential);
     } else {
-      driver = new MesosSchedulerDriver(scheduler, framework, args[0]);
+      frameworkBuilder.setPrincipal("test-framework-java");
+
+      driver = new MesosSchedulerDriver(scheduler, frameworkBuilder.build(), args[0]);
     }
 
     int status = driver.run() == Status.DRIVER_STOPPED ? 0 : 1;

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/java/TestMultipleExecutorsFramework.java
----------------------------------------------------------------------
diff --git a/src/examples/java/TestMultipleExecutorsFramework.java b/src/examples/java/TestMultipleExecutorsFramework.java
index 6846959..c56e064 100644
--- a/src/examples/java/TestMultipleExecutorsFramework.java
+++ b/src/examples/java/TestMultipleExecutorsFramework.java
@@ -202,6 +202,7 @@ public class TestMultipleExecutorsFramework {
     FrameworkInfo framework = FrameworkInfo.newBuilder()
         .setUser("") // Have Mesos fill in the current user.
         .setName("Test Multiple Executors Framework (Java)")
+        .setPrincipal("test-multiple-executors-framework-java")
         .build();
 
     MesosSchedulerDriver driver = new MesosSchedulerDriver(

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/long_lived_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_framework.cpp b/src/examples/long_lived_framework.cpp
index 638e316..06a60a0 100644
--- a/src/examples/long_lived_framework.cpp
+++ b/src/examples/long_lived_framework.cpp
@@ -201,9 +201,13 @@ int main(int argc, char** argv)
     credential.set_principal(getenv("DEFAULT_PRINCIPAL"));
     credential.set_secret(getenv("DEFAULT_SECRET"));
 
+    framework.set_principal(getenv("DEFAULT_PRINCIPAL"));
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1], credential);
   } else {
+    framework.set_principal("long-lived-framework-cpp");
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1]);
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/no_executor_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/no_executor_framework.cpp b/src/examples/no_executor_framework.cpp
index 0cb987c..65cccd1 100644
--- a/src/examples/no_executor_framework.cpp
+++ b/src/examples/no_executor_framework.cpp
@@ -196,9 +196,13 @@ int main(int argc, char** argv)
     credential.set_principal(getenv("DEFAULT_PRINCIPAL"));
     credential.set_secret(getenv("DEFAULT_SECRET"));
 
+    framework.set_principal(getenv("DEFAULT_PRINCIPAL"));
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1], credential);
   } else {
+    framework.set_principal("no-executor-framework-cpp");
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, argv[1]);
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/python/test_framework.py
----------------------------------------------------------------------
diff --git a/src/examples/python/test_framework.py b/src/examples/python/test_framework.py
index c37de6e..fce090f 100755
--- a/src/examples/python/test_framework.py
+++ b/src/examples/python/test_framework.py
@@ -151,12 +151,16 @@ if __name__ == "__main__":
         credential.principal = os.getenv("DEFAULT_PRINCIPAL")
         credential.secret = os.getenv("DEFAULT_SECRET")
 
+        framework.principal = os.getenv("DEFAULT_PRINCIPAL")
+
         driver = mesos.MesosSchedulerDriver(
             TestScheduler(executor),
             framework,
             sys.argv[1],
             credential)
     else:
+        framework.principal = "test-framework-python"
+
         driver = mesos.MesosSchedulerDriver(
             TestScheduler(executor),
             framework,

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/examples/test_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_framework.cpp b/src/examples/test_framework.cpp
index 66ce3a6..34f70dc 100644
--- a/src/examples/test_framework.cpp
+++ b/src/examples/test_framework.cpp
@@ -234,9 +234,13 @@ int main(int argc, char** argv)
     credential.set_principal(getenv("DEFAULT_PRINCIPAL"));
     credential.set_secret(getenv("DEFAULT_SECRET"));
 
+    framework.set_principal(getenv("DEFAULT_PRINCIPAL"));
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, master.get(), credential);
   } else {
+    framework.set_principal("test-framework-cpp");
+
     driver = new MesosSchedulerDriver(
         &scheduler, framework, master.get());
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/efb4763a/src/tests/allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/allocator_tests.cpp b/src/tests/allocator_tests.cpp
index 430662b..7ad4964 100644
--- a/src/tests/allocator_tests.cpp
+++ b/src/tests/allocator_tests.cpp
@@ -95,7 +95,8 @@ TEST_F(DRFAllocatorTest, DRFAllocatorProcess)
   ASSERT_SOME(slave1);
   // Total cluster resources now cpus=2, mem=1024.
 
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_name("framework1");
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_role("role1");
@@ -122,7 +123,8 @@ TEST_F(DRFAllocatorTest, DRFAllocatorProcess)
   // user1 share = 1 (cpus=2, mem=1024)
   //   framework1 share = 1
 
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_name("framework2");
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_role("role2");
@@ -196,7 +198,8 @@ TEST_F(DRFAllocatorTest, DRFAllocatorProcess)
   // user2 share = 0.71 (cpus=4, mem=2560)
   //   framework2 share = 1
 
-  FrameworkInfo frameworkInfo3;
+  FrameworkInfo frameworkInfo3; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo3 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo3.set_name("framework3");
   frameworkInfo3.set_user("user3");
   frameworkInfo3.set_role("role1");
@@ -246,7 +249,8 @@ TEST_F(DRFAllocatorTest, DRFAllocatorProcess)
   // user2 share = 0.4 (cpus=4, mem=2560)
   //   framework2 share = 1
 
-  FrameworkInfo frameworkInfo4;
+  FrameworkInfo frameworkInfo4; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo4 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo4.set_name("framework4");
   frameworkInfo4.set_user("user1");
   frameworkInfo4.set_role("role1");
@@ -371,7 +375,8 @@ TEST_F(ReservationAllocatorTest, ReservedResources)
 
   AWAIT_READY(slaveAdded);
 
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_name("framework1");
   frameworkInfo1.set_role("role1");
@@ -393,7 +398,8 @@ TEST_F(ReservationAllocatorTest, ReservedResources)
   // unreserved resources on slave2.
   AWAIT_READY(resourceOffers1);
 
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_name("framework2");
   frameworkInfo2.set_role("role2");
@@ -414,7 +420,8 @@ TEST_F(ReservationAllocatorTest, ReservedResources)
   // framework2 gets all of its reserved resources on slave2.
   AWAIT_READY(resourceOffers2);
 
-  FrameworkInfo frameworkInfo3;
+  FrameworkInfo frameworkInfo3; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo3 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo3.set_user("user2");
   frameworkInfo3.set_name("framework3");
   frameworkInfo3.set_role("role3");
@@ -519,7 +526,8 @@ TEST_F(ReservationAllocatorTest, ResourcesReturned)
   // Wait until allocator has added slave2.
   AWAIT_READY(slaveAdded2);
 
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_name("framework1");
   frameworkInfo1.set_role("role1");
@@ -567,7 +575,8 @@ TEST_F(ReservationAllocatorTest, ResourcesReturned)
 
   AWAIT_READY(resourceOffers1);
 
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_name("framework2");
   frameworkInfo2.set_role("role2");
@@ -776,7 +785,8 @@ TYPED_TEST(AllocatorTest, ResourcesUnused)
   // expected offer.
   AWAIT_READY(resourcesUnused);
 
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_name("framework2");
 
@@ -845,7 +855,8 @@ TYPED_TEST(AllocatorTest, OutOfOrderDispatch)
   Try<PID<Slave> > slave1 = this->StartSlave(flags1);
   ASSERT_SOME(slave1);
 
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_name("framework1");
 
@@ -908,7 +919,8 @@ TYPED_TEST(AllocatorTest, OutOfOrderDispatch)
   // TODO(benh): Seems like we should wait for the above
   // resourcesRecovered to be executed.
 
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_name("framework2");
 
@@ -972,7 +984,8 @@ TYPED_TEST(AllocatorTest, SchedulerFailover)
   Try<PID<Slave> > slave = this->StartSlave(&exec, flags);
   ASSERT_SOME(slave);
 
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_name("framework1");
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_failover_timeout(10);
@@ -1664,7 +1677,8 @@ TYPED_TEST(AllocatorTest, RoleTest)
 
   // Launch a framework with a role that doesn't exist to see that it
   // receives an error message.
-  FrameworkInfo frameworkInfo1;
+  FrameworkInfo frameworkInfo1; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo1.set_name("framework1");
   frameworkInfo1.set_user("user1");
   frameworkInfo1.set_role("role1");
@@ -1683,7 +1697,8 @@ TYPED_TEST(AllocatorTest, RoleTest)
   AWAIT_READY(errorMessage);
 
   // Launch a framework under an existing role to see that it registers.
-  FrameworkInfo frameworkInfo2;
+  FrameworkInfo frameworkInfo2; // Bug in gcc 4.1.*, must assign on next line.
+  frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
   frameworkInfo2.set_name("framework2");
   frameworkInfo2.set_user("user2");
   frameworkInfo2.set_role("role2");