Combined containerizer interface's launch methods. When nested container support was added, we added a separate `launch` path in the containerizer because nested containers do not need an explicit TaskInfo/ExecutorInfo. Nested containers basically only need the CommandInfo and ContainerInfo.
This commit combines the two launch methods by replacing most of the "Infos" (Task, Executor, Command, Container) with a `ContainerConfig` argument, which may contain multiple combinations of the "Infos". The goal is to support three launch paths for containers: 1) When the `ContainerConfig` contains a TaskInfo/ExecutorInfo, launch a task or executor. 2) When the `ContainerID` has a parent, launch a nested container. 3) (Not implemented yet) When there is no TaskInfo/ExecutorInfo or parent container, launch a standalone container. There are two other notable changes to the interface: * The `SlaveID` field has been removed entirely. The code that requires this (in the fetcher and Docker containerizer) will be addressed in a separate commit. * The `checkpoint` bool has been replaced by an Option<string>, which contains the path that should be used for checkpointing. This path includes the filename. This is also one of the reasons why `SlaveID` was an argument. Review: https://reviews.apache.org/r/58899 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0709ce3c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0709ce3c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0709ce3c Branch: refs/heads/master Commit: 0709ce3c7a3c09948e23761281ad9c5059484916 Parents: 7a8f864 Author: Joseph Wu <josep...@apache.org> Authored: Mon Apr 10 14:06:33 2017 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Thu May 25 18:37:06 2017 -0700 ---------------------------------------------------------------------- src/slave/containerizer/containerizer.hpp | 36 ++++++++------------------ 1 file changed, 11 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/0709ce3c/src/slave/containerizer/containerizer.hpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/containerizer.hpp b/src/slave/containerizer/containerizer.hpp index f17e424..0954ed6 100644 --- a/src/slave/containerizer/containerizer.hpp +++ b/src/slave/containerizer/containerizer.hpp @@ -81,34 +81,20 @@ public: virtual process::Future<Nothing> recover( const Option<state::SlaveState>& state) = 0; - // Launch a containerized task/executor. Returns true if launching - // this TaskInfo/ExecutorInfo is supported and it has been launched, - // otherwise false or a failure if something went wrong. - virtual process::Future<bool> launch( - const ContainerID& containerId, - const Option<TaskInfo>& taskInfo, - const ExecutorInfo& executorInfo, - const std::string& directory, - const Option<std::string>& user, - const SlaveID& slaveId, - const std::map<std::string, std::string>& environment, - bool checkpoint) = 0; - - // Launch a nested container. - // TODO(jieyu): Consider combining with the 'launch' above. + // Launch a container with the specified ContainerConfig. + // + // If the ContainerID has a parent, this will attempt to launch + // a nested container. + // NOTE: For nested containers, the required `directory` field of + // the ContainerConfig will be determined by the containerizer. // - // TODO(gilbert): Remove the 'slaveId' once the fetcher does - // not rely on SlaveID. + // Returns true if launching this container is supported and it has + // been launched, otherwise false or a failure if something went wrong. virtual process::Future<bool> launch( const ContainerID& containerId, - const CommandInfo& commandInfo, - const Option<ContainerInfo>& containerInfo, - const Option<std::string>& user, - const SlaveID& slaveId, - const Option<mesos::slave::ContainerClass>& containerClass = None()) - { - return process::Failure("Unsupported"); - } + const mesos::slave::ContainerConfig& containerConfig, + const std::map<std::string, std::string>& environment, + const Option<std::string>& pidCheckpointPath) = 0; // Create an HTTP connection that can be used to "attach" (i.e., // stream input to or stream output from) a container.