Skip to main content

PrismaX Python SDK for data uploads

Project description

PrismaX Python SDK

Minimal upload SDK for PrismaX data uploads.

License

This SDK is source-available for noncommercial use under the PolyForm Noncommercial License 1.0.0. Commercial use is not permitted unless PrismaX grants a separate commercial license.

Quickstart

You need:

  • a PrismaX upload API key with the pxu_ prefix
  • a PrismaX task ID
  • the robot serial number for the machine that produced the data
pip install prismax
export PRISMAX_API_KEY="pxu_your_upload_api_key"

Download API keys are not valid for uploads.

import prismax

result = prismax.upload("./data", task_id=123, serial_number="robot_serial_number")
print(result["upload_id"])

The SDK scans the folder, creates an upload session, uploads raw files to signed Google Cloud URLs, generates episode manifests in memory, uploads manifests last, and returns the upload summary.

You can also pass the API key directly:

import prismax

result = prismax.upload(
    "./data",
    task_id=123,
    serial_number="robot_serial_number",
    api_key="pxu_your_upload_api_key",
)

Expected Folder Structure

data/
  1.mcap
  1/
    high.mp4
    left.mp4
    right.mp4
    high2.mp4
    left2.mp4
    right2.mp4

Each episode must contain one root {episode}.mcap file and at least three MP4 files under {episode}/: one primary filename containing left, one containing right, and one environment/high video filename containing neither. Additional MP4 files are uploaded as raw files, included in downloads, and checked for duration consistency. A duration mismatch across any episode videos can fail the upload. Only the primary three videos are processed for derived previews, QA, and duplicate detection.

Use lowercase .mp4 extensions. Uppercase variants such as .MP4 are rejected so client validation, worker processing, and download manifests choose the same primary videos. Hidden files are ignored, including macOS metadata files such as .DS_Store and ._left.mp4.

Primary video selection is based on filename:

  • filenames containing left are treated as left videos
  • filenames containing right are treated as right videos
  • other MP4 files are treated as environment/high videos
  • exact names are preferred, for example high.mp4, left.mp4, and right.mp4 are selected before high2.mp4, left2.mp4, and right2.mp4

Example:

data/
  1.mcap
  1/
    high.mp4
    left.mp4
    right.mp4
    high2.mp4
    left2.mp4
    right2.mp4

Primary videos:

env/high: high.mp4
left: left.mp4
right: right.mp4

Additional videos:

high2.mp4
left2.mp4
right2.mp4

CLI

prismax upload ./data --task-id 123 --serial-number robot_serial_number
prismax status 123

Use --wait to wait for the worker to finish. The default maximum wait time is 30 minutes.

prismax upload ./data --task-id 123 --serial-number robot_serial_number --wait
prismax upload ./data --task-id 123 --serial-number robot_serial_number --wait --max-wait 3600

Useful CLI options:

prismax upload ./data --task-id 123 --serial-number robot_serial_number --timeout 120 --retries 5
prismax upload ./data --task-id 123 --serial-number robot_serial_number --wait --poll-interval 5 --max-poll-errors 3

Status and Resume

import prismax

upload_status = prismax.status(123)

resume_result = prismax.resume(
    123,
    "./data",
)
prismax status 123
prismax resume 123 ./data

Resume expects the same complete upload folder/file list, not only the files that are missing from cloud storage. The SDK will ask the API which files still need signed upload URLs. Resume is only allowed while the upload is still in UPLOADING status; once processing has started or the upload reaches a terminal status, create a new upload instead.

Error Handling

import prismax

try:
    prismax.upload("./data", task_id=123, serial_number="robot_serial_number")
except prismax.PrismaxValidationError as exc:
    print(f"Invalid upload folder: {exc}")
except prismax.PrismaxAuthError as exc:
    print(f"API key or permission error: {exc}")
except prismax.PrismaxApiError as exc:
    print(f"PrismaX API error: {exc}")

If raw file upload fails after the session is created, the SDK error includes the upload ID and a prismax resume <upload_id> <folder> command.

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

prismax-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

prismax-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file prismax-0.1.0.tar.gz.

File metadata

  • Download URL: prismax-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for prismax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80cce3a0af94164cc592da69aec969083fc0ef906e189d6e97226034b7539136
MD5 724b02bf0187f4c7526bc5bf0a6a0e4a
BLAKE2b-256 7762f4ee14645fc553d06c9f92b6ab70ec0f28e9371f803b48333ae36bde7c39

See more details on using hashes here.

File details

Details for the file prismax-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prismax-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for prismax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c895db289ac568b58a165bd1f1b0bf1170b06a48fc67bbc46a6f9820c6dee58a
MD5 146e0da3bc577410e356c2397b51f526
BLAKE2b-256 8a017e88853f82b784b0b37975f800754dca9561c5aeaf2557a2572cff8defc7

See more details on using hashes here.

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