TaskRuns
Wherobots.task_runs; do not build it directly.
Parameters
cancel()
POST /task-runs/{id}/cancel).
The run moves to CANCELLING and then CANCELLED once the stop is
confirmed.
Parameters
Raises
WherobotsAPIError: On HTTP failures.
cost()
GET /task-runs/{id}/cost).
Parameters
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures, or a cost the SDK cannot read (rather than reporting it as zero).
get()
GET /task-runs/{id}).
Parameters
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.
list()
GET /task-runs).
Parameters
Only runs in this state, or in any of these states.
Only runs submitted after this instant; a naive
datetime is read as local time.Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.
logs()
GET /task-runs/{id}/logs).
Parameters
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.
wait_for_completion()
poll_interval apart and back off to 30
seconds apart (or poll_interval, if longer); state changes are logged at
INFO. Neither a timeout nor an interrupt cancels the run: it keeps going on the
server, and calling this again resumes the wait. Use cancel to stop it.
UNKNOWN is not treated as finished until the run has reported it for 10
minutes in a row, because the server also uses it while a run starts. A state
this SDK predates is never treated as finished; the wait logs a warning once and
keeps polling, so set max_wait_seconds to bound it.
When a run succeeds with its results briefly unavailable, it is fetched up to
three more times, within max_wait_seconds, before it is returned without
them. Script tasks never return results and are not refetched.
A status check that fails with a rate limit (429), a server error (5xx) or a
connection error is logged at WARNING and skipped, and the wait carries on;
only a check that succeeds can end it. Five such failures in a row raise the
last one. Other errors, such as a 404 or a response the SDK can’t decode, raise
at once.
Parameters
Stop waiting after this many seconds;
None waits as
long as the run takes. The last check can return just after the
deadline; if it finds the run finished, the run is returned rather than
a timeout, so a finished result is never thrown away.Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.WherobotsTaskRunError: The run did not succeed andraise_on_failureis set..runholds the finished run.WherobotsTaskRunTimeoutError:max_wait_secondspassed. The run keeps going;.runholds it as last fetched. AWherobotsTimeoutError.WherobotsValidationError:poll_intervalis not greater than zero.
Tasks
Wherobots.tasks; do not build it directly.
Parameters
Region new runs use when
run is given none; None lets the
API apply the organization’s default region.get()
GET /tasks/{name}).
Parameters
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.
list()
GET /tasks).
Parameters
Only tasks that can run in this region, or in any of these regions.
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.
run()
POST /tasks/{name}/runs).
Parameters
Region to run in; defaults to the configured region, then to
the organization’s default region.
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures, including inputs the task’s schema rejects.
run_and_wait()
run followed by TaskRuns.wait_for_completion; see those for the
arguments. Read a single-output task’s result with TaskRun.output. For other
wait options, call the two separately.
Parameters
Returns
Raises
WherobotsAPIError: On HTTP or JSON-parsing failures.WherobotsTaskRunError: The run did not succeed..runholds the finished run.WherobotsTaskRunTimeoutError:max_wait_secondspassed. The run keeps going;.runholds it as last fetched.

