全部产品

删除作业

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

接口

deleteJob

参数

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

返回值

删除成功后返回一个 DeleteJobResponse 实例。删除失败后,抛出异常: ClientException

例子

Java 源码

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

执行结果:

  1. {
  2. RequestId: null
  3. StatusCode: 201
  4. }

注意

当作业的状态为Stopped、Terminated 或 Failed,才可以调用该接口。