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",        # shorthand for {"vram": "24Gi"}
        "storage": "100Gi",   # boot disk override (GiB int or Gi/Mi string); default: AWS 8 / GCP 10 / Azure 30
    },
    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.3.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.3.0
File Size Uploaded Provenance Actions
solti_sdk-0.3.0.tar.gz 28.7 kB Without provenance Details for solti_sdk-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 50.0 kB

Release files / solti_sdk-0.3.0.tar.gz

Download URL solti_sdk-0.3.0.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8e669c1fbb6584d04e2d8dc3b496910c6a5b9e3221814fc581d7618f5c35d05f
BLAKE2b-256 checksum
How to use checksums
2ca904c62a9c4f2c0aaa1549d15fe6d0ad77c5f01bbe718c41ae17efdf35eb09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL solti_sdk-0.3.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
851c7ad52aefa04b0c1f633111b80e4ad3ba5aa0d725c48005bf5e4d80f495fd
BLAKE2b-256 checksum
How to use checksums
cc382d673c01a9b24cfd7dab00324408ddb8f434a25daae3e1fb62cdb7cd057f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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