YARN-5931. Document timeout interfaces CLI and REST APIs (Contributed by Rohith Sharma K S via Daniel Templeton)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/165d01a7 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/165d01a7 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/165d01a7 Branch: refs/heads/YARN-5085 Commit: 165d01a73e5f328108a9e876c7a751a3c2cec4a8 Parents: c6a5b68 Author: Daniel Templeton <[email protected]> Authored: Fri Dec 30 08:41:52 2016 -0800 Committer: Daniel Templeton <[email protected]> Committed: Fri Dec 30 08:41:52 2016 -0800 ---------------------------------------------------------------------- .../yarn/api/records/ApplicationTimeout.java | 12 +- .../hadoop/yarn/conf/YarnConfiguration.java | 2 +- .../src/main/resources/yarn-default.xml | 2 +- .../rmapp/monitor/RMAppLifetimeMonitor.java | 4 +- .../src/site/markdown/ResourceManagerRest.md | 250 +++++++++++++++++++ .../src/site/markdown/YarnCommands.md | 1 + 6 files changed, 266 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationTimeout.java ---------------------------------------------------------------------- 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 4beb11e..444a270 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; * <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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java ---------------------------------------------------------------------- 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 bf0a0ab..d0ade22 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 @@ -1521,7 +1521,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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml ---------------------------------------------------------------------- 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 9d73308..3c30ed3 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 @@ -2996,7 +2996,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> http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/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 ---------------------------------------------------------------------- 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 d194204..2fd946f 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)); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md ---------------------------------------------------------------------- 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 94d075b..7881b5d 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://<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> +``` \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/165d01a7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnCommands.md ---------------------------------------------------------------------- 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 56096f5..cfe3926 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 @@ -76,6 +76,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 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
