全部产品
云市场

获取作业信息

更新时间:2018-11-19 21:03:37

接口

getJob

参数

参数 类型 是否必需 说明
jobId String 作业ID

返回值

成功后返回一个 GetJobResponse 实例,可以通过这个实例的 getJob() 方法获取 Job 对象;Job 对象的具体属性参考API文档。如果失败,抛出异常: ClientException

例子

Java 源码

  1. import com.aliyuncs.batchcompute.main.v20151111.*;
  2. import com.aliyuncs.batchcompute.model.v20151111.*;
  3. import com.aliyuncs.batchcompute.pojo.v20151111.*;
  4. import com.aliyuncs.exceptions.ClientException;
  5. public class GetJob {
  6. static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyId
  7. static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
  8. static String REGION_ID = "cn-xxx"; //这里填写 region
  9. static String jobId = "job-000000005BE3E897000007FA00114EE9";
  10. public static void main(String[] args) {
  11. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  12. try{
  13. GetJobResponse response = client.getJob(jobId);
  14. //成功
  15. Job job = response.getJob();
  16. System.out.println("jobId: " + job.getId());
  17. System.out.println("jobNameId: " + job.getName());
  18. System.out.println("jobState: " + job.getState());
  19. System.out.println("RequestId: " + response.getRequestId());
  20. System.out.println("StatusCode: " + response.getStatusCode());
  21. }catch(ClientException e){
  22. e.printStackTrace();
  23. //失败
  24. }
  25. }
  26. }

执行结果:

  1. {
  2. jobId: job-000000005BE3E897000007FA00114EE9
  3. jobNameId: javaSdkJob
  4. jobState: Waiting
  5. RequestId: null
  6. StatusCode: 200
  7. }