wherobots-python-sdk 0.7.1__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wherobots_python_sdk-0.7.1/wherobots_python_sdk.egg-info → wherobots_python_sdk-0.8.0}/PKG-INFO +59 -57
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/README.md +58 -56
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/pyproject.toml +10 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_api.py +72 -42
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_base_client.py +91 -160
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_client.py +241 -75
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_config.py +2 -2
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_enums.py +3 -2
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_files_api.py +46 -54
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_files_drive.py +62 -59
- wherobots_python_sdk-0.8.0/tests/test_live_contract.py +64 -0
- wherobots_python_sdk-0.8.0/tests/test_models.py +271 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_regressions.py +12 -75
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_security.py +48 -129
- wherobots_python_sdk-0.8.0/tests/test_spec_contract.py +80 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_tasks.py +31 -24
- wherobots_python_sdk-0.8.0/tests/test_wire.py +149 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/__version__.py +1 -1
- wherobots_python_sdk-0.8.0/wherobots/_wire.py +212 -0
- wherobots_python_sdk-0.8.0/wherobots/api/_operations.py +317 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/base.py +49 -79
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/drive.py +59 -53
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/files.py +17 -37
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/runs.py +55 -93
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/tasks.py +27 -48
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/client.py +151 -162
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/config.py +3 -3
- wherobots_python_sdk-0.8.0/wherobots/enums/__init__.py +43 -0
- wherobots_python_sdk-0.8.0/wherobots/enums/_generated.py +154 -0
- wherobots_python_sdk-0.8.0/wherobots/enums/_handwritten.py +103 -0
- wherobots_python_sdk-0.8.0/wherobots/models/__init__.py +106 -0
- wherobots_python_sdk-0.8.0/wherobots/models/_generated.py +790 -0
- wherobots_python_sdk-0.8.0/wherobots/models/_handwritten.py +355 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0/wherobots_python_sdk.egg-info}/PKG-INFO +59 -57
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/SOURCES.txt +11 -2
- wherobots_python_sdk-0.7.1/tests/test_models.py +0 -1043
- wherobots_python_sdk-0.7.1/wherobots/enums.py +0 -183
- wherobots_python_sdk-0.7.1/wherobots/models.py +0 -1820
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/LICENSE +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/setup.cfg +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_client_header.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_exceptions.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_init_exports.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_integration.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_logger.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_utils.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/tests/test_workload_auth.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/__init__.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/__init__.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/api/workload_auth.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/exceptions.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/py.typed +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/sdk.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/utils/__init__.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/utils/client_header.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/utils/logger.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots/utils/validation.py +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/dependency_links.txt +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/requires.txt +0 -0
- {wherobots_python_sdk-0.7.1 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/top_level.txt +0 -0
{wherobots_python_sdk-0.7.1/wherobots_python_sdk.egg-info → wherobots_python_sdk-0.8.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wherobots-python-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Python SDK for Wherobots (currently covers the Jobs REST API)
|
|
5
5
|
Author-email: Wherobots <support@wherobots.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -134,7 +134,7 @@ job = WherobotsJob(script="s3://bucket/script.py", name="my-job-001")
|
|
|
134
134
|
| `WHEROBOTS_API_KEY` | API key | *(required outside Wherobots)* |
|
|
135
135
|
| `WHEROBOTS_REGION` | Region override (else org default) | *(none — org default)* |
|
|
136
136
|
| `WHEROBOTS_API_BASE_URL` | API base URL | `https://api.cloud.wherobots.com` |
|
|
137
|
-
| `WHEROBOTS_VERSION` |
|
|
137
|
+
| `WHEROBOTS_VERSION` | Runtime version | *(none, the org preset decides)* |
|
|
138
138
|
| `WHEROBOTS_REQUEST_TIMEOUT_SECONDS`| HTTP request timeout (seconds) | `30` |
|
|
139
139
|
| `WHEROBOTS_CLIENT_CHAIN` | Upstream client-attribution chain (see below) | *(none)* |
|
|
140
140
|
| `WHEROBOTS_ID_TOKEN_PATH` | Workload identity token, set by Wherobots notebooks and jobs | *(none)* |
|
|
@@ -165,7 +165,7 @@ config = WherobotsConfig(
|
|
|
165
165
|
| `api_key` | `str \| None` | `None` (read from env) |
|
|
166
166
|
| `region` | `str \| None` | `None` |
|
|
167
167
|
| `base_url` | `str` | `"https://api.cloud.wherobots.com"` |
|
|
168
|
-
| `version` | `str`
|
|
168
|
+
| `version` | `str \| None` | `None` (org preset) |
|
|
169
169
|
| `request_timeout_seconds` | `int` | `30` |
|
|
170
170
|
| `client_chain` | `str \| None` | `None` |
|
|
171
171
|
|
|
@@ -212,11 +212,11 @@ WherobotsJob(
|
|
|
212
212
|
runtime: str | Runtime | None = None, # Compute size (None -> org default)
|
|
213
213
|
region: str | Region | None = None, # Region; str passed as-is (None -> org default)
|
|
214
214
|
api_key: str | None = None, # API key (or env var)
|
|
215
|
-
version: str | None = None, # "latest" | "preview"
|
|
215
|
+
version: str | None = None, # "latest" | "preview" (None -> org preset)
|
|
216
216
|
timeout_seconds: int = 3600, # Job timeout
|
|
217
217
|
args: list[str] | None = None, # Script arguments
|
|
218
218
|
spark_configs: dict[str, str] | None = None, # Spark config overrides
|
|
219
|
-
dependencies: list[
|
|
219
|
+
dependencies: list[PyPiDependency | FileDependency] | None = None,
|
|
220
220
|
spark_driver_disk_gb: int | None = None, # Driver disk size (GB)
|
|
221
221
|
spark_executor_disk_gb: int | None = None, # Executor disk size (GB)
|
|
222
222
|
jar_main_class: str | None = None, # Main class (required for JARs)
|
|
@@ -234,14 +234,14 @@ WherobotsJob(
|
|
|
234
234
|
|--------|---------|-------------|
|
|
235
235
|
| `submit()` | `str` | Submit the job. Returns the run ID. Idempotent (returns existing ID if already submitted). |
|
|
236
236
|
| `get_status()` | `RunView` | Get current job status and full details. |
|
|
237
|
-
| `get_logs(cursor=
|
|
237
|
+
| `get_logs(cursor=None, size=100)` | `LogsResponse` | Fetch a page of log entries. The cursor is an opaque string from `next_page`. |
|
|
238
238
|
| `get_metrics()` | `RunMetricsResponse` | Fetch CPU/memory metrics for the run. |
|
|
239
239
|
| `get_cpu_utilization()` | `UtilizationStats` | Aggregated CPU utilization (`latest`, `max`, `avg`, `series`). |
|
|
240
240
|
| `get_mem_utilization()` | `UtilizationStats` | Aggregated memory utilization (`latest`, `max`, `avg`, `series`). |
|
|
241
241
|
| `get_cost()` | `float \| None` | Total run cost in USD, or `None` if not yet billed. |
|
|
242
242
|
| `get_consumed_spatial_units()` | `float \| None` | Spatial Units (SUs) consumed by the run. |
|
|
243
243
|
| `refresh()` | `RunView` | Re-fetch from the API and update `status`/`name`/`runtime`/`region`/`version` in place. |
|
|
244
|
-
| `iter_logs(cursor=
|
|
244
|
+
| `iter_logs(cursor=None, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
|
|
245
245
|
| `poll_for_logs(follow=True, interval=2.0, log_handler=None, max_errors=10)` | `None` | Poll and print logs. If `follow=True`, continues until job completes. `max_errors` sets the max consecutive transient errors before giving up. |
|
|
246
246
|
| `cancel()` | `bool` | Request cancellation. Returns `True` on success. |
|
|
247
247
|
| `wait_for_completion(poll_interval=5.0, stream_logs=True, log_interval=2.0, max_wait_seconds=None)` | `JobStatus` | Block until the job reaches a terminal state. Set `max_wait_seconds` to limit wait time (raises `WherobotsTimeoutError`). |
|
|
@@ -268,8 +268,8 @@ with WherobotsJob(script="s3://bucket/script.py", name="my-job") as job:
|
|
|
268
268
|
|--------|---------|-------------|
|
|
269
269
|
| `from_run_id(run_id, api_key=None, ...)` | `WherobotsJob` | Attach to an existing run for read-only log/metric access. No script required. `submit()` is disabled on the returned instance. |
|
|
270
270
|
| `list_runs(...)` | `RunListPage` | List runs with optional filters. No instance required. |
|
|
271
|
-
| `add_pypi_dependency(
|
|
272
|
-
| `add_file_dependency(file_path)` | `
|
|
271
|
+
| `add_pypi_dependency(library_name, library_version=None)` | `PyPiDependency` | Create a PyPI dependency for the `dependencies` parameter. |
|
|
272
|
+
| `add_file_dependency(file_path)` | `FileDependency` | Create a file dependency (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
|
|
273
273
|
|
|
274
274
|
#### Attaching to an Existing Run
|
|
275
275
|
|
|
@@ -597,77 +597,79 @@ job = WherobotsJob(
|
|
|
597
597
|
|
|
598
598
|
## Models
|
|
599
599
|
|
|
600
|
-
|
|
601
|
-
for JSON
|
|
600
|
+
Models are generated from the Wherobots OpenAPI spec. They are frozen dataclasses built with
|
|
601
|
+
keyword arguments, with `from_dict()` and `to_dict()` for the API's JSON. A missing required field
|
|
602
|
+
or a wrong type raises `WherobotsAPIError`. Unknown fields are ignored, and an enum value newer than
|
|
603
|
+
the SDK still decodes, so `status.value` works for it.
|
|
602
604
|
|
|
603
605
|
### RunView
|
|
604
606
|
|
|
605
607
|
Returned by `get_status()` and `list_runs()`. Represents a single job run.
|
|
606
608
|
|
|
607
|
-
| Field
|
|
608
|
-
|
|
609
|
-
| `id`
|
|
610
|
-
| `name`
|
|
611
|
-
| `status`
|
|
612
|
-
| `
|
|
613
|
-
| `
|
|
614
|
-
| `
|
|
615
|
-
| `
|
|
616
|
-
| `
|
|
617
|
-
| `
|
|
618
|
-
| `
|
|
619
|
-
| `
|
|
620
|
-
| `
|
|
621
|
-
| `
|
|
622
|
-
| `
|
|
623
|
-
| `
|
|
624
|
-
| `
|
|
625
|
-
| `
|
|
626
|
-
| `
|
|
627
|
-
| `
|
|
609
|
+
| Field | Type | Description |
|
|
610
|
+
|-------------------|----------------------------|--------------------------------------------|
|
|
611
|
+
| `id` | `str` | Run ID |
|
|
612
|
+
| `name` | `str` | Job name |
|
|
613
|
+
| `status` | `JobStatus` | Current status |
|
|
614
|
+
| `is_terminal` | `bool` | The run has finished |
|
|
615
|
+
| `create_time` | `datetime` | Creation time |
|
|
616
|
+
| `update_time` | `datetime` | Last update time |
|
|
617
|
+
| `start_time` | `datetime \| None` | Start time |
|
|
618
|
+
| `complete_time` | `datetime \| None` | Completion time |
|
|
619
|
+
| `triggered_by` | `OrganizationCustomer` | User who triggered the run |
|
|
620
|
+
| `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
|
|
621
|
+
| `payload` | `RunPayload` | What the run was created with |
|
|
622
|
+
| `runtime` | `str \| None` | From `payload` |
|
|
623
|
+
| `version` | `str \| None` | From `payload` |
|
|
624
|
+
| `timeout_seconds` | `int` | From `payload` |
|
|
625
|
+
| `run_python` | `RunPythonPayload \| None` | From `payload` |
|
|
626
|
+
| `run_jar` | `RunJarPayload \| None` | From `payload` |
|
|
627
|
+
| `environment` | `ResolvedRunEnvironment \| None` | From `payload` |
|
|
628
|
+
| `region` | `str \| None` | From `kube_app` |
|
|
629
|
+
| `app_meta` | `RunAppMeta \| None` | Spark and Sedona UI URLs, from `kube_app` |
|
|
630
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
628
631
|
|
|
629
632
|
### LogsResponse
|
|
630
633
|
|
|
631
634
|
Returned by `get_logs()`.
|
|
632
635
|
|
|
633
|
-
| Field | Type
|
|
634
|
-
|
|
635
|
-
| `items` | `list[LogItem]`
|
|
636
|
-
| `next_page` | `
|
|
637
|
-
| `current_page` | `
|
|
636
|
+
| Field | Type | Description |
|
|
637
|
+
|----------------|-----------------|-----------------------------------------------|
|
|
638
|
+
| `items` | `list[LogItem]` | Log entries |
|
|
639
|
+
| `next_page` | `str \| None` | Next page cursor. `None` on a tail page |
|
|
640
|
+
| `current_page` | `str` | Current page cursor |
|
|
641
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
638
642
|
|
|
639
643
|
### LogItem
|
|
640
644
|
|
|
641
|
-
| Field | Type
|
|
642
|
-
|
|
643
|
-
| `raw` | `str`
|
|
644
|
-
| `timestamp` | `
|
|
645
|
-
| `level` | `str \| None` | Log level (INFO, ERROR, etc.) |
|
|
646
|
-
| `message` | `str \| None` | Parsed message |
|
|
647
|
-
| `extra` | `dict` | Additional fields |
|
|
645
|
+
| Field | Type | Description |
|
|
646
|
+
|-------------|-------|-----------------------------------|
|
|
647
|
+
| `raw` | `str` | Raw log line text |
|
|
648
|
+
| `timestamp` | `str` | Epoch nanoseconds, as a string |
|
|
648
649
|
|
|
649
650
|
### RunListPage
|
|
650
651
|
|
|
651
652
|
Returned by `list_runs()`.
|
|
652
653
|
|
|
653
|
-
| Field | Type
|
|
654
|
-
|
|
655
|
-
| `items` | `list[RunView]`
|
|
656
|
-
| `total` | `int`
|
|
657
|
-
| `next_page` | `str \| None`
|
|
658
|
-
| `previous_page` | `str \| None`
|
|
659
|
-
| `current_page` | `str \| None`
|
|
660
|
-
| `current_page_backwards` | `str \| None`
|
|
654
|
+
| Field | Type | Description |
|
|
655
|
+
|--------------------------|-----------------|-----------------------------------------|
|
|
656
|
+
| `items` | `list[RunView]` | Runs on this page |
|
|
657
|
+
| `total` | `int` | Total matching runs |
|
|
658
|
+
| `next_page` | `str \| None` | Next page cursor |
|
|
659
|
+
| `previous_page` | `str \| None` | Previous page cursor |
|
|
660
|
+
| `current_page` | `str \| None` | Current page cursor |
|
|
661
|
+
| `current_page_backwards` | `str \| None` | Backward pagination cursor |
|
|
662
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
661
663
|
|
|
662
664
|
### RunMetricsResponse
|
|
663
665
|
|
|
664
666
|
Returned by `get_metrics()`.
|
|
665
667
|
|
|
666
|
-
| Field | Type
|
|
667
|
-
|
|
668
|
-
| `series_metrics` | `dict`
|
|
669
|
-
| `instant_metrics` | `dict` | Point-in-time metrics
|
|
670
|
-
| `
|
|
668
|
+
| Field | Type | Description |
|
|
669
|
+
|-------------------|----------------------------------|-----------------------------------------|
|
|
670
|
+
| `series_metrics` | `dict[str, SeriesMetricDetails]` | Time-series metrics |
|
|
671
|
+
| `instant_metrics` | `dict[str, InstantMetricDetails]` | Point-in-time metrics |
|
|
672
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
671
673
|
|
|
672
674
|
## Exceptions
|
|
673
675
|
|
|
@@ -108,7 +108,7 @@ job = WherobotsJob(script="s3://bucket/script.py", name="my-job-001")
|
|
|
108
108
|
| `WHEROBOTS_API_KEY` | API key | *(required outside Wherobots)* |
|
|
109
109
|
| `WHEROBOTS_REGION` | Region override (else org default) | *(none — org default)* |
|
|
110
110
|
| `WHEROBOTS_API_BASE_URL` | API base URL | `https://api.cloud.wherobots.com` |
|
|
111
|
-
| `WHEROBOTS_VERSION` |
|
|
111
|
+
| `WHEROBOTS_VERSION` | Runtime version | *(none, the org preset decides)* |
|
|
112
112
|
| `WHEROBOTS_REQUEST_TIMEOUT_SECONDS`| HTTP request timeout (seconds) | `30` |
|
|
113
113
|
| `WHEROBOTS_CLIENT_CHAIN` | Upstream client-attribution chain (see below) | *(none)* |
|
|
114
114
|
| `WHEROBOTS_ID_TOKEN_PATH` | Workload identity token, set by Wherobots notebooks and jobs | *(none)* |
|
|
@@ -139,7 +139,7 @@ config = WherobotsConfig(
|
|
|
139
139
|
| `api_key` | `str \| None` | `None` (read from env) |
|
|
140
140
|
| `region` | `str \| None` | `None` |
|
|
141
141
|
| `base_url` | `str` | `"https://api.cloud.wherobots.com"` |
|
|
142
|
-
| `version` | `str`
|
|
142
|
+
| `version` | `str \| None` | `None` (org preset) |
|
|
143
143
|
| `request_timeout_seconds` | `int` | `30` |
|
|
144
144
|
| `client_chain` | `str \| None` | `None` |
|
|
145
145
|
|
|
@@ -186,11 +186,11 @@ WherobotsJob(
|
|
|
186
186
|
runtime: str | Runtime | None = None, # Compute size (None -> org default)
|
|
187
187
|
region: str | Region | None = None, # Region; str passed as-is (None -> org default)
|
|
188
188
|
api_key: str | None = None, # API key (or env var)
|
|
189
|
-
version: str | None = None, # "latest" | "preview"
|
|
189
|
+
version: str | None = None, # "latest" | "preview" (None -> org preset)
|
|
190
190
|
timeout_seconds: int = 3600, # Job timeout
|
|
191
191
|
args: list[str] | None = None, # Script arguments
|
|
192
192
|
spark_configs: dict[str, str] | None = None, # Spark config overrides
|
|
193
|
-
dependencies: list[
|
|
193
|
+
dependencies: list[PyPiDependency | FileDependency] | None = None,
|
|
194
194
|
spark_driver_disk_gb: int | None = None, # Driver disk size (GB)
|
|
195
195
|
spark_executor_disk_gb: int | None = None, # Executor disk size (GB)
|
|
196
196
|
jar_main_class: str | None = None, # Main class (required for JARs)
|
|
@@ -208,14 +208,14 @@ WherobotsJob(
|
|
|
208
208
|
|--------|---------|-------------|
|
|
209
209
|
| `submit()` | `str` | Submit the job. Returns the run ID. Idempotent (returns existing ID if already submitted). |
|
|
210
210
|
| `get_status()` | `RunView` | Get current job status and full details. |
|
|
211
|
-
| `get_logs(cursor=
|
|
211
|
+
| `get_logs(cursor=None, size=100)` | `LogsResponse` | Fetch a page of log entries. The cursor is an opaque string from `next_page`. |
|
|
212
212
|
| `get_metrics()` | `RunMetricsResponse` | Fetch CPU/memory metrics for the run. |
|
|
213
213
|
| `get_cpu_utilization()` | `UtilizationStats` | Aggregated CPU utilization (`latest`, `max`, `avg`, `series`). |
|
|
214
214
|
| `get_mem_utilization()` | `UtilizationStats` | Aggregated memory utilization (`latest`, `max`, `avg`, `series`). |
|
|
215
215
|
| `get_cost()` | `float \| None` | Total run cost in USD, or `None` if not yet billed. |
|
|
216
216
|
| `get_consumed_spatial_units()` | `float \| None` | Spatial Units (SUs) consumed by the run. |
|
|
217
217
|
| `refresh()` | `RunView` | Re-fetch from the API and update `status`/`name`/`runtime`/`region`/`version` in place. |
|
|
218
|
-
| `iter_logs(cursor=
|
|
218
|
+
| `iter_logs(cursor=None, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
|
|
219
219
|
| `poll_for_logs(follow=True, interval=2.0, log_handler=None, max_errors=10)` | `None` | Poll and print logs. If `follow=True`, continues until job completes. `max_errors` sets the max consecutive transient errors before giving up. |
|
|
220
220
|
| `cancel()` | `bool` | Request cancellation. Returns `True` on success. |
|
|
221
221
|
| `wait_for_completion(poll_interval=5.0, stream_logs=True, log_interval=2.0, max_wait_seconds=None)` | `JobStatus` | Block until the job reaches a terminal state. Set `max_wait_seconds` to limit wait time (raises `WherobotsTimeoutError`). |
|
|
@@ -242,8 +242,8 @@ with WherobotsJob(script="s3://bucket/script.py", name="my-job") as job:
|
|
|
242
242
|
|--------|---------|-------------|
|
|
243
243
|
| `from_run_id(run_id, api_key=None, ...)` | `WherobotsJob` | Attach to an existing run for read-only log/metric access. No script required. `submit()` is disabled on the returned instance. |
|
|
244
244
|
| `list_runs(...)` | `RunListPage` | List runs with optional filters. No instance required. |
|
|
245
|
-
| `add_pypi_dependency(
|
|
246
|
-
| `add_file_dependency(file_path)` | `
|
|
245
|
+
| `add_pypi_dependency(library_name, library_version=None)` | `PyPiDependency` | Create a PyPI dependency for the `dependencies` parameter. |
|
|
246
|
+
| `add_file_dependency(file_path)` | `FileDependency` | Create a file dependency (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
|
|
247
247
|
|
|
248
248
|
#### Attaching to an Existing Run
|
|
249
249
|
|
|
@@ -571,77 +571,79 @@ job = WherobotsJob(
|
|
|
571
571
|
|
|
572
572
|
## Models
|
|
573
573
|
|
|
574
|
-
|
|
575
|
-
for JSON
|
|
574
|
+
Models are generated from the Wherobots OpenAPI spec. They are frozen dataclasses built with
|
|
575
|
+
keyword arguments, with `from_dict()` and `to_dict()` for the API's JSON. A missing required field
|
|
576
|
+
or a wrong type raises `WherobotsAPIError`. Unknown fields are ignored, and an enum value newer than
|
|
577
|
+
the SDK still decodes, so `status.value` works for it.
|
|
576
578
|
|
|
577
579
|
### RunView
|
|
578
580
|
|
|
579
581
|
Returned by `get_status()` and `list_runs()`. Represents a single job run.
|
|
580
582
|
|
|
581
|
-
| Field
|
|
582
|
-
|
|
583
|
-
| `id`
|
|
584
|
-
| `name`
|
|
585
|
-
| `status`
|
|
586
|
-
| `
|
|
587
|
-
| `
|
|
588
|
-
| `
|
|
589
|
-
| `
|
|
590
|
-
| `
|
|
591
|
-
| `
|
|
592
|
-
| `
|
|
593
|
-
| `
|
|
594
|
-
| `
|
|
595
|
-
| `
|
|
596
|
-
| `
|
|
597
|
-
| `
|
|
598
|
-
| `
|
|
599
|
-
| `
|
|
600
|
-
| `
|
|
601
|
-
| `
|
|
583
|
+
| Field | Type | Description |
|
|
584
|
+
|-------------------|----------------------------|--------------------------------------------|
|
|
585
|
+
| `id` | `str` | Run ID |
|
|
586
|
+
| `name` | `str` | Job name |
|
|
587
|
+
| `status` | `JobStatus` | Current status |
|
|
588
|
+
| `is_terminal` | `bool` | The run has finished |
|
|
589
|
+
| `create_time` | `datetime` | Creation time |
|
|
590
|
+
| `update_time` | `datetime` | Last update time |
|
|
591
|
+
| `start_time` | `datetime \| None` | Start time |
|
|
592
|
+
| `complete_time` | `datetime \| None` | Completion time |
|
|
593
|
+
| `triggered_by` | `OrganizationCustomer` | User who triggered the run |
|
|
594
|
+
| `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
|
|
595
|
+
| `payload` | `RunPayload` | What the run was created with |
|
|
596
|
+
| `runtime` | `str \| None` | From `payload` |
|
|
597
|
+
| `version` | `str \| None` | From `payload` |
|
|
598
|
+
| `timeout_seconds` | `int` | From `payload` |
|
|
599
|
+
| `run_python` | `RunPythonPayload \| None` | From `payload` |
|
|
600
|
+
| `run_jar` | `RunJarPayload \| None` | From `payload` |
|
|
601
|
+
| `environment` | `ResolvedRunEnvironment \| None` | From `payload` |
|
|
602
|
+
| `region` | `str \| None` | From `kube_app` |
|
|
603
|
+
| `app_meta` | `RunAppMeta \| None` | Spark and Sedona UI URLs, from `kube_app` |
|
|
604
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
602
605
|
|
|
603
606
|
### LogsResponse
|
|
604
607
|
|
|
605
608
|
Returned by `get_logs()`.
|
|
606
609
|
|
|
607
|
-
| Field | Type
|
|
608
|
-
|
|
609
|
-
| `items` | `list[LogItem]`
|
|
610
|
-
| `next_page` | `
|
|
611
|
-
| `current_page` | `
|
|
610
|
+
| Field | Type | Description |
|
|
611
|
+
|----------------|-----------------|-----------------------------------------------|
|
|
612
|
+
| `items` | `list[LogItem]` | Log entries |
|
|
613
|
+
| `next_page` | `str \| None` | Next page cursor. `None` on a tail page |
|
|
614
|
+
| `current_page` | `str` | Current page cursor |
|
|
615
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
612
616
|
|
|
613
617
|
### LogItem
|
|
614
618
|
|
|
615
|
-
| Field | Type
|
|
616
|
-
|
|
617
|
-
| `raw` | `str`
|
|
618
|
-
| `timestamp` | `
|
|
619
|
-
| `level` | `str \| None` | Log level (INFO, ERROR, etc.) |
|
|
620
|
-
| `message` | `str \| None` | Parsed message |
|
|
621
|
-
| `extra` | `dict` | Additional fields |
|
|
619
|
+
| Field | Type | Description |
|
|
620
|
+
|-------------|-------|-----------------------------------|
|
|
621
|
+
| `raw` | `str` | Raw log line text |
|
|
622
|
+
| `timestamp` | `str` | Epoch nanoseconds, as a string |
|
|
622
623
|
|
|
623
624
|
### RunListPage
|
|
624
625
|
|
|
625
626
|
Returned by `list_runs()`.
|
|
626
627
|
|
|
627
|
-
| Field | Type
|
|
628
|
-
|
|
629
|
-
| `items` | `list[RunView]`
|
|
630
|
-
| `total` | `int`
|
|
631
|
-
| `next_page` | `str \| None`
|
|
632
|
-
| `previous_page` | `str \| None`
|
|
633
|
-
| `current_page` | `str \| None`
|
|
634
|
-
| `current_page_backwards` | `str \| None`
|
|
628
|
+
| Field | Type | Description |
|
|
629
|
+
|--------------------------|-----------------|-----------------------------------------|
|
|
630
|
+
| `items` | `list[RunView]` | Runs on this page |
|
|
631
|
+
| `total` | `int` | Total matching runs |
|
|
632
|
+
| `next_page` | `str \| None` | Next page cursor |
|
|
633
|
+
| `previous_page` | `str \| None` | Previous page cursor |
|
|
634
|
+
| `current_page` | `str \| None` | Current page cursor |
|
|
635
|
+
| `current_page_backwards` | `str \| None` | Backward pagination cursor |
|
|
636
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
635
637
|
|
|
636
638
|
### RunMetricsResponse
|
|
637
639
|
|
|
638
640
|
Returned by `get_metrics()`.
|
|
639
641
|
|
|
640
|
-
| Field | Type
|
|
641
|
-
|
|
642
|
-
| `series_metrics` | `dict`
|
|
643
|
-
| `instant_metrics` | `dict` | Point-in-time metrics
|
|
644
|
-
| `
|
|
642
|
+
| Field | Type | Description |
|
|
643
|
+
|-------------------|----------------------------------|-----------------------------------------|
|
|
644
|
+
| `series_metrics` | `dict[str, SeriesMetricDetails]` | Time-series metrics |
|
|
645
|
+
| `instant_metrics` | `dict[str, InstantMetricDetails]` | Point-in-time metrics |
|
|
646
|
+
| `raw` | `dict` | The response body as the server sent it |
|
|
645
647
|
|
|
646
648
|
## Exceptions
|
|
647
649
|
|
|
@@ -37,6 +37,7 @@ Documentation = "https://docs.wherobots.com"
|
|
|
37
37
|
# PEP 735 dev dependencies — installed with `uv sync --group dev`.
|
|
38
38
|
[dependency-groups]
|
|
39
39
|
dev = [
|
|
40
|
+
"jsonschema>=4.23",
|
|
40
41
|
"pytest==9.1.1",
|
|
41
42
|
"pytest-cov==7.1.0",
|
|
42
43
|
"pytest-mock==3.17.0",
|
|
@@ -97,6 +98,14 @@ extend-ignore = ["SIM117", "EM101", "EM102", "TRY003", "PLR0917"]
|
|
|
97
98
|
# Package __init__ groups exports by category with comment headers;
|
|
98
99
|
# don't let ruff re-sort them alphabetically.
|
|
99
100
|
"wherobots/__init__.py" = ["RUF022"]
|
|
101
|
+
# Generated from the spec: names and docstrings are the API's, and the annotations
|
|
102
|
+
# are evaluated at runtime by the wire decoder.
|
|
103
|
+
"wherobots/models/_generated.py" = ["A", "D", "E501", "FBT", "TC"]
|
|
104
|
+
"wherobots/enums/_generated.py" = ["D", "E501"]
|
|
105
|
+
"wherobots/api/_operations.py" = ["A", "D", "E501", "FBT", "PLR0913", "TC"]
|
|
106
|
+
"wherobots/{enums,models}/__init__.py" = ["D", "RUF022"]
|
|
107
|
+
# Dev tools rather than package code.
|
|
108
|
+
"scripts/*.py" = ["D", "INP001", "PLR0911", "S310", "S603", "S607", "T201"]
|
|
100
109
|
|
|
101
110
|
[tool.pyrefly]
|
|
102
111
|
project-includes = ["wherobots"]
|
|
@@ -112,4 +121,5 @@ python_functions = ["test_*"]
|
|
|
112
121
|
addopts = ["--cov=wherobots", "--cov-report=html", "--cov-report=term-missing", "-m", "not integration"]
|
|
113
122
|
markers = [
|
|
114
123
|
"integration: live API tests requiring WHEROBOTS_API_KEY (deselected by default)",
|
|
124
|
+
"off_contract: feeds a response the spec forbids, so skip the spec_contract fixture",
|
|
115
125
|
]
|