Method description
Obtains information about a job by specifying the job ID.
Parameter description
Parameter |
Type |
Description |
jobId |
String |
Job ID |
Response description
If the call succeeds, a GetJobResponse instance is returned. You can use the getJob() method of this instance to obtain the Job object.
1. Attributes of Job
Attribute |
Type |
Description |
id |
String |
Job ID. |
name |
String |
Job name. |
ownerId |
String |
Alibaba cloud ID of the owner account. |
priority |
int |
Job priority. |
state |
String |
Job state, which can be Waiting, Running, Failed, Finished, or Stopped. |
message |
String |
Response message. |
creationTime |
Date |
Creation time of the job. |
startTime |
Date |
Start time of the job. If the job is still in Waiting state, the start time is null. |
endTime |
Date |
End time of the job. If the job is not finished yet, the end time is null. |
taskMetrics |
Metrics |
Number of tasks in various states. |
instanceMetrics |
Metrics |
Number of instances in various states. |
2. Attributes of Metrics
Attribute |
Type |
Description |
waitingCount |
long |
Number of instances in Waiting state. |
runningCount |
long |
Number of instances in Running state. |
finishedCount |
long |
Number of instances in Finished state. |
failedCount |
long |
Number of instances in Failed state. |
stoppedCount |
long |
Number of instances in Stopped state. |
- If a failure occurs, a ClientException is thrown.
Sample code
try{
GetJobResponse response = client.getJob("job-0101010299123");
//Succeeded
Job job = response.getJob();
String state = job.getState();
System.out.println(state);
}catch(ClientException e){
e.printStackTrace();
// Failed
}