Skip to main content

Jobs and results

The examples use the shared client:

Inspect and control jobs

list_jobs

Returns all jobs for the current API key as list[dict], or None if the request fails.

get_job_status

Returns the status string, or None if the request fails.

attach

Streams progress for an active job and returns None. It exits immediately if the job is missing or already terminal.

cancel_job

Requests asynchronous cancellation and returns the API response dictionary, or None if the request fails.

get_quotas

Returns row and token quota records by priority as list[dict], or None if the request fails.

Wait for completion

Polls every five seconds. It returns a Polars DataFrame only after SUCCEEDED when obtain_results=True; otherwise it returns None. output_column names the result column. is_cost_estimate is accepted for compatibility but does not change the current polling behavior. Check get_job_status() to distinguish a failure, cancellation, timeout, or intentionally omitted results.

Materialize manageable results

Results are Polars by default and match the type of with_original_df when provided. User ID columns and confidence_score are preserved. Structured JSON is unpacked into columns by default; set unpack_json=False to retain the raw output. Results are cached under ~/.sutro/job-results unless disabled.

Get a download URL

Returns a dictionary containing artifact metadata and presigned urls.get and urls.head, or None if the request fails. The job must be SUCCEEDED. URLs may live for 1–604800 seconds, are temporary credentials, and must be used without the Sutro authorization header.

Download large results

Returns the local Parquet path, or None on failure. output_path may be a directory or complete filename; by default it uses the artifact filename in the current directory. Interrupted downloads resume from a .part file when resume=True and the artifact ETag still matches. Otherwise the download restarts.