Apache Mesos
linux_launcher.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __LINUX_LAUNCHER_HPP__
18 #define __LINUX_LAUNCHER_HPP__
19 
20 #include <process/owned.hpp>
21 
23 
24 namespace mesos {
25 namespace internal {
26 namespace slave {
27 
28 class LinuxLauncherProcess;
29 
30 // Launcher for Linux systems with cgroups. Uses a freezer cgroup to
31 // track pids.
32 class LinuxLauncher : public Launcher
33 {
34 public:
35  static Try<Launcher*> create(const Flags& flags);
36 
37  // Returns 'true' if prerequisites for using LinuxLauncher are available.
38  static bool available();
39 
40  // Helper for determining the cgroup for a container (i.e., the path
41  // in a cgroup subsystem).
42  static std::string cgroup(
43  const std::string& cgroupsRoot,
44  const ContainerID& containerId);
45 
46  virtual ~LinuxLauncher();
47 
49  const std::list<mesos::slave::ContainerState>& states);
50 
51  virtual Try<pid_t> fork(
52  const ContainerID& containerId,
53  const std::string& path,
54  const std::vector<std::string>& argv,
55  const process::Subprocess::IO& in,
56  const process::Subprocess::IO& out,
57  const process::Subprocess::IO& err,
58  const flags::FlagsBase* flags,
59  const Option<std::map<std::string, std::string>>& environment,
60  const Option<int>& enterNamespaces,
61  const Option<int>& cloneNamespaces);
62 
63  virtual process::Future<Nothing> destroy(const ContainerID& containerId);
64 
66  const ContainerID& containerId);
67 
68 private:
70  const Flags& flags,
71  const std::string& freezerHierarchy,
72  const Option<std::string>& systemdHierarchy);
73 
75 };
76 
77 } // namespace slave {
78 } // namespace internal {
79 } // namespace mesos {
80 
81 #endif // __LINUX_LAUNCHER_HPP__
Definition: launcher.hpp:46
Definition: option.hpp:28
Definition: try.hpp:34
virtual process::Future< hashset< ContainerID > > recover(const std::list< mesos::slave::ContainerState > &states)
virtual process::Future< ContainerStatus > status(const ContainerID &containerId)
static std::string cgroup(const std::string &cgroupsRoot, const ContainerID &containerId)
Definition: flags.hpp:39
virtual Try< pid_t > fork(const ContainerID &containerId, const std::string &path, const std::vector< std::string > &argv, const process::Subprocess::IO &in, const process::Subprocess::IO &out, const process::Subprocess::IO &err, const flags::FlagsBase *flags, const Option< std::map< std::string, std::string >> &environment, const Option< int > &enterNamespaces, const Option< int > &cloneNamespaces)
Environment * environment
Definition: linux_launcher.hpp:32
Describes how the I/O is redirected for stdin/stdout/stderr.
Definition: subprocess.hpp:61
Definition: flags.hpp:44
static Try< Launcher * > create(const Flags &flags)
#define flags
Definition: decoder.hpp:18
virtual process::Future< Nothing > destroy(const ContainerID &containerId)
Definition: future.hpp:57