Skip to main content

Solti Python SDK

Python SDK for the Solti Platform — schedule and run asynchronous workloads without managing infrastructure.

Package: solti-sdk · Import: solti · License: MIT

Installation

Using uv:

uv add solti-sdk

Using pip:

pip install solti-sdk

The package is published on PyPI. Prefer pip/uv's default index — no extra index URLs or credentials are needed.

Quickstart

from solti import SoltiClient
from solti.exceptions import WorkloadFailedError, TimeoutError

# api_key falls back to the SOLTI_API_KEY environment variable.
# Project selection uses the X-Solti-Project-Id header (project_id arg or SOLTI_PROJECT_ID env).
client = SoltiClient(api_key="eyJhbGciOi...", api_url="https://api.solti.run/1", project_id="proj-...")

# 1. Define and submit the workload
job = client.jobs.create(
    name="pytorch-train-epoch-50",       # or name_prefix="train-epoch-"
    image="pytorch/pytorch:2.2.1-cuda12.1-cudnn8-runtime",
    command=["python3"],
    args=["train.py", "--epochs", "50"],
    env={"TORCH_OMP_NUM_THREADS": "8"},
    volumes={                            # map keyed by volume name
        "datasets": {
            "bucket": "ml-training-artifacts",
            "mountPath": "/mnt/s3",
            "connection": "my-aws-s3",   # optional
            "prefix": "checkpoints",     # optional
        }
    },
    resources={"cpu": 8, "memory": "32Gi", "gpu": "24Gi"},  # gpu shorthand for {"vram": "24Gi"}
    cloud=["aws", "gcp"],
    region="americas",
    max_retries=3,
    labels={"environment": "production", "team": "ml"},
    tags=["pytorch", "training"],
)

print(f"Submitted Job: {job.name} ({job.id}) — {job.status}")

try:
    # 2. Block and poll progress (default poll interval 10s)
    final_job = job.wait_until_complete(timeout_seconds=7200)
    print(f"Succeeded! Actual cost: ${final_job.actual_cost}")
except WorkloadFailedError as e:
    print(f"Workload failed with exit code {e.exit_code}\n{e.error_summary}")
except TimeoutError:
    client.jobs.cancel(job.id)

Connections, Cronjobs & Keys

client.connections.list()
client.connections.get("my-aws-s3")
client.connections.create(name="new-s3", type="aws", credentials={
    "access_key_id": "AKIA...", "secret_access_key": "wJal...", "region": "us-east-1",
})
client.connections.delete("old-connection")

cron = client.cronjobs.create(
    name="nightly-backup",
    cron_spec="0 2 * * *",               # UTC
    job_definition={"image": "alpine:latest", "command": ["echo", "backup complete"]},
)
client.cronjobs.get(cron.id)             # or client.cronjobs.get("nightly-backup")
client.cronjobs.patch("nightly-backup", is_active=False)
client.cronjobs.delete("nightly-backup")

client.keys.list()
client.keys.create(name="ci", role="editor")
client.keys.delete("ci")

Error handling

HTTP errors map to typed exceptions (solti.exceptions):

Exception HTTP Notes
AuthenticationError 401 Invalid or expired API key.
PermissionDeniedError 403 Key role lacks access (e.g. viewer on a write).
NotFoundError 404 Unknown job / connection / cronjob / key.
ConflictError 409 Duplicate resource name.
ValidationError 422 Malformed payload (invalid cron expression, bad volume, …).
RateLimitError 429 Exposes retry_after (seconds) and the X-RateLimit-* headers.
WorkloadFailedError — Raised by wait_until_complete; carries exit_code, error_summary, oom.
TimeoutError — Client-side wait timeout in wait_until_complete (also a builtin.TimeoutError).

All exceptions derive from SoltiError, which exposes status, payload and headers.

Rate-limit retry policy: idempotent reads (GET) auto-retry up to 2 times honoring the Retry-After header (default 5s, capped at 30s). Mutations surface RateLimitError to the caller immediately.

Host strategy

The SDK targets the global API host (https://api.solti.run/1) and selects the project via the X-Solti-Project-Id header.

License

MIT — see LICENSE.

Development

uv sync
uv run pytest
uv run ruff check .
uv build

Metadata

Release files for solti-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solti-sdk 0.2.0
File Size Uploaded Provenance Actions
solti_sdk-0.2.0.tar.gz 27.8 kB Without provenance Details for solti_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for solti-sdk 0.2.0
File Interpreter ABI Platform Actions
solti_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for solti_sdk-0.2.0-py3-none-any.whl

Total release size: 48.9 kB

Release files / solti_sdk-0.2.0.tar.gz

Download URL solti_sdk-0.2.0.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
60788e40e09f6ee2160f392034ea895a98ce3a514bf2ddcfda4fe9fef0a0224b
BLAKE2b-256 checksum
How to use checksums
d09ab7f6c183447cd7ca9830aad99551c878ed2d1cac4f854f27f26f71886372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / solti_sdk-0.2.0-py3-none-any.whl

Download URL solti_sdk-0.2.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c86a5f51a919eb1aca1f150f15082af3a6dede7fe08088cfe18381ead2cb98c9
BLAKE2b-256 checksum
How to use checksums
79b08353150e93497cc19e14620e47792bd5a653813925d6536d01d8b5114645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for solti-sdk 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page