You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/05/31 21:51:27 UTC

[13/16] mesos git commit: Moved Framework::hasTask to the source file.

Moved Framework::hasTask to the source file.

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


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

Branch: refs/heads/master
Commit: fc00c5bb379079dc01f33fe8ed1f7800a9bc0811
Parents: 3f5008a
Author: Jie Yu <yu...@gmail.com>
Authored: Tue May 30 15:55:04 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed May 31 14:51:10 2017 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 20 ++++++++++++++++++++
 src/slave/slave.hpp | 20 +-------------------
 2 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fc00c5bb/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 014044d..0c62622 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7307,6 +7307,26 @@ void Framework::recoverExecutor(
 }
 
 
+bool Framework::hasTask(const TaskID& taskId)
+{
+  foreachkey (const ExecutorID& executorId, pending) {
+    if (pending[executorId].contains(taskId)) {
+      return true;
+    }
+  }
+
+  foreachvalue (Executor* executor, executors) {
+    if (executor->queuedTasks.contains(taskId) ||
+        executor->launchedTasks.contains(taskId) ||
+        executor->terminatedTasks.contains(taskId)) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+
 Executor::Executor(
     Slave* _slave,
     const FrameworkID& _frameworkId,

http://git-wip-us.apache.org/repos/asf/mesos/blob/fc00c5bb/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index da25c73..4054ab3 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -865,6 +865,7 @@ public:
       const hashset<TaskID>& tasksToRecheckpoint);
 
   void checkpointFramework() const;
+  bool hasTask(const TaskID& taskId);
 
   bool removePendingTask(
       const TaskInfo& task,
@@ -909,25 +910,6 @@ public:
 
   boost::circular_buffer<process::Owned<Executor>> completedExecutors;
 
-  bool hasTask(const TaskID& taskId)
-  {
-    foreachkey (const ExecutorID& executorId, pending) {
-      if (pending[executorId].contains(taskId)) {
-        return true;
-      }
-    }
-
-    foreachvalue (Executor* executor, executors) {
-      if (executor->queuedTasks.contains(taskId) ||
-          executor->launchedTasks.contains(taskId) ||
-          executor->terminatedTasks.contains(taskId)) {
-        return true;
-      }
-    }
-
-    return false;
-  }
-
 private:
   Framework(const Framework&) = delete;
   Framework& operator=(const Framework&) = delete;