fcloud
API Reference

API Overview

fcloud Python SDK reference.

Reference for the Python SDK's core objects. For the command-line interface, see the CLI Reference.

Client

The main entry point for the fcloud SDK.

import fcloud

client = fcloud.Client()
# or with explicit token
client = fcloud.Client(token="fcloud_sk_...")

Methods

MethodDescription
client.project(name, image=None)Get or create a project
client.attach_session(sid)Attach to an existing session by id
client.map(command, args=...)Fan a command out as a durable sweep (details)
client.list_volume_files(name)List files in a volume
client.read_volume_file(name, path)Read a volume file (returns bytes)
client.download_volume_file(name, path, local)Download a volume file
client.delete_volume(name)Delete a volume
client.health()Check dispatcher connectivity

Project

project = client.project("my-experiment")

Methods

MethodDescription
project.session(sku)Create a session (usable as a context manager)
project.job(command, sku=..., volume_mounts=..., include=..., retries=...)Run an ephemeral job (details)

Session

with project.session(sku="gpu_1x_a10g") as s:
    ...
# or manage the lifecycle yourself and call s.close()

Methods

MethodDescription
s.run(cmd)Run a command and wait for completion
s.spawn(cmd)Start a background process
s.watch(proc)Stream real-time output from a spawned process
s.logs(pid, output_range=..., stream=...)Fetch a process's durable log
s.upload(local, remote)Upload local files to the session
s.download(remote)Download a file from the session (returns bytes)
s.session_idThe session's id (s-...), usable from the CLI too
s.close()Close the session and release the GPU host

Process

Returned by s.spawn().

MemberDescription
proc.poll()Refresh status
proc.wait()Block until the process completes
proc.outputRead process output
proc.statusCurrent status (running, ...)
proc.exit_codeExit code once terminated

On this page