文档

停止作业

更新时间:

接口

stopJob

参数

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

返回值

停止成功后返回一个 StopJobResponse 实例。停止失败后,抛出异常: 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 StopJob {
  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. StopJobResponse response = client.stopJob(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. }

注意

当作业的状态为 Waiting 或 Running 才支持调用该接口停止作业。

  • 本页导读 (0)
文档反馈