修改作业优先级

change_job_priority

改变作业的优先级,作业状态为Stopped时才能改变作业的优先级。

参数说明:

属性 类型 描述
job CreateResponse, str 作业标识符
priority int 作业优先级,[0-1000],数值越高优先级越高

返回值说明:

change_job_priority方法将返回一个 ActionResponse 对象, ActionResponse仅提供了request ID和状态码两个属性。

e.g.

  1. try:
  2. client = Client(...
  3. ...
  4. # Job created before.
  5. job_id = "job-xxxx"
  6. # Only the priority of stopped jobs can be changed.
  7. client.stop_job(job_id)
  8. assert client.get_job(job_id).State == 'Stopped'
  9. # Try to change priority.
  10. client.change_job_priority(job_id, 99)
  11. client.start_job(job_id)
  12. assert client.get_job_description(job_id).Priority == 99
  13. except ClientError, e:
  14. print(e)