删除作业

更新时间: 2022-09-22 10:03:23

接口

deleteJob

参数

参数

类型

是否必需

说明

jobId

String

作业ID

返回值

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

例子

Java 源码

import com.aliyuncs.batchcompute.main.v20151111.*;
import com.aliyuncs.batchcompute.model.v20151111.*;
import com.aliyuncs.exceptions.ClientException;

public class DeleteJob {
    static String ACCESS_KEY_ID = "xxx";  //这里填写您的 AccessKeyId
    static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
    static String REGION_ID = "cn-xxx";   //这里填写 region
    static String jobId = "job-000000005BE3E897000007FA00114EE9";

    public static void main(String[] args) {
        BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
        try{
            DeleteJobResponse response = client.deleteJob(jobId);
            //成功
            System.out.println("RequestId: " + response.getRequestId());
            System.out.println("StatusCode: " + response.getStatusCode());
        }catch(ClientException e){
            e.printStackTrace();
            //失败
        }
    }
}

执行结果:

{
  RequestId: null
  StatusCode: 201
}

注意

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

阿里云首页 批量计算 相关技术圈