diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationTimeout.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationTimeout.java
index 4beb11e1de4..444a270236d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationTimeout.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationTimeout.java
@@ -28,9 +28,19 @@ import org.apache.hadoop.yarn.util.Records;
*
* - {@link ApplicationTimeoutType} of the timeout type.
* - Expiry time in ISO8601 standard with format
- * yyyy-MM-dd'T'HH:mm:ss.SSSZ.
+ * yyyy-MM-dd'T'HH:mm:ss.SSSZ or "UNLIMITED".
* - Remaining time in seconds.
*
+ * The possible values for {ExpiryTime, RemainingTimeInSeconds} are
+ *
+ * - {UNLIMITED,-1} : Timeout is not configured for given timeout type
+ * (LIFETIME).
+ * - {ISO8601 date string, 0} : Timeout is configured and application has
+ * completed.
+ * - {ISO8601 date string, greater than zero} : Timeout is configured and
+ * application is RUNNING. Application will be timed out after configured
+ * value.
+ *
*/
@Public
@Unstable
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index 7b70347d799..efa8b9de64b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -1512,7 +1512,7 @@ public class YarnConfiguration extends Configuration {
RM_PREFIX + "application-timeouts.monitor.interval-ms";
public static final long DEFAULT_RM_APPLICATION_MONITOR_INTERVAL_MS =
- 60000;
+ 3000;
/**
* Interval of time the linux container executor should try cleaning up
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index b0dc83c5386..79df3bad76d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -2995,7 +2995,7 @@
The RMAppLifetimeMonitor Service uses this value as monitor interval
yarn.resourcemanager.application-timeouts.monitor.interval-ms
- 60000
+ 3000
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java
index d194204c925..2fd946fe9a1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java
@@ -76,8 +76,8 @@ public class RMAppLifetimeMonitor
if (app == null) {
return;
}
- String diagnostics =
- "Application killed due to exceeding its lifetime period";
+ String diagnostics = "Application is killed by ResourceManager as it"
+ + " has exceeded the lifetime period.";
rmContext.getDispatcher().getEventHandler()
.handle(new RMAppEvent(appId, RMAppEventType.KILL, diagnostics));
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md
index 94d075bc579..7881b5db0be 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md
@@ -38,6 +38,9 @@ ResourceManager REST API's.
* [Cluster Reservation API Submit](#Cluster_Reservation_API_Submit)
* [Cluster Reservation API Update](#Cluster_Reservation_API_Update)
* [Cluster Reservation API Delete](#Cluster_Reservation_API_Delete)
+* [Cluster Application Timeouts API](#Cluster_Application_Timeouts_API)
+* [Cluster Application Timeout API](#Cluster_Application_Timeout_API)
+* [Cluster Application Timeout Update API](#Cluster_Application_Timeout_Update_API)
Overview
--------
@@ -4031,3 +4034,250 @@ Server: Jetty(6.1.26)
Response Body:
No response body
+
+Cluster Application Timeouts API
+--------------------------------
+
+Cluster Application Timeouts API can be used to get all configured timeouts of an application. When you run a GET operation on this resource, a collection of timeout objects is returned. Each timeout object is composed of a timeout type, expiry-time and remaining time in seconds.
+
+
+### URI
+
+ * http:///ws/v1/cluster/apps/{appid}/timeouts
+
+### HTTP Operations Supported
+
+ * GET
+
+### Elements of the *timeouts* (Application Timeouts) object
+
+When you make a request for the list of application timeouts, the information will be returned as a collection of timeout objects. See also [Cluster Application Timeout API](#Cluster_Application_Timeout_API) for syntax of the timeout object.
+
+| Item | Data Type | Description |
+|:---- |:---- |:---- |
+| timeout | array of timeout objects(JSON)/zero or more application objects(XML) | The collection of application timeout objects |
+
+**JSON response**
+
+HTTP Request:
+
+ Accept: application/json
+ GET http:///ws/v1/cluster/apps/{appid}/timeouts
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Transfer-Encoding: chunked
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```json
+{
+ "timeouts":
+ {
+ "timeout":
+ [
+ {
+ "type": "LIFETIME",
+ "expiryTime": "2016-12-05T22:51:00.104+0530",
+ "remainingTimeInSeconds": 27
+ }
+ ]
+ }
+}
+```
+
+**XML response**
+
+HTTP Request:
+
+ Accept: application/xml
+ GET http:///ws/v1/cluster/apps/{appid}/timeouts
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/xml
+ Content-Length: 712
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```xml
+
+
+
+ LIFETIME
+ 2016-12-05T22:51:00.104+0530
+ 27
+
+
+```
+
+Cluster Application Timeout API
+--------------------------------
+
+The Cluster Application Timeout resource contains information about timeout.
+
+
+### URI
+
+ * http:///ws/v1/cluster/apps/{appid}/timeouts/{type}
+
+### HTTP Operations Supported
+
+ * GET
+
+### Elements of the *timeout* (Application Timeout) object
+
+| Item | Data Type | Description |
+|:---- |:---- |:---- |
+| type | string | Timeout type. Valid values are the members of the ApplicationTimeoutType enum. LIFETIME is currently the only valid value. |
+| expiryTime | string | Time at which the application will expire in ISO8601 yyyy-MM-dd'T'HH:mm:ss.SSSZ format. If UNLIMITED, then application will run forever. |
+| remainingTimeInSeconds | long | Remaining time for configured application timeout. -1 indicates that application is not configured with timeout. Zero(0) indicates that application has expired with configured timeout type. |
+
+**JSON response**
+
+HTTP Request:
+
+ Accept: application/json
+ GET http:///ws/v1/cluster/apps/{appid}/timeouts/LIFETIME
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Transfer-Encoding: chunked
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```json
+{
+"timeout":
+ {
+ "type": "LIFETIME",
+ "expiryTime": "2016-12-05T22:51:00.104+0530",
+ "remainingTimeInSeconds": 27
+ }
+}
+```
+
+**XML response**
+
+HTTP Request:
+
+ Accept: application/xml
+ GET http:///ws/v1/cluster/apps/{appid}/timeouts/LIFETIME
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/xml
+ Content-Length: 712
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```xml
+
+
+ LIFETIME
+ 2016-12-05T22:51:00.104+0530
+ 27
+
+```
+
+Cluster Application Timeout Update API
+--------------------------------
+
+Update timeout of an application for given timeout type.
+
+
+### URI
+
+ * http:///ws/v1/cluster/apps/{appid}/timeout
+
+### HTTP Operations Supported
+
+ * PUT
+
+### Elements of the *timeout* object
+
+| Item | Data Type | Description |
+|:---- |:---- |:---- |
+| type | string | Timeout type. Valid values are the members of the ApplicationTimeoutType enum. LIFETIME is currently the only valid value. |
+| expiryTime | string | Time at which the application will expire in ISO8601 yyyy-MM-dd'T'HH:mm:ss.SSSZ format. |
+
+**JSON response**
+
+HTTP Request:
+
+```json
+ Accept: application/json
+ GET http:///ws/v1/cluster/apps/{appid}/timeout
+ Content-Type: application/json
+ {
+ "timeout":
+ {
+ "type": "LIFETIME",
+ "expiryTime": "2016-11-27T09:36:16.678+05:30"
+ }
+ }
+```
+
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Transfer-Encoding: chunked
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```json
+{
+"timeout":
+ {
+ "type": "LIFETIME",
+ "expiryTime": "2016-11-27T09:36:16.678+05:30",
+ "remainingTimeInSeconds": 90
+ }
+}
+```
+
+**XML response**
+
+HTTP Request:
+
+```xml
+ Accept: application/xml
+ GET http:///ws/v1/cluster/apps/{appid}/timeout
+ Content-Type: application/xml
+
+
+ LIFETIME
+ 2016-11-27T09:36:16.678+05:30
+
+```
+
+Response Header:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/xml
+ Content-Length: 712
+ Server: Jetty(6.1.26)
+
+Response Body:
+
+```xml
+
+
+ LIFETIME
+ 2016-11-27T09:36:16.678+05:30
+ 90
+
+```
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnCommands.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnCommands.md
index eefbafa5c1a..276b18648ce 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnCommands.md
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnCommands.md
@@ -72,6 +72,7 @@ Usage: `yarn application [options] `
| -movetoqueue \ | Moves the application to a different queue. |
| -queue \ | Works with the movetoqueue command to specify which queue to move an application to. |
| -status \ | Prints the status of the application. |
+| -updateLifetime \ | Update application timeout (from the time of request) in seconds. ApplicationId can be specified using 'appId' option. |
| -updatePriority \ | Update priority of an application. ApplicationId can be passed using 'appId' option. |
Prints application(s) report/kill application