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 2015/04/25 23:33:29 UTC

[02/11] mesos git commit: Removed LAUNCH call from scheduler.proto.

Removed LAUNCH call from scheduler.proto.

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


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

Branch: refs/heads/master
Commit: 79086eb1e5c470d4b8e425ab5e26061fc84df14b
Parents: ec0a9f3
Author: Vinod Kone <vi...@gmail.com>
Authored: Fri Mar 20 15:57:42 2015 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Sat Apr 25 11:32:46 2015 -1000

----------------------------------------------------------------------
 include/mesos/scheduler/scheduler.proto         | 14 ++----
 src/examples/low_level_scheduler_libprocess.cpp | 11 +++--
 src/examples/low_level_scheduler_pthread.cpp    | 11 +++--
 src/master/master.cpp                           |  3 +-
 src/scheduler/scheduler.cpp                     | 50 +-------------------
 src/tests/scheduler_tests.cpp                   | 12 +++--
 6 files changed, 29 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/include/mesos/scheduler/scheduler.proto
----------------------------------------------------------------------
diff --git a/include/mesos/scheduler/scheduler.proto b/include/mesos/scheduler/scheduler.proto
index 783a63a..ce401aa 100644
--- a/include/mesos/scheduler/scheduler.proto
+++ b/include/mesos/scheduler/scheduler.proto
@@ -121,7 +121,6 @@ message Call {
     REVIVE = 6;
     DECLINE = 5;
     ACCEPT = 12;
-    LAUNCH = 7;
     KILL = 8;
     ACKNOWLEDGE = 9;
     RECONCILE = 10;
@@ -162,20 +161,16 @@ message Call {
   //     ]
   //   }
   //
-  // TODO(bmahler): Not implemented.
+  // Note that any of the offer’s resources not used in the 'Accept'
+  // call (e.g., to launch a task) are considered unused and might be
+  // reoffered to other frameworks. In other words, the same OfferID
+  // cannot be used in more than one 'Accept' call.
   message Accept {
     repeated OfferID offer_ids = 1;
     repeated Offer.Operation operations = 2;
     optional Filters filters = 3;
   }
 
-  // TODO(bmahler): Deprecate Launch in favor of Accept.
-  message Launch {
-    repeated TaskInfo task_infos = 1;
-    repeated OfferID offer_ids = 2;
-    optional Filters filters = 3;
-  }
-
   message Kill {
     required TaskID task_id = 1;
   }
@@ -216,7 +211,6 @@ message Call {
   optional Request request = 3;
   optional Decline decline = 4;
   optional Accept accept = 10;
-  optional Launch launch = 5;
   optional Kill kill = 6;
   optional Acknowledge acknowledge = 7;
   optional Reconcile reconcile = 8;

http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/src/examples/low_level_scheduler_libprocess.cpp
----------------------------------------------------------------------
diff --git a/src/examples/low_level_scheduler_libprocess.cpp b/src/examples/low_level_scheduler_libprocess.cpp
index 63d34ee..2a388fe 100644
--- a/src/examples/low_level_scheduler_libprocess.cpp
+++ b/src/examples/low_level_scheduler_libprocess.cpp
@@ -249,13 +249,16 @@ private:
 
       Call call;
       call.mutable_framework_info()->CopyFrom(framework);
-      call.set_type(Call::LAUNCH);
+      call.set_type(Call::ACCEPT);
 
-      Call::Launch* launch = call.mutable_launch();
+      Call::Accept* accept = call.mutable_accept();
+      accept->add_offer_ids()->CopyFrom(offer.id());
+
+      Offer::Operation* operation = accept->add_operations();
+      operation->set_type(Offer::Operation::LAUNCH);
       foreach (const TaskInfo& taskInfo, tasks) {
-        launch->add_task_infos()->CopyFrom(taskInfo);
+        operation->mutable_launch()->add_task_infos()->CopyFrom(taskInfo);
       }
-      launch->add_offer_ids()->CopyFrom(offer.id());
 
       mesos.send(call);
     }

http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/src/examples/low_level_scheduler_pthread.cpp
----------------------------------------------------------------------
diff --git a/src/examples/low_level_scheduler_pthread.cpp b/src/examples/low_level_scheduler_pthread.cpp
index 6d1f938..063b7f6 100644
--- a/src/examples/low_level_scheduler_pthread.cpp
+++ b/src/examples/low_level_scheduler_pthread.cpp
@@ -298,14 +298,17 @@ private:
       }
 
       Call call;
-      call.set_type(Call::LAUNCH);
       call.mutable_framework_info()->CopyFrom(framework);
+      call.set_type(Call::ACCEPT);
 
-      Call::Launch* launch = call.mutable_launch();
+      Call::Accept* accept = call.mutable_accept();
+      accept->add_offer_ids()->CopyFrom(offer.id());
+
+      Offer::Operation* operation = accept->add_operations();
+      operation->set_type(Offer::Operation::LAUNCH);
       foreach (const TaskInfo& taskInfo, tasks) {
-        launch->add_task_infos()->CopyFrom(taskInfo);
+        operation->mutable_launch()->add_task_infos()->CopyFrom(taskInfo);
       }
-      launch->add_offer_ids()->CopyFrom(offer.id());
 
       mesos.send(call);
     }

