Skip to main content

Python SDK for anycloud — submit jobs, run workloads on any cloud

Project description

anycloud Python SDK

Submit jobs, run workloads on any cloud.

Install

pip install anycloud-sdk

For the latest pre-release version:

pip install --pre anycloud-sdk

Quick start

import anycloud

ac = anycloud.Client()

job = ac.submit("my-training:latest", gpu="h100:8", env={"LR": "0.01"})
job.wait()
print(job.logs())

Chaining jobs

prep = ac.submit("prep:latest")
prep.wait()

train = ac.submit("train:latest", gpu="h100:8", env={"LR": "0.01"})
train.wait()

eval_job = ac.submit("eval:latest")
eval_job.wait()

Fan-out / fan-in

from anycloud import Submission

split = ac.submit("split:latest")
split.wait()

shards = ac.submit_many([
    Submission(image="worker:latest", env={"LR": lr})
    for lr in ["0.1", "0.01", "0.001"]
])
shards.wait()

merge = ac.submit("merge:latest")
merge.wait()

Decorator (run a Python function remotely)

Skip the image-build loop — decorate a function, and AnyCloud clones your repo on the remote VM:

@anycloud.function(image="ghcr.io/acme/trainer:latest", gpu="h100:8")
def train(lr: float):
    ...

jobs = train.map([0.1, 0.01, 0.001])  # fan out across args
jobs.wait()

Requires your code in a git repo (committed + pushed) and git installed in the image. See reference.

When a remote function fails, JobFailedError.logs includes the labeled bootstrap error:

from anycloud import JobFailedError

try:
    train.submit(0.01).wait()
except JobFailedError as e:
    print(e.state, e.logs)

Buckets

Chain data between jobs using bucket handles. Output buckets are auto-created by the server; upload() auto-creates input buckets.

data  = ac.bucket("training-data")
model = ac.bucket("model-output")

data.upload("~/datasets/imagenet")  # auto-creates bucket

prep  = ac.submit("prep:latest", input=data, output=model)
prep.wait()

train = ac.submit("train:latest", input=model, output=model, gpu="h100:8")
train.wait()

model.download("~/checkpoints/")

Bucket I/O streams through the local anycloud api server using a credential registered with anycloud credentials new — no extra installs needed. Use Client(credentials="<name>") so the SDK knows which credential to pass.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anycloud_sdk-0.1.26.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anycloud_sdk-0.1.26-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file anycloud_sdk-0.1.26.tar.gz.

File metadata

  • Download URL: anycloud_sdk-0.1.26.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anycloud_sdk-0.1.26.tar.gz
Algorithm Hash digest
SHA256 7f8a770d100b46ca8a24d90fc5d42fdca248857d8855e7dfb1db5d8f35b10aaa
MD5 adba4fcb36ce7d89726e25035dc832c3
BLAKE2b-256 517135af17338124b1e4415a224b11898ab6d3db418b8798bcb9ddaab9021c1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for anycloud_sdk-0.1.26.tar.gz:

Publisher: promote.yml on anycloud-sh/anycloud

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anycloud_sdk-0.1.26-py3-none-any.whl.

File metadata

  • Download URL: anycloud_sdk-0.1.26-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anycloud_sdk-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9f0103a4caea42da7fc127066f4ee382413958a21f41615db2a7c28abca035
MD5 5f5f6ab4cb7814c2f28260cece463f1e
BLAKE2b-256 c22aae803e95d6658c56f40bd0c91a101358467fddcbe3651a33d5548c76c615

See more details on using hashes here.

Provenance

The following attestation bundles were made for anycloud_sdk-0.1.26-py3-none-any.whl:

Publisher: promote.yml on anycloud-sh/anycloud

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page