Apache Mesos
constants.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_CONSTANTS_HPP__
18 #define __SLAVE_CONSTANTS_HPP__
19 
20 #include <stdint.h>
21 #include <vector>
22 
23 #include <mesos/mesos.hpp>
24 
25 #include <stout/bytes.hpp>
26 #include <stout/duration.hpp>
27 
28 namespace mesos {
29 namespace internal {
30 namespace slave {
31 
32 // TODO(jieyu): Use static functions for all the constants. See more
33 // details in MESOS-1023.
34 
37 
38 // The maximum timeout within which an executor can reregister.
39 // Note that this value has to be << 'MIN_AGENT_REREGISTER_TIMEOUT'
40 // declared in 'master/constants.hpp'; since agent recovery will only
41 // complete after this timeout has elapsed, this ensures that the
42 // agent can reregister with the master before it is marked
43 // unreachable and its tasks are transitioned to TASK_UNREACHABLE or
44 // TASK_LOST.
46 
47 // The default amount of time to wait for the executor to
48 // shut down before destroying the container.
50 
51 // The default amount of time between heartbeats sent to HTTP executors.
53 
55 
56 // TODO(gkleiman): Move this to a different file once `TaskStatusUpdateManager`
57 // uses `StatusUpdateManagerProcess`. See MESOS-8296.
60 
61 // Default backoff interval used by the slave to wait before registration.
63 
64 // The maximum interval the slave waits before retrying registration.
65 // Note that this value has to be << 'MIN_SLAVE_REREGISTER_TIMEOUT'
66 // declared in 'master/constants.hpp'. This helps the slave to retry
67 // (re-)registration multiple times between when the master finishes
68 // recovery and when it times out slave re-registration.
70 
71 // Default value for `--authentication_backoff_factor`. The backoff interval
72 // factor affects the agent timeout interval after failed authentications.
74 
75 // Default value for `--authentication_timeout_min`. The minimum timeout
76 // interval the agent waits before retrying authentication.
78 
79 // Default value for `--authentication_timeout_max`. The maximum timeout
80 // interval the agent waits before retrying authentication.
82 
83 constexpr Duration GC_DELAY = Weeks(1);
85 
86 // Minimum free disk capacity enforced by the garbage collector.
87 constexpr double GC_DISK_HEADROOM = 0.1;
88 
89 // Maximum number of completed frameworks to store in memory.
90 constexpr size_t MAX_COMPLETED_FRAMEWORKS = 50;
91 
92 // Default maximum number of completed executors per framework
93 // to store in memory.
95 
96 // Maximum number of a container id length, according to the
97 // max entry length for directory names on AUFS.
98 constexpr size_t MAX_CONTAINER_ID_LENGTH = 242;
99 
100 // Maximum number of completed tasks per executor to store in memory.
101 //
102 // NOTE: This should be greater than zero because the agent looks
103 // for completed tasks to determine (with false positives) whether
104 // an executor ever received tasks. See MESOS-8411.
105 //
106 // TODO(mzhu): Remove this note once we can determine whether an
107 // executor ever received tasks without looking through the
108 // completed tasks.
109 constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
110 
111 // Default cpus offered by the slave.
112 constexpr double DEFAULT_CPUS = 1;
113 
114 // Default memory offered by the slave.
115 constexpr Bytes DEFAULT_MEM = Gigabytes(1);
116 
117 // Default disk space offered by the slave.
118 constexpr Bytes DEFAULT_DISK = Gigabytes(10);
119 
120 // Default ports range offered by the slave.
121 constexpr char DEFAULT_PORTS[] = "[31000-32000]";
122 
123 // Default cpu resource given to a command executor.
124 constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
125 
126 // Default memory resource given to a command executor.
128 
129 #ifdef ENABLE_PORT_MAPPING_ISOLATOR
130 // Default number of ephemeral ports allocated to a container by the
131 // network isolator.
132 constexpr uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
133 #endif
134 
135 // Default UNIX socket (Linux) or Named Pipe (Windows) resource that provides
136 // CLI access to the Docker daemon.
137 #ifdef __WINDOWS__
138 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "//./pipe/docker_engine";
139 #else
140 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "/var/run/docker.sock";
141 #endif // __WINDOWS__
142 
143 // Default filename used for domain socket-based communication between
144 // agent and executors, if that is enabled.
145 constexpr char AGENT_EXECUTORS_SOCKET_FILENAME[] = "agent.sock";
146 
147 // Default duration that docker containers will be removed after exit.
149 
150 // Default duration to wait before retry inspecting a docker
151 // container.
153 
154 // Default duration to wait for `inspect` command completion.
156 
157 // Default maximum number of docker inspect calls docker ps will invoke
158 // in parallel to prevent hitting system's open file descriptor limit.
159 constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS = 100;
160 
161 // Default duration that docker containerizer will wait to check
162 // docker version.
163 // TODO(tnachen): Make this a flag.
165 
166 // Additional duration that docker containerizer will wait beyond the
167 // configured `docker_stop_timeout` for docker stop to succeed, before
168 // trying to kill the process by itself.
170 
171 // Name of the default, CRAM-MD5 authenticatee.
172 constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
173 
174 // Name of the default, local authorizer.
175 constexpr char DEFAULT_AUTHORIZER[] = "local";
176 
177 // Name of the agent HTTP authentication realm for read-only endpoints.
178 constexpr char READONLY_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readonly";
179 
180 // Name of the agent HTTP authentication realm for read-write endpoints.
181 constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readwrite";
182 
183 // Name of the agent HTTP authentication realm for HTTP executors.
184 constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-executor";
185 
186 // Name of the agent HTTP authentication realm for HTTP resource providers.
188  "mesos-agent-resource-provider";
189 
190 // Default maximum storage space to be used by the fetcher cache.
192 
193 // Default timeout for the fetcher to wait when a net download stalls.
195 
196 // If no pings received within this timeout, then the slave will
197 // trigger a re-detection of the master to cause a re-registration.
199 
200 // Name of the executable for default executor.
201 #ifdef __WINDOWS__
202 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor.exe";
203 constexpr char MESOS_EXECUTOR[] = "mesos-executor.exe";
204 #else
205 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";
206 constexpr char MESOS_EXECUTOR[] = "mesos-executor";
207 #endif // __WINDOWS__
208 
209 // Name of the component used for describing pending futures.
210 constexpr char COMPONENT_NAME_CONTAINERIZER[] = "containerizer";
211 
212 
213 // Virtual path on which agent logs are mounted in `/files/` endpoint.
214 constexpr char AGENT_LOG_VIRTUAL_PATH[] = "/slave/log";
215 
216 std::vector<SlaveInfo::Capability> AGENT_CAPABILITIES();
217 
218 } // namespace slave {
219 } // namespace internal {
220 } // namespace mesos {
221 
222 #endif // __SLAVE_CONSTANTS_HPP__
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MAX
Definition: constants.hpp:59
constexpr char AGENT_EXECUTORS_SOCKET_FILENAME[]
Definition: constants.hpp:145
constexpr Duration DOCKER_FORCE_KILL_TIMEOUT
Definition: constants.hpp:169
constexpr double DEFAULT_EXECUTOR_CPUS
Definition: constants.hpp:124
constexpr char COMPONENT_NAME_CONTAINERIZER[]
Definition: constants.hpp:210
constexpr Duration RECOVERY_TIMEOUT
Definition: constants.hpp:54
constexpr char DEFAULT_DOCKER_HOST_RESOURCE[]
Definition: constants.hpp:140
constexpr Duration DEFAULT_FETCHER_STALL_TIMEOUT
Definition: constants.hpp:194
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DOCKER_REMOVE_DELAY
Definition: constants.hpp:148
constexpr size_t MAX_COMPLETED_FRAMEWORKS
Definition: constants.hpp:90
constexpr Duration DEFAULT_AUTHENTICATION_BACKOFF_FACTOR
Definition: constants.hpp:73
constexpr Duration DEFAULT_EXECUTOR_HEARTBEAT_INTERVAL
Definition: constants.hpp:52
constexpr size_t MAX_CONTAINER_ID_LENGTH
Definition: constants.hpp:98
constexpr char DEFAULT_PORTS[]
Definition: constants.hpp:121
constexpr Bytes DEFAULT_MEM
Definition: constants.hpp:115
Definition: duration.hpp:32
constexpr Duration MAX_EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:45
constexpr char MESOS_DEFAULT_EXECUTOR[]
Definition: constants.hpp:205
constexpr Bytes DEFAULT_DISK
Definition: constants.hpp:118
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MIN
Definition: constants.hpp:58
constexpr Duration DEFAULT_EXECUTOR_SHUTDOWN_GRACE_PERIOD
Definition: constants.hpp:49
constexpr Duration DOCKER_INSPECT_TIMEOUT
Definition: constants.hpp:155
constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR
Definition: constants.hpp:62
Definition: duration.hpp:221
constexpr size_t DEFAULT_MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK
Definition: constants.hpp:94
Definition: duration.hpp:207
constexpr Duration GC_DELAY
Definition: constants.hpp:83
Definition: agent.hpp:25
constexpr double DEFAULT_CPUS
Definition: constants.hpp:112
constexpr Duration DEFAULT_AUTHENTICATION_TIMEOUT_MIN
Definition: constants.hpp:77
constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE
Definition: constants.hpp:191
constexpr double GC_DISK_HEADROOM
Definition: constants.hpp:87
Definition: duration.hpp:235
std::vector< SlaveInfo::Capability > AGENT_CAPABILITIES()
constexpr char DEFAULT_AUTHENTICATEE[]
Definition: constants.hpp:172
constexpr char MESOS_EXECUTOR[]
Definition: constants.hpp:206
constexpr Duration EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:36
Definition: attributes.hpp:24
constexpr Duration DEFAULT_AUTHENTICATION_TIMEOUT_MAX
Definition: constants.hpp:81
constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS
Definition: constants.hpp:159
constexpr char AGENT_LOG_VIRTUAL_PATH[]
Definition: constants.hpp:214
constexpr Bytes Gigabytes(uint64_t value)
Definition: bytes.hpp:129
constexpr Duration REGISTER_RETRY_INTERVAL_MAX
Definition: constants.hpp:69
constexpr Duration DISK_WATCH_INTERVAL
Definition: constants.hpp:84
constexpr char RESOURCE_PROVIDER_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:187
constexpr Bytes DEFAULT_EXECUTOR_MEM
Definition: constants.hpp:127
constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:184
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:175
Definition: bytes.hpp:30
constexpr Duration EXECUTOR_REGISTRATION_TIMEOUT
Definition: constants.hpp:35
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:181
constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR
Definition: constants.hpp:109
Definition: duration.hpp:263
constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT
Definition: constants.hpp:164
constexpr Duration DOCKER_INSPECT_DELAY
Definition: constants.hpp:152
Duration DEFAULT_MASTER_PING_TIMEOUT()
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:178