http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index f3462d1..865ff89 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1554,6 +1554,8 @@ void Master::receive(
     const UPID& from,
     const scheduler::Call& call)
 {
+  // TODO(vinod): Add metrics for calls.
+
   const FrameworkInfo& frameworkInfo = call.framework_info();
 
   // For REGISTER and REREGISTER calls, no need to look up the
@@ -1602,7 +1604,6 @@ void Master::receive(
       accept(framework, call.accept());
       break;
 
-    case scheduler::Call::LAUNCH:
     case scheduler::Call::KILL:
     case scheduler::Call::ACKNOWLEDGE:
     case scheduler::Call::RECONCILE:

http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index bd9fced..6fbd991 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -295,33 +295,6 @@ public:
         break;
       }
 
-      case Call::LAUNCH: {
-        if (!call.has_launch()) {
-          drop(call, "Expecting 'launch' to be present");
-          return;
-        }
-        // We do some local validation here, but really this should
-        // all happen in the master so it's only implemented once.
-        foreach (TaskInfo& task,
-                 *call.mutable_launch()->mutable_task_infos()) {
-          // Set ExecutorInfo::framework_id if missing since this
-          // field was added to the API later and thus was made
-          // optional.
-          if (task.has_executor() && !task.executor().has_framework_id()) {
-            task.mutable_executor()->mutable_framework_id()->CopyFrom(
-                call.framework_info().id());
-          }
-        }
-
-        LaunchTasksMessage message;
-        message.mutable_framework_id()->CopyFrom(call.framework_info().id());
-        message.mutable_filters()->CopyFrom(call.launch().filters());
-        message.mutable_offer_ids()->CopyFrom(call.launch().offer_ids());
-        message.mutable_tasks()->CopyFrom(call.launch().task_infos());
-        send(master.get(), message);
-        break;
-      }
-
       case Call::KILL: {
         if (!call.has_kill()) {
           drop(call, "Expecting 'kill' to be present");
@@ -766,28 +739,7 @@ protected:
 
   void drop(const Call& call, const string& message)
   {
-    VLOG(1) << "Dropping " << stringify(call.type()) << ": " << message;
-
-    switch (call.type()) {
-      case Call::LAUNCH: {
-        // We drop the tasks preemptively (enqueing update events that
-        // put the task in TASK_LOST). This is a hack for now, to keep
-        // the tasks from being forever in PENDING state, when
-        // actually the master never received the launch.
-        // Unfortuantely this is insufficient since it doesn't capture
-        // the case when the scheduler process sends it but the master
-        // never receives it (i.e., during a master failover). In the
-        // future, this should be solved by higher-level abstractions
-        // and this hack should be considered for removal.
-        foreach (const TaskInfo& task, call.launch().task_infos()) {
-          drop(task, message);
-        }
-        break;
-      }
-
-      default:
-        break;
-    }
+    LOG(WARNING) << "Dropping " << call.type() << ": " << message;
   }
 
 private:

http://git-wip-us.apache.org/repos/asf/mesos/blob/79086eb1/src/tests/scheduler_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp
index 4a89a7a..4ea5528 100644
--- a/src/tests/scheduler_tests.cpp
+++ b/src/tests/scheduler_tests.cpp
@@ -185,10 +185,14 @@ TEST_F(SchedulerTest, TaskRunning)
     Call call;
     call.mutable_framework_info()->CopyFrom(DEFAULT_FRAMEWORK_INFO);
     call.mutable_framework_info()->mutable_id()->CopyFrom(id);
-    call.set_type(Call::LAUNCH);
-    call.mutable_launch()->add_task_infos()->CopyFrom(taskInfo);
-    call.mutable_launch()->add_offer_ids()->CopyFrom(
-        event.get().offers().offers(0).id());
+    call.set_type(Call::ACCEPT);
+
+    Call::Accept* accept = call.mutable_accept();
+    accept->add_offer_ids()->CopyFrom(event.get().offers().offers(0).id());
+
+    Offer::Operation* operation = accept->add_operations();
+    operation->set_type(Offer::Operation::LAUNCH);
+    operation->mutable_launch()->add_task_infos()->CopyFrom(taskInfo);
 
     mesos.send(call);
   }