YARN-5931. Document timeout interfaces CLI and REST APIs (Contributed by Rohith Sharma K S via Daniel Templeton)

(cherry picked from commit 165d01a73e)
This commit is contained in:
Daniel Templeton 2016-12-30 08:41:52 -08:00
parent ec646b1a9d
commit 8cb7aa2b52
6 changed files with 266 additions and 5 deletions

View File

@ -28,9 +28,19 @@
* <ul>
* <li>{@link ApplicationTimeoutType} of the timeout type.</li>
* <li>Expiry time in ISO8601 standard with format
* <b>yyyy-MM-dd'T'HH:mm:ss.SSSZ</b>.</li>
* <b>yyyy-MM-dd'T'HH:mm:ss.SSSZ</b> or "UNLIMITED".</li>
* <li>Remaining time in seconds.</li>
* </ul>
* The possible values for {ExpiryTime, RemainingTimeInSeconds} are
* <ul>
* <li>{UNLIMITED,-1} : Timeout is not configured for given timeout type
* (LIFETIME).</li>
* <li>{ISO8601 date string, 0} : Timeout is configured and application has
* completed.</li>
* <li>{ISO8601 date string, greater than zero} : Timeout is configured and
* application is RUNNING. Application will be timed out after configured
* value.</li>
* </ul>
*/
@Public
@Unstable

View File

@ -1512,7 +1512,7 @@ public static boolean isAclEnabled(Configuration conf) {
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

View File

@ -2995,7 +2995,7 @@
The RMAppLifetimeMonitor Service uses this value as monitor interval
</description>
<name>yarn.resourcemanager.application-timeouts.monitor.interval-ms</name>
<value>60000</value>
<value>3000</value>
</property>
</configuration>

View File

@ -76,8 +76,8 @@ protected synchronized void expire(RMAppToMonitor monitoredAppKey) {
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));
}

View File

@ -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://<rm http address:port>/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://<rm http address:port>/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://<rm http address:port>/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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<timeouts>
<timeout>
<type>LIFETIME</type>
<expiryTime>2016-12-05T22:51:00.104+0530</expiryTime>
<remainingTimeInSeconds>27</remainingTimeInSeconds>
</timeout>
</timeouts>
```
Cluster Application Timeout API
--------------------------------
The Cluster Application Timeout resource contains information about timeout.
### URI
* http://<rm http address:port>/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://<rm http address:port>/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://<rm http address:port>/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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<timeout>
<type>LIFETIME</type>
<expiryTime>2016-12-05T22:51:00.104+0530</expiryTime>
<remainingTimeInSeconds>27</remainingTimeInSeconds>
</timeout>
```
Cluster Application Timeout Update API
--------------------------------
Update timeout of an application for given timeout type.
### URI
* http://<rm http address:port>/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://<rm http address:port>/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://<rm http address:port>/ws/v1/cluster/apps/{appid}/timeout
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<timeout>
<type>LIFETIME</type>
<expiryTime>2016-11-27T09:36:16.678+05:30</expiryTime>
</timeout>
```
Response Header:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 712
Server: Jetty(6.1.26)
Response Body:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<timeout>
<type>LIFETIME</type>
<expiryTime>2016-11-27T09:36:16.678+05:30</expiryTime>
<remainingTimeInSeconds>90</remainingTimeInSeconds>
</timeout>
```

View File

@ -72,6 +72,7 @@ Usage: `yarn application [options] `
| -movetoqueue \<Application Id\> | Moves the application to a different queue. |
| -queue \<Queue Name\> | Works with the movetoqueue command to specify which queue to move an application to. |
| -status \<ApplicationId\> | Prints the status of the application. |
| -updateLifetime \<Timeout\> | Update application timeout (from the time of request) in seconds. ApplicationId can be specified using 'appId' option. |
| -updatePriority \<Priority\> | Update priority of an application. ApplicationId can be passed using 'appId' option. |
Prints application(s) report/kill application