YARN Restapi : List running mapreduce apps which start before specified time

来源:互联网 发布:hadoop推荐算法 编辑:程序博客网 时间:2024/06/07 16:38

Cluster Applications API

With the Applications API, you can obtain a collection of resources, each of which represents an application. When you run a GET operation on this resource, you obtain a collection of Application Objects.
URI

  • http:///ws/v1/cluster/apps

HTTP Operations Supported

  • GET

Query Parameters Supported

Multiple parameters can be specified for GET operations. The started and finished times have a begin and end parameter to allow you to specify ranges. For example, one could request all applications that started between 1:00am and 2:00pm on 12/19/2011 with startedTimeBegin=1324256400&startedTimeEnd=1324303200. If the Begin parameter is not specified, it defaults to 0, and if the End parameter is not specified, it defaults to infinity.

  • state [deprecated] - state of the application
  • states - applications matching the given application states, specified as a comma-separated list.
  • finalStatus - the final status of the application - reported by the application itself
  • user - user name
  • queue - queue name
  • limit - total number of app objects to be returned
  • startedTimeBegin - applications with start time beginning with this time, specified in ms since epoch
  • startedTimeEnd - applications with start time ending with this time, specified in ms since epoch
  • finishedTimeBegin - applications with finish time beginning with this time, specified in ms since epoch
  • finishedTimeEnd - applications with finish time ending with this time, specified in ms since epoch
  • applicationTypes - applications matching the given application types, specified as a comma-separated list.
  • applicationTags - applications matching any of the given application tags, specified as a comma-separated list.

Elements of the apps (Applications) object

When you make a request for the list of applications, the information will be returned as a collection of app objects. See also Application API for syntax of the app object.
Item Data Type Description
app array of app objects(JSON)/zero or more application objects(XML) The collection of application objects
Response Examples

JSON response

HTTP Request:

GET http://<rm http address:port>/ws/v1/cluster/apps

Response Header:

  HTTP/1.1 200 OK  Content-Type: application/json  Transfer-Encoding: chunked  Server: Jetty(6.1.26)

Response Body:

{  "apps":  {    "app":    [       {          "finishedTime" : 1326815598530,          "amContainerLogs" : "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001",          "trackingUI" : "History",          "state" : "FINISHED",          "user" : "user1",          "id" : "application_1326815542473_0001",          "clusterId" : 1326815542473,          "finalStatus" : "SUCCEEDED",          "amHostHttpAddress" : "host.domain.com:8042",          "progress" : 100,          "name" : "word count",          "startedTime" : 1326815573334,          "elapsedTime" : 25196,          "diagnostics" : "",          "trackingUrl" : "http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1",          "queue" : "default",          "allocatedMB" : 0,          "allocatedVCores" : 0,          "runningContainers" : 0,          "memorySeconds" : 151730,          "vcoreSeconds" : 103       },       {          "finishedTime" : 1326815789546,          "amContainerLogs" : "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001",          "trackingUI" : "History",          "state" : "FINISHED",          "user" : "user1",          "id" : "application_1326815542473_0002",          "clusterId" : 1326815542473,          "finalStatus" : "SUCCEEDED",          "amHostHttpAddress" : "host.domain.com:8042",          "progress" : 100,          "name" : "Sleep job",          "startedTime" : 1326815641380,          "elapsedTime" : 148166,          "diagnostics" : "",          "trackingUrl" : "http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2",          "queue" : "default",          "allocatedMB" : 0,          "allocatedVCores" : 0,          "runningContainers" : 1,          "memorySeconds" : 640064,          "vcoreSeconds" : 442       }     ]  }}

XML response

HTTP Request:

  GET http://<rm http address:port>/ws/v1/cluster/apps  Accept: application/xml

Response Header:

  HTTP/1.1 200 OK  Content-Type: application/xml  Content-Length: 2459  Server: Jetty(6.1.26)

Response Body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><apps>  <app>    <id>application_1326815542473_0001</id>    <user>user1</user>    <name>word count</name>    <applicationType>MAPREDUCE</applicationType>    <queue>default</queue>    <state>FINISHED</state>    <finalStatus>SUCCEEDED</finalStatus>    <progress>100.0</progress>    <trackingUI>History</trackingUI>    <trackingUrl>http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1</trackingUrl>    <diagnostics/>    <clusterId>1326815542473</clusterId>    <startedTime>1326815573334</startedTime>    <finishedTime>1326815598530</finishedTime>    <elapsedTime>25196</elapsedTime>    <amContainerLogs>http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001</amContainerLogs>    <amHostHttpAddress>host.domain.com:8042</amHostHttpAddress>    <allocatedMB>0</allocatedMB>    <allocatedVCores>0</allocatedVCores>    <runningContainers>0</runningContainers>    <memorySeconds>151730</memorySeconds>    <vcoreSeconds>103</vcoreSeconds>  </app>  <app>    <id>application_1326815542473_0002</id>    <user>user1</user>    <name>Sleep job</name>    <applicationType>YARN</applicationType>    <queue>default</queue>    <state>FINISHED</state>    <finalStatus>SUCCEEDED</finalStatus>    <progress>100.0</progress>    <trackingUI>History</trackingUI>    <trackingUrl>http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2</trackingUrl>    <diagnostics/>    <clusterId>1326815542473</clusterId>    <startedTime>1326815641380</startedTime>    <finishedTime>1326815789546</finishedTime>    <elapsedTime>148166</elapsedTime>    <amContainerLogs>http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001</amContainerLogs>    <amHostHttpAddress>host.domain.com:8042</amHostHttpAddress>    <allocatedMB>0</allocatedMB>    <allocatedVCores>0</allocatedVCores>    <runningContainers>0</runningContainers>    <memorySeconds>640064</memorySeconds>    <vcoreSeconds>442</vcoreSeconds>  </app></apps>

For example, the following request query state=Running,Accepted and applicationTypes=mapreduce and startedTime smaller than 1492593046942

http://<rm http address:port>/ws/v1/cluster/apps?state=Running,Accepted&&applicationTypes=mapreduce&startedTimeEnd=1492593046942
0 0
原创粉丝点击