Apache Mesos
sandbox.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 __SLAVE_CONTAINER_LOGGERS_SANDBOX_HPP__
18 #define __SLAVE_CONTAINER_LOGGERS_SANDBOX_HPP__
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include <mesos/mesos.hpp>
25 
28 
29 #include <process/future.hpp>
30 #include <process/owned.hpp>
31 #include <process/subprocess.hpp>
32 
33 #include <stout/try.hpp>
34 #include <stout/nothing.hpp>
35 #include <stout/option.hpp>
36 
37 namespace mesos {
38 namespace internal {
39 namespace slave {
40 
41 // Forward declaration.
42 class SandboxContainerLoggerProcess;
43 
44 
45 // The default container logger.
46 //
47 // Executors and tasks launched through this container logger will have their
48 // stdout and stderr piped to the files "stdout" and "stderr", respectively, in
49 // the sandbox. These logs are accessible via the agent's `/files` endpoint.
51 {
52 public:
54  virtual ~SandboxContainerLogger();
55 
56  // This is a noop. The sandbox container logger has nothing to initialize.
57  virtual Try<Nothing> initialize();
58 
59  // Tells the subprocess to redirect the executor/task's stdout and stderr
60  // to separate "stdout" and "stderr" files in the sandbox.
61  // The `path`, `argv`, and `environment` are not changed.
63  const ExecutorInfo& executorInfo,
64  const std::string& sandboxDirectory,
65  const Option<std::string>& user);
66 
67 protected:
69 };
70 
71 
72 } // namespace slave {
73 } // namespace internal {
74 } // namespace mesos {
75 
76 #endif // __SLAVE_CONTAINER_LOGGERS_SANDBOX_HPP__
virtual process::Future< mesos::slave::ContainerIO > prepare(const ExecutorInfo &executorInfo, const std::string &sandboxDirectory, const Option< std::string > &user)
Called before Mesos creates a container.
Definition: check.hpp:33
process::Owned< SandboxContainerLoggerProcess > process
Definition: sandbox.hpp:68
Result< std::string > user(Option< uid_t > uid=None())
Definition: su.hpp:277
Definition: spec.hpp:30
Definition: attributes.hpp:24
virtual Try< Nothing > initialize()
Initializes this container logger.
A containerizer component used to manage container logs.
Definition: container_logger.hpp:54
Definition: future.hpp:57