All Products
Search
Document Center

change_job_priority

Last Updated: May 14, 2018

Description

Changes priority of a job. Priority of a job can be changed only when the job is in Stopped state.

Parameter description

Attribute Type Description
job CreateResponse, str Job ID
priority int Job priority. The value ranges from 0 to 1000. Priority increases with the value.

Response description

The change_job_priority method returns an ActionResponse object. ActionResponse provides only two attributes: request ID and status code.

Example

  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)