修改作业优先级

接口

changeJobPriority

参数

参数 类型 是否必需 说明
jobId String 作业ID
priority int 作业优先级, [0,1000]范围内的整数指定, 优先级数值越高表示作业调度时的优先级越高。

返回值

修改成功后返回一个 ChangeJobResponse 实例。修改失败后,抛出异常: 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 ChangeJobPriority {
  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. ChangeJobPriorityResponse response = client.changeJobPriority(jobId, 2);
  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: 200
  4. }

注意

当作业的状态为 Stopped 或者 Failed 才可以调用该接口修改作业优先级。