Skip to main content

Home

Job endpoints

/jobs

Gets total job count, at one hour intervals.

Request
GET http://unravel-host:3000/api/v1/jobs?from={timestamp}&to={timestamp}
Path parameters

None.

Query parameters

Name

Type

Description

from

string

Start date. Format YYYY-MM-DD

to

string

End date. Format YYYY-MM-DD

Response body
[
  "string"
]
Examples

Request:

curl -X GET "http://http://myserver.com:3000/api/v1/jobs" -H  "accept: application/json" -H  "Authorization: JWT token"
/jobs/bystatus

Gets the total job count per job type, at one hour intervals, in a given time window.

Request
GET http://unravel-host:3000/api/v1/jobs/bystatus?from={timestamp}&to={timestamp}
Path parameters

None.

Query parameters

Required parameters are highlighted.

Name

Type

Description

from

string

Start date. Format YYYY-MM-DD

to

string

End date. Format YYYY-MM-DD

Response body
[
  "string"
]
Examples

Request:

curl -X GET "http://http://myserver.com:3000/api/v1/jobs/bystatus" -H  "accept: application/json" -H  "Authorization: JWT token"
/jobs/bytype

Gets the total job count per job type, at one hour intervals, in a given time window.

Request
GET http://unravel-host:3000/api/v1/jobs/bytype?from={timestamp}&to={timestamp}
Path parameters

None.

Query parameters

Required parameters are highlighted.

Name

Type

Description

from

string

Start date. Format YYYY-MM-DD

to

string

End date. Format YYYY-MM-DD

Response body
[
  "string"
]
Examples

Request:

curl -X GET "http://http://myserver.com:3000/api/v1/jobs/bytype" -H  "accept: application/json" -H  "Authorization: JWT token"
/jobs/count

Gets the number of jobs in a given timeframe, grouped by state, app type, user, or queue.

Request
GET http://unravel-host:3000/api/v1/jobs/count?from={time}&to={time}&groupBy={category}&interval={polling_interval}
Path parameters

None.

Query parameters

Required parameters are highlighted.

Name

Type

Description

from

string

Start time in Unix epoch format.

to

string

End time in Unix epoch format.

groupBy

string

Job category.

Valid values are state, applicationType, user, queue.

interval

string

Polling interval.

Valid values are 1m, 5m, 10m, 30m, 1h, 1d, 1w.

Response body
JSON schema when groupBy is state:
{
  "date": [
    epoch-timestamp
  ],
  "RUNNING": {
    epoch-timestamp
: average
  },
  "ACCEPTED": {
    epoch-timestamp
: average
  }
}
JSON schema when groupBy is applicationType:
{
 { 
   "date" :  [ 
      // array of polling epoch-timestamp
     epoch-timestamp
   ],

   APP_TYPE : { 
     // APP_TYPE mr | hive |  spark | pig | cascading | impala | tez 
     // for each polling interval where the app type is running
    epoch-timestamp: count
    }
}
JSON schema when groupBy is user:
{
  "date": [
    epoch-timestamp
  ],
  userName: {
    epoch-timestamp: average
  }
}
JSON schema when groupBy is queue:
{
  "date": [
    epoch-timestamp
  ],
  queue Name: {
    epoch-timestamp: average
  }
}
Examples
Request with groupBy set to state:

Request:

curl -X GET "http://myserver.com:3000/api/v1/jobs/count?to=1536275822&groupBy=state&interval=1h&from=1535671022" -H "accept: application/json" -H  "Authorization: JWT token"

Response:

{
  "date": [
    1535626800000
  ],
  "RUNNING": {
    "1535626800000": "1.3333333333"
  },
  "ACCEPTED": {
    "1535695200000": "1"
  }
}
Request with groupBy set to applicationType:
curl -X GET "http://localhost:3000/api/v1/jobs/count?to=1536280789&groupBy=applicationType&interval=1h&from=1535675989" -H "accept: application/json" -H  "Authorization: JWT token"

Response:

{
  "date": [
    1535644800000,
    1535695200000,
    1535698800000,
    1535702400000,
    1535706000000,
    1535709600000,
    1535731200000,
    1535745600000,
    1535814000000,
    1535817600000,
    1535904000000,
    1535961600000,
    1535990400000,
    1536030000000,
    1536037200000,
    1536040800000
  ],
  "MAPREDUCE": {
    "1535644800000": "1",
    "1535695200000": "1",
    "1535698800000": "1",
    "1535702400000": "1",
    "1535706000000": "1",
    "1535709600000": "1",
    "1535731200000": "1",
    "1535745600000": "1",
    "1535814000000": "1",
    "1535817600000": "1",
    "1535904000000": "1",
    "1535961600000": "1.5",
    "1535990400000": "1",
    "1536030000000": "1",
    "1536037200000": "1",
    "1536040800000": "1.1538461539"
  },
  "SPARK": {
    "1535698800000": "1"
  }
}
Request with groupBy set to user:
curl -X GET "http://localhost:3000/api/v1/jobs/count?to=1536281730&groupBy=user&interval=1h&from=1535676930" -H "accept: application/json" -H  "Authorization: JWT token"

Response:

{
  "date": [
    1535695200000,
    1535698800000,
    1535702400000,
    1535706000000,
    1535709600000,
    1535731200000,
    1535745600000,
    1535814000000,
    1535817600000,
    1535904000000
  ],
  "root": {
    "1535695200000": "1",
    "1535709600000": "1",
    "1535731200000": "1",
    "1535745600000": "1",
    "1535814000000": "1",
    "1535817600000": "1",
    "1535904000000": "1"
  },
  "hdfs": {
    "1535698800000": "1",
    "1535702400000": "1",
    "1535706000000": "1"
  }
}
Request with groupBy set to queue:
curl -X GET "http://localhost:3000/api/v1/jobs/count?to=1536339111&groupBy=queue&interval=1h&from=1535734311" -H "accept: application/json" -H  "Authorization: JWT token"

Response:

{
  "date": [
    1535695200000,
    1535698800000,
    1535702400000,
    1535706000000,
    1535709600000,
    1535731200000,
    1535745600000,
    1535814000000,
    1535817600000,
    1535904000000,
    1535961600000,
    1535990400000,
    1536030000000,
    1536037200000,
    1536040800000,
    1536044400000,
    1536048000000,
    1536051600000,
    1536055200000,
    1536058800000,
    1536076800000
  ],
  "root.users.root": {
    "1535695200000": "1",
    "1535709600000": "1",
    "1535731200000": "1",
    "1535745600000": "1",
    "1535814000000": "1",
    "1535817600000": "1",
    "1535904000000": "1",
    "1535961600000": "1",
    "1535990400000": "1",
    "1536030000000": "1",
    "1536037200000": "1",
    "1536040800000": "1",
    "1536076800000": "1"
  },
  "root.users.hdfs": {
    "1535698800000": "1",
    "1535702400000": "1",
    "1535706000000": "1",
    "1535961600000": "2",
    "1536040800000": "1.1304347826",
    "1536044400000": "1",
    "1536055200000": "1.3333333333",
    "1536058800000": "1"
  },
  "root.users.user11": {
    "1535698800000": "1"
  },
  "root.abcdefghijklmnopqrstuvwxyz": {
    "1536037200000": "1",
    "1536040800000": "1",
    "1536044400000": "1"
  }
}