await
and await_all
can wrap Civis API endpoints in generated_client.R
.
The default values for .status_key
, .success_states
, and .error_states
are suitable for most endpoints. The final status of f
can be obtained using
get_status
.
If an error state is reached, await
throws a civis_await_error
.
await_all
silently captures and returns a civis_await_error
for any job
reaching an error state as an element in the list of results.
If .timeout
is specified and the job fails to reach a success state
within the time limit, await
throws a civis_timeout_error
.
Likewise, await_all
throws a civis_timeout_error
if all jobs fail to
reach a success state within the time limit.
These errors can be caught using try
or tryCatch
.
Useful debugging information can be returned using get_error
and fetch_logs
.
The set of possible states for jobs on Civis platform are:
"succeeded"
, "success"
, "failed"
, "queued"
, "running"
,
and "cancelled"
.
Unless .interval
is specified, retries are attempted with exponentially increasing intervals using
.25 * (1.2^i)) + runif(1, 0, .2)
, where i
is the index of the current retry.
Approximate intervals for a given number of retries are as follows:
1-5: .5s
6-10: 1-5s
11-19: 5-10s
20-29: 10s - 1m