wait_until(client, response, property=None, state=None, max_interval_seconds=30, max_wait_seconds=1200, succeed_on_not_found=False, **kwargs)¶
Wait until the value of the given property in the response data has the given value.
This will block the current thread until either the the desired state or the maximum wait time is reached. This is only supported for responses resulting from GET operations. A typical use case is to wait on an instance until it is in a running state.
Although this can be run on any property of the data resulting from any GET operation, the most common use case is to check state properties on operations that GET a single object.
The wait will poll at an increasing interval up to 'max_interval_seconds' for a maximum total time of 'max_wait_seconds'. If the maximum time is exceeded, then it will raise a MaximumWaitTimeExceededError.
On successful completion the final Response object will be returned. The original Response object will not be altered.
If any responses result in an error, then the error will be thrown as normal resulting in the wait being aborted.
- client -- A client we can use to call the service to periodically retrieve data.
- response -- A Response object resulting from a GET operation.
- property -- A string with the name of the property from the response data to evaluate. For example, 'state'.
- state -- The value of the property that will indicate successful completion of the wait. Type corresponds to the property type.
- max_interval_seconds -- (optional) The maximum interval between queries, in seconds. Defaults to 30 seconds.
- max_wait_seconds -- (optional) The maximum time to wait, in seconds. Defaults to 1200 seconds.
- succeed_on_not_found -- (optional) A boolean determining whether or not the waiter should return successfully if the data we're waiting on is not found (e.g. a 404 is returned from the service). This defaults to False and so a 404 would cause an exception to be thrown by this function. Setting it to True may be useful in scenarios when waiting for a resource to be terminated/deleted since it is possible that the resource would not be returned by the a GET call anymore.
- evaluate_response -- (optional) A function which can be used to evaluate the response from the GET operation. This is a single argument function which takes in the response from the GET operation. If this function is supplied, then the 'property' argument cannot be supplied. It is expected that this function return a truthy value to signify that a condition has passed and the wait_until function should return, and a falsey value otherwise.
- wait_callback -- (optional) A function which will be called each time that we have to do an initial wait (i.e. because the
property of the resource was not in the correct state, or the
evaluate_responsefunction returned False). This function should take two arguments - the first argument is the number of times we have checked the resource, and the second argument is the result of the most recent check.
The final response, which will contain the property in the specified state.
succeed_on_not_foundparameter is set to True and the data was not then
oci.waiter.WAIT_RESOURCE_NOT_FOUNDwill be returned. This is a
Sentinelwhich is not truthy and holds an internal name of