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 
52 
53 // TODO(gkleiman): Move this to a different file once `TaskStatusUpdateManager`
54 // uses `StatusUpdateManagerProcess`. See MESOS-8296.
57 
58 // Default backoff interval used by the slave to wait before registration.
60 
61 // The maximum interval the slave waits before retrying registration.
62 // Note that this value has to be << 'MIN_SLAVE_REREGISTER_TIMEOUT'
63 // declared in 'master/constants.hpp'. This helps the slave to retry
64 // (re-)registration multiple times between when the master finishes
65 // recovery and when it times out slave re-registration.
67 
68 // The maximum interval the slave waits before retrying authentication.
70 
71 // Default backoff interval used by the slave to wait after failed
72 // authentication.
74 
75 constexpr Duration GC_DELAY = Weeks(1);
77 
78 // Minimum free disk capacity enforced by the garbage collector.
79 constexpr double GC_DISK_HEADROOM = 0.1;
80 
81 // Maximum number of completed frameworks to store in memory.
82 constexpr size_t MAX_COMPLETED_FRAMEWORKS = 50;
83 
84 // Default maximum number of completed executors per framework
85 // to store in memory.
87 
88 // Maximum number of completed tasks per executor to store in memory.
89 //
90 // NOTE: This should be greater than zero because the agent looks
91 // for completed tasks to determine (with false positives) whether
92 // an executor ever received tasks. See MESOS-8411.
93 //
94 // TODO(mzhu): Remove this note once we can determine whether an
95 // executor ever received tasks without looking through the
96 // completed tasks.
97 constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
98 
99 // Default cpus offered by the slave.
100 constexpr double DEFAULT_CPUS = 1;
101 
102 // Default memory offered by the slave.
103 constexpr Bytes DEFAULT_MEM = Gigabytes(1);
104 
105 // Default disk space offered by the slave.
106 constexpr Bytes DEFAULT_DISK = Gigabytes(10);
107 
108 // Default ports range offered by the slave.
109 constexpr char DEFAULT_PORTS[] = "[31000-32000]";
110 
111 // Default cpu resource given to a command executor.
112 constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
113 
114 // Default memory resource given to a command executor.
116 
117 #ifdef ENABLE_PORT_MAPPING_ISOLATOR
118 // Default number of ephemeral ports allocated to a container by the
119 // network isolator.
120 constexpr uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
121 #endif
122 
123 // Default UNIX socket (Linux) or Named Pipe (Windows) resource that provides
124 // CLI access to the Docker daemon.
125 #ifdef __WINDOWS__
126 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "//./pipe/docker_engine";
127 #else
128 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "/var/run/docker.sock";
129 #endif // __WINDOWS__
130 
131 // Default duration that docker containers will be removed after exit.
133 
134 // Default duration to wait before retry inspecting a docker
135 // container.
137 
138 // Default duration to wait for `inspect` command completion.
140 
141 // Default maximum number of docker inspect calls docker ps will invoke
142 // in parallel to prevent hitting system's open file descriptor limit.
143 constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS = 100;
144 
145 // Default duration that docker containerizer will wait to check
146 // docker version.
147 // TODO(tnachen): Make this a flag.
149 
150 // Additional duration that docker containerizer will wait beyond the
151 // configured `docker_stop_timeout` for docker stop to succeed, before
152 // trying to kill the process by itself.
154 
155 // Name of the default, CRAM-MD5 authenticatee.
156 constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
157 
158 // Name of the default, local authorizer.
159 constexpr char DEFAULT_AUTHORIZER[] = "local";
160 
161 // Name of the agent HTTP authentication realm for read-only endpoints.
162 constexpr char READONLY_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readonly";
163 
164 // Name of the agent HTTP authentication realm for read-write endpoints.
165 constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readwrite";
166 
167 // Name of the agent HTTP authentication realm for HTTP executors.
168 constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-executor";
169 
170 // Default maximum storage space to be used by the fetcher cache.
172 
173 // Default timeout for the fetcher to wait when a net download stalls.
175 
176 // If no pings received within this timeout, then the slave will
177 // trigger a re-detection of the master to cause a re-registration.
179 
180 // Name of the executable for default executor.
181 #ifdef __WINDOWS__
182 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor.exe";
183 #else
184 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";
185 #endif // __WINDOWS__
186 
187 // Virtual path on which agent logs are mounted in `/files/` endpoint.
188 constexpr char AGENT_LOG_VIRTUAL_PATH[] = "/slave/log";
189 
190 std::vector<SlaveInfo::Capability> AGENT_CAPABILITIES();
191 
192 } // namespace slave {
193 } // namespace internal {
194 } // namespace mesos {
195 
196 #endif // __SLAVE_CONSTANTS_HPP__
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MAX
Definition: constants.hpp:56
constexpr Duration DOCKER_FORCE_KILL_TIMEOUT
Definition: constants.hpp:153
constexpr double DEFAULT_EXECUTOR_CPUS
Definition: constants.hpp:112
constexpr Duration RECOVERY_TIMEOUT
Definition: constants.hpp:51
constexpr char DEFAULT_DOCKER_HOST_RESOURCE[]
Definition: constants.hpp:128
constexpr Duration AUTHENTICATION_RETRY_INTERVAL_MAX
Definition: constants.hpp:69
constexpr Duration DEFAULT_FETCHER_STALL_TIMEOUT
Definition: constants.hpp:174
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DOCKER_REMOVE_DELAY
Definition: constants.hpp:132
constexpr size_t MAX_COMPLETED_FRAMEWORKS
Definition: constants.hpp:82
constexpr Duration DEFAULT_AUTHENTICATION_BACKOFF_FACTOR
Definition: constants.hpp:73
constexpr char DEFAULT_PORTS[]
Definition: constants.hpp:109
constexpr Bytes DEFAULT_MEM
Definition: constants.hpp:103
Definition: duration.hpp:32
constexpr Duration MAX_EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:45
constexpr char MESOS_DEFAULT_EXECUTOR[]
Definition: constants.hpp:184
constexpr Bytes DEFAULT_DISK
Definition: constants.hpp:106
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MIN
Definition: constants.hpp:55
constexpr Duration DEFAULT_EXECUTOR_SHUTDOWN_GRACE_PERIOD
Definition: constants.hpp:49
constexpr Duration DOCKER_INSPECT_TIMEOUT
Definition: constants.hpp:139
constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR
Definition: constants.hpp:59
Definition: duration.hpp:221
constexpr size_t DEFAULT_MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK
Definition: constants.hpp:86
Definition: duration.hpp:207
constexpr Duration GC_DELAY
Definition: constants.hpp:75
Definition: spec.hpp:30
constexpr double DEFAULT_CPUS
Definition: constants.hpp:100
constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE
Definition: constants.hpp:171
constexpr double GC_DISK_HEADROOM
Definition: constants.hpp:79
Definition: duration.hpp:235
std::vector< SlaveInfo::Capability > AGENT_CAPABILITIES()
constexpr char DEFAULT_AUTHENTICATEE[]
Definition: constants.hpp:156
constexpr Duration EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:36
Definition: attributes.hpp:24
constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS
Definition: constants.hpp:143
constexpr char AGENT_LOG_VIRTUAL_PATH[]
Definition: constants.hpp:188
constexpr Bytes Gigabytes(uint64_t value)
Definition: bytes.hpp:129
constexpr Duration REGISTER_RETRY_INTERVAL_MAX
Definition: constants.hpp:66
constexpr Duration DISK_WATCH_INTERVAL
Definition: constants.hpp:76
constexpr Bytes DEFAULT_EXECUTOR_MEM
Definition: constants.hpp:115
constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:168
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:159
Definition: bytes.hpp:30
constexpr Duration EXECUTOR_REGISTRATION_TIMEOUT
Definition: constants.hpp:35
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:165
constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR
Definition: constants.hpp:97
Definition: duration.hpp:263
constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT
Definition: constants.hpp:148
constexpr Duration DOCKER_INSPECT_DELAY
Definition: constants.hpp:136
Duration DEFAULT_MASTER_PING_TIMEOUT()
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:162