You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/08/12 21:20:01 UTC

[1/3] git commit: Ensured ExecutorInfo.framework_id is set.

Updated Branches:
  refs/heads/master 699d70857 -> e07add053


Ensured ExecutorInfo.framework_id is set.

This includes an update to the Scheduler Driver to set framework_id
on launchTask requests, as well as a change to the Slave to set
framework_id when generating ExecutorInfos for Command Executors.

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


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

Branch: refs/heads/master
Commit: 2b83a9ae7771bfc2d37ace423edc03d89c2f92f2
Parents: 699d708
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Fri Aug 9 17:04:34 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Mon Aug 12 11:37:55 2013 -0700

----------------------------------------------------------------------
 src/master/master.cpp |  6 +++---
 src/sched/sched.cpp   | 39 ++++++++++++++++++++++++++++++++++++---
 src/slave/slave.cpp   | 16 +++++++++++-----
 src/slave/slave.hpp   |  4 +++-
 4 files changed, 53 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2b83a9ae/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index a2f8929..887ab4b 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2076,9 +2076,9 @@ void Master::readdSlave(Slave* slave,
   hashmap<FrameworkID, Resources> resources;
 
   foreach (const ExecutorInfo& executorInfo, executorInfos) {
-    // TODO(benh): Remove this check if framework_id becomes required
-    // on ExecutorInfo (which will also mean we can remove setting it
-    // in the slave).
+    // TODO(bmahler): ExecutorInfo.framework_id is set by the Scheduler
+    // Driver in 0.14.0. Therefore, in 0.15.0, the slave no longer needs
+    // to set it, and we could remove this CHECK if desired.
     CHECK(executorInfo.has_framework_id());
     if (!slave->hasExecutor(executorInfo.framework_id(),
                             executorInfo.executor_id())) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2b83a9ae/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 5718fe9..c399f24 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -593,9 +593,11 @@ protected:
       return;
     }
 
-    // Check that each TaskInfo has either an ExecutorInfo or a
-    // CommandInfo but not both.
+    vector<TaskInfo> result;
+
     foreach (const TaskInfo& task, tasks) {
+      // Check that each TaskInfo has either an ExecutorInfo or a
+      // CommandInfo but not both.
       if (task.has_executor() == task.has_command()) {
         StatusUpdate update;
         update.mutable_framework_id()->MergeFrom(framework.id());
@@ -608,7 +610,38 @@ protected:
         update.set_uuid(UUID::random().toBytes());
 
         statusUpdate(update, UPID());
+        continue;
+      }
+
+      // Ensure the ExecutorInfo.framework_id is valid, if present.
+      if (task.has_executor() &&
+          task.executor().has_framework_id() &&
+          !(task.executor().framework_id() == framework.id())) {
+        StatusUpdate update;
+        update.mutable_framework_id()->MergeFrom(framework.id());
+        TaskStatus* status = update.mutable_status();
+        status->mutable_task_id()->MergeFrom(task.task_id());
+        status->set_state(TASK_LOST);
+        status->set_message(
+            "ExecutorInfo has an invalid FrameworkID (Actual: " +
+            stringify(task.executor().framework_id()) + " vs Expected: " +
+            stringify(framework.id()) + ")");
+        update.set_timestamp(Clock::now().secs());
+        update.set_uuid(UUID::random().toBytes());
+
+        statusUpdate(update, UPID());
+        continue;
       }
+
+      TaskInfo copy = task;
+
+      // Set the ExecutorInfo.framework_id if missing.
+      if (task.has_executor() && !task.executor().has_framework_id()) {
+        copy.mutable_executor()->mutable_framework_id()->CopyFrom(
+            framework.id());
+      }
+
+      result.push_back(copy);
     }
 
     LaunchTasksMessage message;
@@ -616,7 +649,7 @@ protected:
     message.mutable_offer_id()->MergeFrom(offerId);
     message.mutable_filters()->MergeFrom(filters);
 
-    foreach (const TaskInfo& task, tasks) {
+    foreach (const TaskInfo& task, result) {
       // Keep only the slave PIDs where we run tasks so we can send
       // framework messages directly.
       if (savedOffers.count(offerId) > 0) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2b83a9ae/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 3b49118..dbc4473 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -699,8 +699,10 @@ void Slave::doReliableRegistration()
           continue;
         }
 
-        // TODO(benh): Kill this once framework_id is required
-        // on ExecutorInfo.
+        // TODO(bmahler): Kill this in 0.15.0, as in 0.14.0 we've
+        // added code into the Scheduler Driver to ensure the
+        // framework id is set in ExecutorInfo, effectively making
+        // it a required field.
         ExecutorInfo* executorInfo = message.add_executor_infos();
         executorInfo->MergeFrom(executor->info);
         executorInfo->mutable_framework_id()->MergeFrom(framework->id);
@@ -797,7 +799,7 @@ void Slave::runTask(
     frameworks[frameworkId] = framework;
   }
 
-  const ExecutorInfo& executorInfo = getExecutorInfo(task);
+  const ExecutorInfo& executorInfo = getExecutorInfo(frameworkId, task);
   const ExecutorID& executorId = executorInfo.executor_id();
 
   // We add the task to 'pending' to ensure the framework is not
@@ -849,7 +851,7 @@ void Slave::_runTask(
   LOG(INFO) << "Launching task " << task.task_id()
             << " for framework " << frameworkId;
 
-  const ExecutorInfo& executorInfo = getExecutorInfo(task);
+  const ExecutorInfo& executorInfo = getExecutorInfo(frameworkId, task);
   const ExecutorID& executorId = executorInfo.executor_id();
 
   // Remove the pending task from framework.
@@ -1915,7 +1917,9 @@ Framework* Slave::getFramework(const FrameworkID& frameworkId)
 }
 
 
-ExecutorInfo Slave::getExecutorInfo(const TaskInfo& task)
+ExecutorInfo Slave::getExecutorInfo(
+    const FrameworkID& frameworkId,
+    const TaskInfo& task)
 {
   CHECK(task.has_executor() != task.has_command());
 
@@ -1925,6 +1929,8 @@ ExecutorInfo Slave::getExecutorInfo(const TaskInfo& task)
     // Command executors share the same id as the task.
     executor.mutable_executor_id()->set_value(task.task_id().value());
 
+    executor.mutable_framework_id()->CopyFrom(frameworkId);
+
     // Prepare an executor name which includes information on the
     // command being launched.
     string name =

http://git-wip-us.apache.org/repos/asf/mesos/blob/2b83a9ae/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 8ba605b..464d224 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -210,7 +210,9 @@ protected:
 
   // Returns an ExecutorInfo for a TaskInfo (possibly
   // constructing one if the task has a CommandInfo).
-  ExecutorInfo getExecutorInfo(const TaskInfo& task);
+  ExecutorInfo getExecutorInfo(
+      const FrameworkID& frameworkId,
+      const TaskInfo& task);
 
   // Handle the second phase of shutting down an executor for those
   // executors that have not properly shutdown within a timeout.


[2/3] git commit: Fixed typos in scheduler.hpp and test_framework.py.

Posted by bm...@apache.org.
Fixed typos in scheduler.hpp and test_framework.py.

From: Yashwanth Nannapaneni <ya...@gmail.com>
Review: https://reviews.apache.org/r/13448


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

Branch: refs/heads/master
Commit: c3c573e7a75e2249d9e995497943fe759bddf675
Parents: 2b83a9a
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Mon Aug 12 11:46:25 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Mon Aug 12 11:46:25 2013 -0700

----------------------------------------------------------------------
 include/mesos/scheduler.hpp           | 2 +-
 src/examples/python/test_framework.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c3c573e7/include/mesos/scheduler.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/scheduler.hpp b/include/mesos/scheduler.hpp
index 1a7fcb9..cf3ecda 100644
--- a/include/mesos/scheduler.hpp
+++ b/include/mesos/scheduler.hpp
@@ -114,7 +114,7 @@ public:
    * whatever reason an offer is never rescinded (e.g., dropped
    * message, failing over framework, etc.), a framwork that attempts
    * to launch tasks using an invalid offer will receive TASK_LOST
-   * status updats for those tasks (see Scheduler::resourceOffers).
+   * status updates for those tasks (see Scheduler::resourceOffers).
    */
   virtual void offerRescinded(SchedulerDriver* driver,
                               const OfferID& offerId) = 0;

http://git-wip-us.apache.org/repos/asf/mesos/blob/c3c573e7/src/examples/python/test_framework.py
----------------------------------------------------------------------
diff --git a/src/examples/python/test_framework.py b/src/examples/python/test_framework.py
index 6372508..39dcb05 100755
--- a/src/examples/python/test_framework.py
+++ b/src/examples/python/test_framework.py
@@ -7,9 +7,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -95,7 +95,7 @@ class TestScheduler(mesos.Scheduler):
           slave_id,
           'data with a \0 byte')
 
-  def frameworkMessage(self, driver, executorId, salveId, message):
+  def frameworkMessage(self, driver, executorId, slaveId, message):
     self.messagesReceived += 1
 
     # The message bounced back as expected.


[3/3] git commit: Updated glog to 0.3.3.

Posted by bm...@apache.org.
Updated glog to 0.3.3.

This fixes a build issue with clang.

From: Vinson Lee <vl...@freedesktop.org>
Review: https://reviews.apache.org/r/13473


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

Branch: refs/heads/master
Commit: e07add053f5f8627d6cd20558594070069f23f6d
Parents: c3c573e
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Mon Aug 12 11:48:28 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Mon Aug 12 12:01:01 2013 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/glog-0.3.1.tar.gz | Bin 1018372 -> 0 bytes
 3rdparty/libprocess/3rdparty/glog-0.3.3.tar.gz | Bin 0 -> 509676 bytes
 3rdparty/libprocess/3rdparty/versions.am       |   2 +-
 src/python/setup.py.in                         |   2 +-
 4 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e07add05/3rdparty/libprocess/3rdparty/glog-0.3.1.tar.gz
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/glog-0.3.1.tar.gz b/3rdparty/libprocess/3rdparty/glog-0.3.1.tar.gz
deleted file mode 100644
index 19b4b94..0000000
Binary files a/3rdparty/libprocess/3rdparty/glog-0.3.1.tar.gz and /dev/null differ

http://git-wip-us.apache.org/repos/asf/mesos/blob/e07add05/3rdparty/libprocess/3rdparty/glog-0.3.3.tar.gz
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/glog-0.3.3.tar.gz b/3rdparty/libprocess/3rdparty/glog-0.3.3.tar.gz
new file mode 100644
index 0000000..92fa52d
Binary files /dev/null and b/3rdparty/libprocess/3rdparty/glog-0.3.3.tar.gz differ

http://git-wip-us.apache.org/repos/asf/mesos/blob/e07add05/3rdparty/libprocess/3rdparty/versions.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/versions.am b/3rdparty/libprocess/3rdparty/versions.am
index 0d05698..7cb4f2f 100644
--- a/3rdparty/libprocess/3rdparty/versions.am
+++ b/3rdparty/libprocess/3rdparty/versions.am
@@ -3,7 +3,7 @@
 # third_party packages in exactly one place.
 
 BOOST_VERSION = 1.53.0
-GLOG_VERSION = 0.3.1
+GLOG_VERSION = 0.3.3
 GMOCK_VERSION = 1.6.0
 GPERFTOOLS_VERSION = 2.0
 LIBEV_VERSION = 4.15

http://git-wip-us.apache.org/repos/asf/mesos/blob/e07add05/src/python/setup.py.in
----------------------------------------------------------------------
diff --git a/src/python/setup.py.in b/src/python/setup.py.in
index cf10704..77fa880 100644
--- a/src/python/setup.py.in
+++ b/src/python/setup.py.in
@@ -29,7 +29,7 @@ libprocess = os.path.join('3rdparty', 'libprocess')
 # libraries when building the final result, we need to explicitly
 # include them here (or more precisely, down where we actually include
 # libev.a and libprofiler.a).
-glog = os.path.join(libprocess, '3rdparty', 'glog-0.3.1')
+glog = os.path.join(libprocess, '3rdparty', 'glog-0.3.3')
 libev = os.path.join(libprocess, '3rdparty', 'libev-4.15')
 gperftools = os.path.join(libprocess, '3rdparty', 'gperftools-2.0')
 protobuf = os.path.join(libprocess, '3rdparty', 'protobuf-2.4.1')