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 2016/02/09 19:12:50 UTC

[2/3] mesos git commit: Defined a virtual `status` method for Containerizer.

Defined a virtual `status` method for Containerizer.

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


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

Branch: refs/heads/master
Commit: 360142c3a0acb0a6f73841f9148b798a5ec950ac
Parents: 0649443
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Tue Feb 9 07:23:13 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Feb 9 07:24:24 2016 -0800

----------------------------------------------------------------------
 src/slave/containerizer/containerizer.hpp | 52 ++++++++++++++++----------
 1 file changed, 33 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/360142c3/src/slave/containerizer/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.hpp b/src/slave/containerizer/containerizer.hpp
index 08d1ed3..ff78b4d 100644
--- a/src/slave/containerizer/containerizer.hpp
+++ b/src/slave/containerizer/containerizer.hpp
@@ -48,29 +48,32 @@ namespace state {
 struct SlaveState;
 } // namespace state {
 
-// An abstraction of a Containerizer that will contain an executor and its
-// tasks.
+
+// An abstraction of a Containerizer that will contain an executor and
+// its tasks.
 class Containerizer
 {
 public:
-  // Attempts to create a containerizer as specified by 'isolation' in flags.
+  // Attempts to create a containerizer as specified by 'isolation' in
+  // flags.
   static Try<Containerizer*> create(
       const Flags& flags,
       bool local,
       Fetcher* fetcher);
 
-  // Determine slave resources from flags, probing the system or querying a
-  // delegate.
-  // TODO(idownes): Consider making this non-static and moving to containerizer
-  // implementations to enable a containerizer to best determine the resources,
-  // particularly if containerizeration is delegated.
+  // Determine slave resources from flags, probing the system or
+  // querying a delegate.
+  // TODO(idownes): Consider making this non-static and moving to
+  // containerizer implementations to enable a containerizer to best
+  // determine the resources, particularly if containerizeration is
+  // delegated.
   static Try<Resources> resources(const Flags& flags);
 
   virtual ~Containerizer() {}
 
-  // Recover all containerized executors specified in state. Any containerized
-  // executors present on the system but not included in state (or state is
-  // None) will be terminated and cleaned up.
+  // Recover all containerized executors specified in state. Any
+  // containerized executors present on the system but not included in
+  // state (or state is None) will be terminated and cleaned up.
   virtual process::Future<Nothing> recover(
       const Option<state::SlaveState>& state) = 0;
 
@@ -110,17 +113,28 @@ public:
   virtual process::Future<ResourceStatistics> usage(
       const ContainerID& containerId) = 0;
 
-  // Wait on the container's 'Termination'. If the executor terminates, the
-  // containerizer should also destroy the containerized context. The future
-  // may be failed if an error occurs during termination of the executor or
-  // destruction of the container.
+  // Retrieve the run-time state of various isolator properties
+  // associated with the container. Unlike other methods in this class
+  // we are not making this pure virtual, since a `Containerizer`
+  // doesn't necessarily need to return the status of a container.
+  virtual process::Future<ContainerStatus> status(
+      const ContainerID &containerId)
+  {
+    return ContainerStatus();
+  }
+
+  // Wait on the container's 'Termination'. If the executor
+  // terminates, the containerizer should also destroy the
+  // containerized context. The future may be failed if an error
+  // occurs during termination of the executor or destruction of the
+  // container.
   virtual process::Future<containerizer::Termination> wait(
       const ContainerID& containerId) = 0;
 
-  // Destroy a running container, killing all processes and releasing all
-  // resources.
-  // NOTE: You cannot wait() on containers that have been destroyed, so you
-  // should always call wait() before destroy().
+  // Destroy a running container, killing all processes and releasing
+  // all resources.
+  // NOTE: You cannot wait() on containers that have been destroyed,
+  // so you should always call wait() before destroy().
   virtual void destroy(const ContainerID& containerId) = 0;
 
   virtual process::Future<hashset<ContainerID>> containers() = 0;