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:29 UTC

[15/16] mesos git commit: Reordered gauge methods in `Slave` class.

Reordered gauge methods in `Slave` class.

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


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

Branch: refs/heads/master
Commit: b415c8cef1f39ae94b2b59c3c74495e7dd141eba
Parents: a1731d4
Author: Jie Yu <yu...@gmail.com>
Authored: Tue May 30 16:36:53 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed May 31 14:51:10 2017 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 240 +++++++++++++++++++++++------------------------
 src/slave/slave.hpp |  24 ++---
 2 files changed, 132 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b415c8ce/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 247c7eb..0c7e5f4 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -6585,126 +6585,6 @@ Future<ResourceUsage> Slave::usage()
 }
 
 
-// TODO(dhamon): Move these to their own metrics.hpp|cpp.
-double Slave::_tasks_staging()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    typedef hashmap<TaskID, TaskInfo> TaskMap;
-    foreachvalue (const TaskMap& tasks, framework->pending) {
-      count += tasks.size();
-    }
-
-    foreachvalue (Executor* executor, framework->executors) {
-      count += executor->queuedTasks.size();
-
-      foreachvalue (Task* task, executor->launchedTasks) {
-        if (task->state() == TASK_STAGING) {
-          count++;
-        }
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_tasks_starting()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      foreachvalue (Task* task, executor->launchedTasks) {
-        if (task->state() == TASK_STARTING) {
-          count++;
-        }
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_tasks_running()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      foreachvalue (Task* task, executor->launchedTasks) {
-        if (task->state() == TASK_RUNNING) {
-          count++;
-        }
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_tasks_killing()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      foreachvalue (Task* task, executor->launchedTasks) {
-        if (task->state() == TASK_KILLING) {
-          count++;
-        }
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_executors_registering()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      if (executor->state == Executor::REGISTERING) {
-        count++;
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_executors_running()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      if (executor->state == Executor::RUNNING) {
-        count++;
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_executors_terminating()
-{
-  double count = 0.0;
-  foreachvalue (Framework* framework, frameworks) {
-    foreachvalue (Executor* executor, framework->executors) {
-      if (executor->state == Executor::TERMINATING) {
-        count++;
-      }
-    }
-  }
-  return count;
-}
-
-
-double Slave::_executor_directory_max_allowed_age_secs()
-{
-  return executorDirectoryMaxAllowedAge.secs();
-}
-
-
 // As a principle, we do not need to re-authorize actions that have already
 // been authorized by the master. However, we re-authorize the RUN_TASK action
 // on the agent even though the master has already authorized it because:
@@ -6880,6 +6760,126 @@ void Slave::sendExecutorTerminatedStatusUpdate(
 }
 
 
+// TODO(dhamon): Move these to their own metrics.hpp|cpp.
+double Slave::_tasks_staging()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    typedef hashmap<TaskID, TaskInfo> TaskMap;
+    foreachvalue (const TaskMap& tasks, framework->pending) {
+      count += tasks.size();
+    }
+
+    foreachvalue (Executor* executor, framework->executors) {
+      count += executor->queuedTasks.size();
+
+      foreachvalue (Task* task, executor->launchedTasks) {
+        if (task->state() == TASK_STAGING) {
+          count++;
+        }
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_tasks_starting()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      foreachvalue (Task* task, executor->launchedTasks) {
+        if (task->state() == TASK_STARTING) {
+          count++;
+        }
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_tasks_running()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      foreachvalue (Task* task, executor->launchedTasks) {
+        if (task->state() == TASK_RUNNING) {
+          count++;
+        }
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_tasks_killing()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      foreachvalue (Task* task, executor->launchedTasks) {
+        if (task->state() == TASK_KILLING) {
+          count++;
+        }
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_executors_registering()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      if (executor->state == Executor::REGISTERING) {
+        count++;
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_executors_running()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      if (executor->state == Executor::RUNNING) {
+        count++;
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_executors_terminating()
+{
+  double count = 0.0;
+  foreachvalue (Framework* framework, frameworks) {
+    foreachvalue (Executor* executor, framework->executors) {
+      if (executor->state == Executor::TERMINATING) {
+        count++;
+      }
+    }
+  }
+  return count;
+}
+
+
+double Slave::_executor_directory_max_allowed_age_secs()
+{
+  return executorDirectoryMaxAllowedAge.secs();
+}
+
+
 double Slave::_resources_total(const string& name)
 {
   double total = 0.0;

http://git-wip-us.apache.org/repos/asf/mesos/blob/b415c8ce/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index d049956..77aff1d 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -508,6 +508,18 @@ private:
       const FrameworkID& frameworkId,
       const ExecutorID& executorId);
 
+  void sendExecutorTerminatedStatusUpdate(
+      const TaskID& taskId,
+      const process::Future<Option<
+          mesos::slave::ContainerTermination>>& termination,
+      const FrameworkID& frameworkId,
+      const Executor* executor);
+
+  // Forwards the current total of oversubscribed resources.
+  void forwardOversubscribed();
+  void _forwardOversubscribed(
+      const process::Future<Resources>& oversubscribable);
+
   // Gauge methods.
   double _frameworks_active()
   {
@@ -543,18 +555,6 @@ private:
   double _resources_revocable_used(const std::string& name);
   double _resources_revocable_percent(const std::string& name);
 
-  void sendExecutorTerminatedStatusUpdate(
-      const TaskID& taskId,
-      const process::Future<Option<
-          mesos::slave::ContainerTermination>>& termination,
-      const FrameworkID& frameworkId,
-      const Executor* executor);
-
-  // Forwards the current total of oversubscribed resources.
-  void forwardOversubscribed();
-  void _forwardOversubscribed(
-      const process::Future<Resources>& oversubscribable);
-
   const Flags flags;
 
   const Http http;