Apache Mesos
manager.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 __HOOK_MANAGER_HPP__
18 #define __HOOK_MANAGER_HPP__
19 
20 #include <string>
21 
22 #include <mesos/mesos.hpp>
23 #include <mesos/hook.hpp>
24 
25 #include <process/future.hpp>
26 
27 #include <stout/try.hpp>
28 
29 namespace mesos {
30 namespace internal {
31 
33 {
34 public:
35  static Try<Nothing> initialize(const std::string& hookList);
36 
37  // Exposed just for testing so that we can unload a given
38  // hook and remove it from the list of available hooks.
39  static Try<Nothing> unload(const std::string& hookName);
40 
41  static bool hooksAvailable();
42 
43  static Labels masterLaunchTaskLabelDecorator(
44  const TaskInfo& taskInfo,
45  const FrameworkInfo& frameworkInfo,
46  const SlaveInfo& slaveInfo);
47 
48  static void masterSlaveLostHook(const SlaveInfo& slaveInfo);
49 
50  static Labels slaveRunTaskLabelDecorator(
51  const TaskInfo& taskInfo,
52  const ExecutorInfo& executorInfo,
53  const FrameworkInfo& frameworkInfo,
54  const SlaveInfo& slaveInfo);
55 
56  static Environment slaveExecutorEnvironmentDecorator(
57  ExecutorInfo executorInfo);
58 
61  const Option<TaskInfo>& taskInfo,
62  const ExecutorInfo& executorInfo,
63  const std::string& containerName,
64  const std::string& containerWorkDirectory,
65  const std::string& mappedSandboxDirectory,
66  const Option<std::map<std::string, std::string>>& env);
67 
68  static void slavePostFetchHook(
69  const ContainerID& containerId,
70  const std::string& directory);
71 
72  static void slaveRemoveExecutorHook(
73  const FrameworkInfo& frameworkInfo,
74  const ExecutorInfo& executorInfo);
75 
76  static TaskStatus slaveTaskStatusDecorator(
77  const FrameworkID& frameworkId,
78  TaskStatus status);
79 
81  const SlaveInfo& slaveInfo);
82 
84  const SlaveInfo& slaveInfo);
85 };
86 
87 } // namespace internal {
88 } // namespace mesos {
89 
90 #endif // __HOOK_MANAGER_HPP__
Definition: option.hpp:28
static Attributes slaveAttributesDecorator(const SlaveInfo &slaveInfo)
Definition: check.hpp:33
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: resources.hpp:79
static Try< Nothing > initialize(const std::string &hookList)
static void masterSlaveLostHook(const SlaveInfo &slaveInfo)
static Labels masterLaunchTaskLabelDecorator(const TaskInfo &taskInfo, const FrameworkInfo &frameworkInfo, const SlaveInfo &slaveInfo)
Definition: manager.hpp:32
Definition: spec.hpp:30
static void slavePostFetchHook(const ContainerID &containerId, const std::string &directory)
static process::Future< DockerTaskExecutorPrepareInfo > slavePreLaunchDockerTaskExecutorDecorator(const Option< TaskInfo > &taskInfo, const ExecutorInfo &executorInfo, const std::string &containerName, const std::string &containerWorkDirectory, const std::string &mappedSandboxDirectory, const Option< std::map< std::string, std::string >> &env)
Definition: attributes.hpp:24
static void slaveRemoveExecutorHook(const FrameworkInfo &frameworkInfo, const ExecutorInfo &executorInfo)
static Labels slaveRunTaskLabelDecorator(const TaskInfo &taskInfo, const ExecutorInfo &executorInfo, const FrameworkInfo &frameworkInfo, const SlaveInfo &slaveInfo)
static Resources slaveResourcesDecorator(const SlaveInfo &slaveInfo)
static Try< Nothing > unload(const std::string &hookName)
static Environment slaveExecutorEnvironmentDecorator(ExecutorInfo executorInfo)
static TaskStatus slaveTaskStatusDecorator(const FrameworkID &frameworkId, TaskStatus status)
Definition: future.hpp:58
Definition: attributes.hpp:32