YARN-8048. Support auto-spawning of admin configured services during bootstrap of...
[hadoop.git] / hadoop-yarn-project / hadoop-yarn / hadoop-yarn-applications / hadoop-yarn-services / hadoop-yarn-services-core / src / main / java / org / apache / hadoop / yarn / service / conf / YarnServiceConf.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.hadoop.yarn.service.conf;
20
21 import org.apache.hadoop.yarn.service.api.records.Configuration;
22
23 public class YarnServiceConf {
24
25 private static final String YARN_SERVICE_PREFIX = "yarn.service.";
26
27 // Retry settings for the ServiceClient to talk to Service AppMaster
28 public static final String CLIENT_AM_RETRY_MAX_WAIT_MS = "yarn.service.client-am.retry.max-wait-ms";
29 public static final String CLIENT_AM_RETRY_MAX_INTERVAL_MS = "yarn.service.client-am.retry-interval-ms";
30
31 // Retry settings for container failures
32 public static final String CONTAINER_RETRY_MAX = "yarn.service.container-failure.retry.max";
33 public static final String CONTAINER_RETRY_INTERVAL = "yarn.service.container-failure.retry-interval-ms";
34 public static final String CONTAINER_FAILURES_VALIDITY_INTERVAL =
35 "yarn.service.container-failure.validity-interval-ms";
36
37 public static final String AM_RESTART_MAX = "yarn.service.am-restart.max-attempts";
38 public static final String AM_RESOURCE_MEM = "yarn.service.am-resource.memory";
39 public static final long DEFAULT_KEY_AM_RESOURCE_MEM = 1024;
40
41 public static final String YARN_QUEUE = "yarn.service.queue";
42
43 public static final String API_SERVER_ADDRESS = "yarn.service.api-server.address";
44 public static final String DEFAULT_API_SERVER_ADDRESS = "0.0.0.0:";
45 public static final int DEFAULT_API_SERVER_PORT = 9191;
46
47 public static final String FINAL_LOG_INCLUSION_PATTERN = "yarn.service.log.include-pattern";
48 public static final String FINAL_LOG_EXCLUSION_PATTERN = "yarn.service.log.exclude-pattern";
49
50 public static final String ROLLING_LOG_INCLUSION_PATTERN = "yarn.service.rolling-log.include-pattern";
51 public static final String ROLLING_LOG_EXCLUSION_PATTERN = "yarn.service.rolling-log.exclude-pattern";
52
53 public static final String YARN_SERVICES_SYSTEM_SERVICE_DIRECTORY =
54 YARN_SERVICE_PREFIX + "system-service.dir";
55
56 /**
57 * The yarn service base path:
58 * Defaults to HomeDir/.yarn/
59 */
60 public static final String YARN_SERVICE_BASE_PATH = "yarn.service.base.path";
61
62 /**
63 * maximum number of failed containers (in a single component)
64 * before the app exits
65 */
66 public static final String CONTAINER_FAILURE_THRESHOLD =
67 "yarn.service.container-failure-per-component.threshold";
68 /**
69 * Maximum number of container failures on a node before the node is blacklisted
70 */
71 public static final String NODE_BLACKLIST_THRESHOLD =
72 "yarn.service.node-blacklist.threshold";
73
74 /**
75 * The failure count for CONTAINER_FAILURE_THRESHOLD and NODE_BLACKLIST_THRESHOLD
76 * gets reset periodically, the unit is seconds.
77 */
78 public static final String CONTAINER_FAILURE_WINDOW =
79 "yarn.service.failure-count-reset.window";
80
81 /**
82 * interval between readiness checks.
83 */
84 public static final String READINESS_CHECK_INTERVAL = "yarn.service.readiness-check-interval.seconds";
85 public static final int DEFAULT_READINESS_CHECK_INTERVAL = 30; // seconds
86
87 /**
88 * JVM opts.
89 */
90 public static final String JVM_OPTS = "yarn.service.am.java.opts";
91
92 /**
93 * How long to wait until a container is considered dead.
94 */
95 public static final String CONTAINER_RECOVERY_TIMEOUT_MS =
96 YARN_SERVICE_PREFIX + "container-recovery.timeout.ms";
97
98 public static final int DEFAULT_CONTAINER_RECOVERY_TIMEOUT_MS = 120000;
99
100 /**
101 * The dependency tarball file location.
102 */
103 public static final String DEPENDENCY_TARBALL_PATH = YARN_SERVICE_PREFIX
104 + "framework.path";
105
106 /**
107 * Get long value for the property. First get from the userConf, if not
108 * present, get from systemConf.
109 *
110 * @param name name of the property
111 * @param defaultValue default value of the property, if it is not defined in
112 * userConf and systemConf.
113 * @param userConf Configuration provided by client in the JSON definition
114 * @param systemConf The YarnConfiguration in the system.
115 * @return long value for the property
116 */
117 public static long getLong(String name, long defaultValue,
118 Configuration userConf, org.apache.hadoop.conf.Configuration systemConf) {
119 return userConf.getPropertyLong(name, systemConf.getLong(name, defaultValue));
120 }
121
122 public static int getInt(String name, int defaultValue,
123 Configuration userConf, org.apache.hadoop.conf.Configuration systemConf) {
124 return userConf.getPropertyInt(name, systemConf.getInt(name, defaultValue));
125 }
126
127 public static String get(String name, String defaultVal,
128 Configuration userConf, org.apache.hadoop.conf.Configuration systemConf) {
129 return userConf.getProperty(name, systemConf.get(name, defaultVal));
130 }
131 }