Jobs API#
Job is an abstraction for long-running operations in the API. Some operations cannot be finished within a reasonable amount of time for a normal HTTP request. Each job has a state, an id, and can be awaited on asynchronously.
Before you start, make sure that the igz_mgmt package is installed and that you are logged in to the system with the igz_mgmt.Client API. If not, see Control plane API.
import igz_mgmt
client = igz_mgmt.Client(access_key="some-access-id")
Which functions create jobs?#
When you run one of these functions, the system returns a job-id that you can use to see the job status and manage the job:
AppServices
functions (create_or_update, restart, remove, enable, disable, scale_from_zero)AppServicesManifest
functions (create_or_update, restart, remove_service, scale_from_zero, apply_services)
List all jobs#
jobs = igz_mgmt.Job.list(client)
Get a job#
job = igz_mgmt.Job.get(client, "some-job-id")
Wait for job completion#
To wait for a job to complete, use wait_for_completion
. The retry interval (get the job state every X seconds) and the timeout (in seconds) are configurable. The default values are job_completion_retry_interval=30, timeout=3600.
For example:
igz_mgmt.Job.wait_for_completion(
client, "some-job-id", job_completion_retry_interval=30, timeout=180
)