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 
49  const TaskInfo& taskInfo,
50  const Resources& slaveResources);
51 
52  static void masterSlaveLostHook(const SlaveInfo& slaveInfo);
53 
54  static Labels slaveRunTaskLabelDecorator(
55  const TaskInfo& taskInfo,
56  const ExecutorInfo& executorInfo,
57  const FrameworkInfo& frameworkInfo,
58  const SlaveInfo& slaveInfo);
59 
60  static Environment slaveExecutorEnvironmentDecorator(
61  ExecutorInfo executorInfo);
62 
65  const Option<TaskInfo>& taskInfo,
66  const ExecutorInfo& executorInfo,
67  const std::string& containerName,
68  const std::string& containerWorkDirectory,
69  const std::string& mappedSandboxDirectory,
70  const Option<std::map<std::string, std::string>>& env);
71 
72  static void slavePostFetchHook(
73  const ContainerID& containerId,
74  const std::string& directory);
75 
76  static void slaveRemoveExecutorHook(
77  const FrameworkInfo& frameworkInfo,
78  const ExecutorInfo& executorInfo);
79 
80  static TaskStatus slaveTaskStatusDecorator(
81  const FrameworkID& frameworkId,
82  TaskStatus status);
83 
85  const SlaveInfo& slaveInfo);
86 
88  const SlaveInfo& slaveInfo);
89 };
90 
91 } // namespace internal {
92 } // namespace mesos {
93 
94 #endif // __HOOK_MANAGER_HPP__
Definition: option.hpp:29
static Attributes slaveAttributesDecorator(const SlaveInfo &slaveInfo)
Definition: check.hpp:33
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: resources.hpp:83
static Try< Nothing > initialize(const std::string &hookList)
static Resources masterLaunchTaskResourceDecorator(const TaskInfo &taskInfo, const Resources &slaveResources)
static void masterSlaveLostHook(const SlaveInfo &slaveInfo)
static Labels masterLaunchTaskLabelDecorator(const TaskInfo &taskInfo, const FrameworkInfo &frameworkInfo, const SlaveInfo &slaveInfo)
Definition: manager.hpp:32
Definition: agent.hpp:25
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