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.1.3

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.1.3
File Size Uploaded Provenance Actions
solti_sdk-0.1.3.tar.gz 22.2 kB Without provenance Details for solti_sdk-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 39.5 kB

Release files / solti_sdk-0.1.3.tar.gz

Download URL solti_sdk-0.1.3.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
967f92bdc2843535e1d2f4125e6eb3899b1ee21ffce5d6624b0c5d54d467c36a
BLAKE2b-256 checksum
How to use checksums
23645b35d8b2afab64ce52b3d3c826a38ed8fae26e19a8249c9d100b18f0c5b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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.1.3-py3-none-any.whl

Download URL solti_sdk-0.1.3-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa36bbc6ed3a4c1f58074e040fc36bb6d06059d4a1865ac87750a0b81d9413a5
BLAKE2b-256 checksum
How to use checksums
d5ca548727df24cec3736c3565bbaaf08fa47e2c5dcb6e737685e6db08165a83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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.1.3

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