Viewing a Job Instance List
Function
This API is used to view a job instance list.
A job instance is generated each time you run a batch job for which periodic scheduling or event-based scheduling is configured. If a real-time job contains a node for which periodic scheduling or event-based scheduling is configured, you can call this API to view the instance list of the subjobs associated with the node. The format of the jobName parameter is real-time job name_node name.
URI
- URI format
GET /v1/{project_id}/jobs/instances/detail?jobName={jobName}&minPlanTime={minPlanTime}&maxPlanTime={maxPlanTime}&limit={limit}&offset={offset}&status={status}
- Parameter description
Table 1 URI parameter description Parameter
Mandatory
Type
Description
project_id
Yes
String
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
jobName
No
String
Job name.
- If you want to query the instance list of a specific batch job, jobName is the batch job name.
- If you want to query sub-jobs associated with a node in a real-time job, the jobName format is real-time job name _ node name.
minPlanTime
No
Long
The job instance whose planned execution time is later than minPlanTime is returned.
maxPlanTime
No
Long
The job instance whose planned execution time is earlier than minPlanTime is returned.
offset
No
int
Start page of the paging list. Default value: 0 The value must be greater than or equal to 0.
limit
No
int
Specifies the maximum number of records on each page.
The parameter value ranges from 1 to 1,000.
Default value: 10
status
No
String
Job instance status. The value can be:
- waiting
- running
- success
- fail
- running-exception
- pause
- manual-stop
Request Message
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace | No | String | Workspace ID.
|
Response Message
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| total | Yes | int | Total number of records. |
| instances | Yes | List<Instance> | Job instance status. For details, see Table 4. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| jobName | Yes | String | Job name. When you view the instance list of a specified batch job, jobName is the name of the batch job. When you view the subjobs associated with a node in a real-time job, jobName is in format of real-time job name_node name. |
| status | Yes | String | Job instance status. The value can be:
|
| planTime | Yes | Long | Planned execution time of the job instance. |
| startTime | Yes | Long | Actual execution start time of the job instance. |
| endTime | No | Long | Actual execution end time of the job instance. |
| executeTime | No | Long | Execution duration in milliseconds. |
| instanceId | Yes | Long | Job instance ID. |
| submitTime | Yes | Long | Time when a job is submitted. |
Example 1
View the instance list of batch job job_batch.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/jobs/instances/detail?jobName=job_batch
- Success response
{ "total": 2, "instances": [{ "endTime": 1551671598000, "executeTime": 0.3, "instanceId": 34765, "jobName": "job_batch", "planTime": 1551671580000, "startTime": 1551671580000, "status": "success", "submitTime": 1550910278706 }, { "endTime": 1551671538000, "executeTime": 0.3, "instanceId": 34764, "jobName": "job_batch", "planTime": 1551671520000, "startTime": 1551671521000, "status": "success", "submitTime": 1550910278706 }] }
Example 3
View the instance list of the subjobs associated with node DLI_SMS_PROCESS in real-time job job_sms. The following figure shows the job_sms job. Event-based scheduling is configured for the DLI_SMS_PROCESS node.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/jobs/instances/detail?jobName=job_sms_DLI_SMS_PROCESS
- Response
{ "total": 2, "instances": [{ "endTime": 1551425387000, "exeTime": 1.0, "instanceId": 30654, "jobName": "job_sms_DLI_SMS_PROCESS", "planTime": 1551425326540, "startTime": 1551425327000, "status": "fail", "submitTime": 1551409464657 }, { "endTime": 1551409570000, "exeTime": 0.5, "instanceId": 28960, "jobName": "job_sms_DLI_SMS_PROCESS", "planTime": 1551323851910, "startTime": 1551409540000, "status": "fail", "submitTime": 1551323793766 }] }
Last Article: Viewing Running Status of a Real-Time Job
Next Article: Viewing Job Instance Details
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.