WherobotsJob
from_run_id to attach to an existing run for read-only
log/metrics access without binding a script.
Initialize a Wherobots Job.
Parameters
Path to Python script (.py) or JAR file (.jar).
Can be local path or S3 URI (s3://bucket/key)
The compute runtime to use. Accepts a
Runtime enum
value or a raw string; strings are passed to the API as-is.
Override the default runtime set for your organization — only
set this if you need a specific runtime instead of the one your
administrator has configured. When omitted, your organization’s
default runtime is used.The compute region to run in. Accepts a
Region enum
value or a raw string (e.g. a BYOC region such as
byoc-acme-us-east-1); strings are passed to the API as-is.
Override the default region set for your organization — only set
this if you intend to use a specific region instead of the one
your administrator has configured. When omitted, your
organization’s default region is used.Runtime version, such as “latest” or “preview”. When
omitted, your organization’s preset decides.
Optional list of PyPI or file dependencies
Upstream
X-Wherobots-Client chain for tools
that embed this SDK. The SDK appends its own hop to the
right of it so the originating client stays leftmost.
Advisory only — it never affects authentication.Raises
WherobotsValidationError: If script is None/empty, disk sizes are negative, or jar_main_class is missing for JARs.
add_file_dependency()
s3:// URI (used as-is) or a local file
path. Local paths are uploaded lazily at submit() time,
and auto-upload always targets managed storage.
Need to upload to a Storage Integration (or a custom subdir)?
Use wherobots.FilesAPI directly to upload, then pass
the resulting s3:// URI here. Keeps this method focused
on dependency declaration; FilesAPI owns “where files
go.”
Parameters
Returns
Raises
WherobotsValidationError: If the extension is not one of.jar/.whl/.zip/.json.
add_pypi_dependency()
Parameters
Returns
cancel()
Returns
close()
from_run_id()
run_id. The returned instance is read-only:
submit will raise. All other read methods (get_logs,
iter_logs, poll_for_logs, get_metrics,
get_cpu_utilization, get_mem_utilization, get_status,
cancel, wait_for_completion) work normally.
Parameters
Upstream
X-Wherobots-Client chain for tools
that embed this SDK. The SDK appends its own hop to the
right of it so the originating client stays leftmost.Returns
A
WherobotsJob bound to run_id with descriptive
fields (name, runtime, status, …) hydrated from the API.Raises
WherobotsValidationError: If run_id is empty.WherobotsAPIError: If the initial refresh fails.
get_consumed_spatial_units()
Returns
get_cost()
Returns
Cost in USD (e.g.
16.90), or None if the server did
not surface a cost for this run (typical for runs that are
still running or have not yet been billed).get_cpu_utilization()
Returns
UtilizationStats with latest/max/avg/series.
All fields are None/empty when the CPU metric is absent
from the server response.get_logs()
Parameters
Epoch-nanosecond timestamp to read from, inclusive, such
as
LogsResponse.next_page. Omit to start at the beginning.Returns
get_mem_utilization()
Returns
UtilizationStats with latest/max/avg/series.
All fields are None/empty when the memory metric is
absent from the server response.get_metrics()
Returns
get_status()
Returns
iter_logs()
Parameters
Hard ceiling on pages fetched, to guard against a
buggy server that always returns a distinct
next_page cursor. Defaults to 10_000.Raises
WherobotsJobError: If the page ceiling is hit.
list_runs()
Parameters
Filter runs created after this time, as a
datetime or an ISO timestamp stringReturns
poll_for_logs()
Parameters
Max consecutive transient errors before giving up
(default: 10). Non-transient errors (4xx except 429)
are raised immediately.
Internal. Monotonic clock deadline for timeout
enforcement. Callers should use
wait_for_completion(max_wait_seconds=...) instead.Raises
WherobotsJobError: If the job has not been submitted.WherobotsTimeoutError: If _deadline is set and exceeded.WherobotsAPIError: On non-transient HTTP errors.
refresh()
status, name, runtime, region, and
version in place. Works in both attached and submitted modes.
Returns
Raises
WherobotsJobError: Ifrun_idis not set.
submit()
Returns
wait_for_completion()
Parameters
Maximum time to wait before raising
WherobotsTimeoutError. None means wait
indefinitely (default: None).Returns
Raises
WherobotsTimeoutError: If max_wait_seconds is exceeded.

