Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How can we list yarn jobs for a particular time frame using api ?

avatar
Explorer

I am able to list jobs using below command with different status as finished/failed/killed.

http://hostname:8088/ws/v1/cluster/apps?states=FINISHED

but what i need is, the report should list jobs for a week or month ?

I need to list finished jobs for a month and then list jobs for a week? I tried using parameter startedTime=1505907111909

but not sure on how we can implement this ? please share the format how should i use this

1 REPLY 1

avatar
Expert Contributor

@Gaurav Parmar Here is the documentation of the Cluster Applications API you are using. As you can see under the "Query Parameters Supported", to list jobs for a particular time frame you can use 4 parameters:

  • startedTimeBegin
  • startedTimeEnd
  • finishedTimeBegin
  • finishedTimeEnd

All the parameters are specified in milliseconds since epoch, so you have to convert your time interval to Unix Timestamp. For example last week is 2017-12-04:00:00:01=1512345601000 - 2017-12-10:23:59:59=1512950399000. To list all the applications that were started and finished this week you can use

http://hostname:8088/ws/v1/cluster/apps?startedTimeBegin=1512345601000&finishedTimeEnd=1512950399000...