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 re-register.
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 re-register 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 constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
90 
91 // Default cpus offered by the slave.
92 constexpr double DEFAULT_CPUS = 1;
93 
94 // Default memory offered by the slave.
95 constexpr Bytes DEFAULT_MEM = Gigabytes(1);
96 
97 // Default disk space offered by the slave.
98 constexpr Bytes DEFAULT_DISK = Gigabytes(10);
99 
100 // Default ports range offered by the slave.
101 constexpr char DEFAULT_PORTS[] = "[31000-32000]";
102 
103 // Default cpu resource given to a command executor.
104 constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
105 
106 // Default memory resource given to a command executor.
108 
109 #ifdef ENABLE_PORT_MAPPING_ISOLATOR
110 // Default number of ephemeral ports allocated to a container by the
111 // network isolator.
112 constexpr uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
113 #endif
114 
115 // Default UNIX socket (Linux) or Named Pipe (Windows) resource that provides
116 // CLI access to the Docker daemon.
117 #ifdef __WINDOWS__
118 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "//./pipe/docker_engine";
119 #else
120 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "/var/run/docker.sock";
121 #endif // __WINDOWS__
122 
123 // Default duration that docker containers will be removed after exit.
125 
126 // Default duration to wait before retry inspecting a docker
127 // container.
129 
130 // Default maximum number of docker inspect calls docker ps will invoke
131 // in parallel to prevent hitting system's open file descriptor limit.
132 constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS = 100;
133 
134 // Default duration that docker containerizer will wait to check
135 // docker version.
136 // TODO(tnachen): Make this a flag.
138 
139 // Additional duration that docker containerizer will wait beyond the
140 // configured `docker_stop_timeout` for docker stop to succeed, before
141 // trying to kill the process by itself.
143 
144 // Name of the default, CRAM-MD5 authenticatee.
145 constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
146 
147 // Name of the default, local authorizer.
148 constexpr char DEFAULT_AUTHORIZER[] = "local";
149 
150 // Name of the agent HTTP authentication realm for read-only endpoints.
151 constexpr char READONLY_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readonly";
152 
153 // Name of the agent HTTP authentication realm for read-write endpoints.
154 constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readwrite";
155 
156 // Name of the agent HTTP authentication realm for HTTP executors.
157 constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-executor";
158 
159 // Default maximum storage space to be used by the fetcher cache.
161 
162 // If no pings received within this timeout, then the slave will
163 // trigger a re-detection of the master to cause a re-registration.
165 
166 // Name of the executable for default executor.
167 #ifdef __WINDOWS__
168 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor.exe";
169 #else
170 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";
171 #endif // __WINDOWS__
172 
173 // Virtual path on which agent logs are mounted in `/files/` endpoint.
174 constexpr char AGENT_LOG_VIRTUAL_PATH[] = "/slave/log";
175 
176 std::vector<SlaveInfo::Capability> AGENT_CAPABILITIES();
177 
178 } // namespace slave {
179 } // namespace internal {
180 } // namespace mesos {
181 
182 #endif // __SLAVE_CONSTANTS_HPP__
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MAX
Definition: constants.hpp:56
constexpr Duration DOCKER_FORCE_KILL_TIMEOUT
Definition: constants.hpp:142
constexpr double DEFAULT_EXECUTOR_CPUS
Definition: constants.hpp:104
constexpr Duration RECOVERY_TIMEOUT
Definition: constants.hpp:51
constexpr char DEFAULT_DOCKER_HOST_RESOURCE[]
Definition: constants.hpp:120
constexpr Duration AUTHENTICATION_RETRY_INTERVAL_MAX
Definition: constants.hpp:69
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DOCKER_REMOVE_DELAY
Definition: constants.hpp:124
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:101
constexpr Bytes DEFAULT_MEM
Definition: constants.hpp:95
Definition: duration.hpp:32
constexpr Duration MAX_EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:45
constexpr char MESOS_DEFAULT_EXECUTOR[]
Definition: constants.hpp:170
constexpr Bytes DEFAULT_DISK
Definition: constants.hpp:98
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MIN
Definition: constants.hpp:55
constexpr Duration DEFAULT_EXECUTOR_SHUTDOWN_GRACE_PERIOD
Definition: constants.hpp:49
constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR
Definition: constants.hpp:59
Definition: duration.hpp:273
constexpr size_t DEFAULT_MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK
Definition: constants.hpp:86
Definition: duration.hpp:259
constexpr Duration GC_DELAY
Definition: constants.hpp:75
constexpr double DEFAULT_CPUS
Definition: constants.hpp:92
constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE
Definition: constants.hpp:160
constexpr double GC_DISK_HEADROOM
Definition: constants.hpp:79
Definition: duration.hpp:287
std::vector< SlaveInfo::Capability > AGENT_CAPABILITIES()
constexpr char DEFAULT_AUTHENTICATEE[]
Definition: constants.hpp:145
constexpr Duration EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:36
constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS
Definition: constants.hpp:132
constexpr char AGENT_LOG_VIRTUAL_PATH[]
Definition: constants.hpp:174
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:107
constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:157
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:148
Definition: bytes.hpp:30
constexpr Duration EXECUTOR_REGISTRATION_TIMEOUT
Definition: constants.hpp:35
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:154
constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR
Definition: constants.hpp:89
Definition: duration.hpp:315
constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT
Definition: constants.hpp:137
constexpr Duration DOCKER_INSPECT_DELAY
Definition: constants.hpp:128
Duration DEFAULT_MASTER_PING_TIMEOUT()
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:151