task_wait

Code

BIGIQ.task_wait(obj: bigrest.common.restobject.RESTObject, interval: int = 10) → None

Continually queries the status of the task until it finishes.

Sends an HTTP GET request to the iControl REST API.

Parameters:
  • obj – Object that represents the task.
  • interval – The interval the queries will be made.
Exceptions:
RESTAPIError: Raised when iControl REST API returns an error.

Example

path = (
    f"/mgmt/shared/resolver/device-groups/cm-adccore-allbigipDevices/devices"
    f"?$filter=hostname eq 'LABBIGIP1.lab.local'"
)
device_link = device.link(path)
path = (
    f"/mgmt/shared/resolver/device-groups/cm-adccore-allbigipDevices/devices"
    f"?$filter=hostname eq 'LABBIGIP2.lab.local'"
)
device_link2 = device.link(path)
data = {
    "name": "BIGREST Add config to device",
    "deviceReferences": [
            {
                "link": device_link
            },
            {
                "link": device_link2
            }
    ],
    "disableUnusedObjectRemoval": True
}
task = device.task_start(
    "/mgmt/cm/adc-core/tasks/deploy-configuration", data)
device.task_wait(task)

Explanation

After the task has started, we can wait for its completion with the task_wait method.