OOMOL Cloud Task SDK (Python)
Python SDK for OOMOL Cloud Task API v3.
Features
- Supports
serverlesstask creation - Covers the same user-facing task APIs as the TypeScript SDK:
create_task,create_and_wait,list_tasks,get_latest_tasks,get_task,get_task_result,get_dashboard,set_tasks_pause,upload_file - Supports
pause_user_queue,resume_user_queue, andget_task_detailaliases - Retries transient polling failures in
await_resultuntil timeout or terminal status - Exposes aligned error types:
ApiError,RunTaskError,TaskFailedError,TimeoutError,UploadError - Exports aligned public typing helpers such as
AwaitOptions,BackoffOptions,ClientOptions,UploadOptions, andTaskTerminalStatus
Installation
pip install oomol-cloud-task-sdk
Requirements
- Python
>=3.7 requests>=2.25.0typing_extensions>=4.0.0on Python 3.7
Authentication
api_key is optional.
- Token auth: pass
api_key, the client sendsAuthorization: Bearer <api_key> - Cookie auth: omit
api_keyand use the underlyingrequests.Sessioncookies
from oomol_cloud_task import OomolTaskClient
client = OomolTaskClient(
api_key=None,
default_headers={"x-client": "my-app"},
)
Quick Start
from oomol_cloud_task import BackoffStrategy, OomolTaskClient
client = OomolTaskClient(api_key="YOUR_API_KEY")
response = client.create_and_wait(
{
"packageName": "@oomol/my-package",
"packageVersion": "1.0.0",
"blockName": "main",
"inputValues": {"text": "hello"},
},
interval_ms=2000,
timeout_ms=10 * 60 * 1000,
backoff_strategy=BackoffStrategy.EXPONENTIAL,
max_interval_ms=10000,
on_progress=lambda progress, status: print("progress:", progress, "status:", status),
)
print("taskID:", response.taskID)
if response.result["status"] == "success":
print("resultURL:", response.result.get("resultURL"))
print("resultData:", response.result.get("resultData"))
API Overview
Available methods:
create_task(request)create_and_wait(request, interval_ms=3000, timeout_ms=None, backoff_strategy=BackoffStrategy.EXPONENTIAL, max_interval_ms=3000, on_progress=None)list_tasks(query=None)get_latest_tasks(workload_ids)get_task(task_id)/get_task_detail(task_id)get_task_result(task_id)await_result(task_id, interval_ms=3000, timeout_ms=None, backoff_strategy=BackoffStrategy.EXPONENTIAL, max_interval_ms=3000, on_progress=None)get_dashboard()set_tasks_pause(paused)pause_user_queue()resume_user_queue()upload_file(file, upload_base_url=..., retries=3, on_progress=None)
Common Examples
Create a task:
client.create_task(
{
"packageName": "@oomol/my-package",
"packageVersion": "1.0.0",
"blockName": "main",
"inputValues": {"foo": "bar"},
}
)
Query tasks:
page = client.list_tasks(
{
"size": 20,
"status": "running",
"taskType": "user",
}
)
latest = client.get_latest_tasks(
[
"550e8400-e29b-41d4-a716-446655440022",
"550e8400-e29b-41d4-a716-446655440023",
]
)
latest2 = client.get_latest_tasks(
"550e8400-e29b-41d4-a716-446655440022,550e8400-e29b-41d4-a716-446655440023"
)
detail = client.get_task("019234a5-b678-7def-8123-456789abcdef")
result = client.get_task_result("019234a5-b678-7def-8123-456789abcdef")
dashboard = client.get_dashboard()
Pause or resume the current user's queue:
client.pause_user_queue()
client.resume_user_queue()
client.set_tasks_pause(True)
client.set_tasks_pause(False)
Upload a file:
url = client.upload_file(
"/path/to/file.pdf",
retries=3,
on_progress=lambda progress: print("upload:", progress),
)
upload_file accepts either:
- a filesystem path
- a seekable binary file object
Polling Behavior
await_result and create_and_wait follow the same polling semantics as the TypeScript SDK:
- default polling interval is
3000ms BackoffStrategy.EXPONENTIALis the default- transient polling request failures are retried
- terminal task failure raises
TaskFailedError - timeout raises
TimeoutError
If polling times out after earlier request failures, the timeout message includes the most recent polling error.
Errors
from oomol_cloud_task import (
ApiError,
RunTaskErrorCode,
TaskFailedError,
TimeoutError,
UploadError,
)
try:
response = client.create_and_wait(
{
"packageName": "@oomol/my-package",
"packageVersion": "1.0.0",
"blockName": "main",
},
timeout_ms=60_000,
)
except TaskFailedError as err:
print(err.taskID, err.code, err.status_code, err.detail)
if err.code == RunTaskErrorCode.INSUFFICIENT_QUOTA:
print("insufficient quota")
except TimeoutError as err:
print("timeout:", err)
except UploadError as err:
print("upload error:", err.code, err.status_code, err)
except ApiError as err:
print("api error:", err.status, err.body)
License
MIT
Metadata
Release files for oomol-cloud-task-sdk 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oomol_cloud_task_sdk-1.1.0.tar.gz | 13.5 kB | Without provenance | Details for oomol_cloud_task_sdk-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oomol_cloud_task_sdk-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for oomol_cloud_task_sdk-1.1.0-py3-none-any.whl |
Total release size: 25.0 kB
Release files / oomol_cloud_task_sdk-1.1.0.tar.gz
| Download URL | oomol_cloud_task_sdk-1.1.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08df1c87bc0dfe8911cbc470bf9a5c68dc488230958a0b89aece9ac95f615789
|
|
BLAKE2b-256 checksum How to use checksums |
d9c8dc3d6cba971d71281720d5083969d0d66bd0bb88883ecf897d3dd0e1304a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Release files / oomol_cloud_task_sdk-1.1.0-py3-none-any.whl
| Download URL | oomol_cloud_task_sdk-1.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c1152052577d93176e52cabd34f4bb7e2aa3d54b95f9b358c93215cc4d4c752
|
|
BLAKE2b-256 checksum How to use checksums |
9e3c85c834b3300aac72be582f0b3dbd557cd04e9fe2147720952c0b95d6c35a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Security for oomol-cloud-task-sdk 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.