All Products
Search
Document Center

start_job

Last Updated: May 14, 2018

Description

This API can be called only when the job is in Stopped or Failed state.

After a job in Failed state is restarted, instances that have been started will not be restarted again.

Parameter description

Attribute Type Description
job CreateResponse, str Job ID

Response description

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

Example

  1. try:
  2. # Get a Client object.
  3. client = Client(...
  4. ...
  5. # Job ID.
  6. job = "job-xxxx"
  7. job_detail = client.get_job(job)
  8. if job_detail.State == "Stopped":
  9. # Only stopped job can be restarted.
  10. client.start_job(job)
  11. job_detail = client.get_job(job)
  12. assert job_detail.State in ["Waiting", "Running"]
  13. except ClientError, e:
  14. print(e)