All Products
Search
Document Center

Batch Compute:getJob

Last Updated:May 11, 2018

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

  1. try{
  2. GetJobResponse response = client.getJob("job-0101010299123");
  3. //Succeeded
  4. Job job = response.getJob();
  5. String state = job.getState();
  6. System.out.println(state);
  7. }catch(ClientException e){
  8. e.printStackTrace();
  9. // Failed
  10. }