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 or task scenario/name
  • the robot serial number for the machine that produced the data

Create and find these in the PrismaX app:

  • App: https://app.prismax.ai
  • Upload API key: open https://app.prismax.ai/account, go to API Keys, then create an Operator / Upload key. The key is shown once, so copy it when it is created.
  • Task scenario/name: open https://app.prismax.ai/data/upload and use the task card title, for example Pick and place packaged food items. The SDK resolves this to the database task ID automatically using a case-insensitive match.
  • Task ID: if you already know the numeric database task ID, you can pass it directly instead of the scenario/name.
  • Robot serial number: open https://app.prismax.ai/account and use the serial number for the registered operator 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",
    scenario="Pick and place packaged food items",
    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",
    scenario="Pick and place packaged food items",
    serial_number="robot_serial_number",
    api_key="pxu_your_upload_api_key",
)

You can also pass task_id=123 instead of scenario=....

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 --scenario "Pick and place packaged food items" --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 --scenario "Pick and place packaged food items" --serial-number robot_serial_number --wait
prismax upload ./data --scenario "Pick and place packaged food items" --serial-number robot_serial_number --wait --max-wait 3600

Useful CLI options:

prismax upload ./data --scenario "Pick and place packaged food items" --serial-number robot_serial_number --timeout 120 --retries 5
prismax upload ./data --scenario "Pick and place packaged food items" --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",
        scenario="Pick and place packaged food items",
        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.2.tar.gz (17.1 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.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prismax-0.1.2.tar.gz
  • Upload date:
  • Size: 17.1 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.2.tar.gz
Algorithm Hash digest
SHA256 7f56b70c3d952edec5396ba60ae4e1fe6035728b8b1ca246e784cb4cc38abb01
MD5 53c25931826459e0cddd35b6a5781d67
BLAKE2b-256 2c014a90984563aa936ae77b3266f2f92e0c284915bce73e3d0b5c8ceb64a65d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prismax-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b776e20ee48d8bbcfdb08dab83c9b2b89ae76ba543f24819afb55ba492e57786
MD5 8b8b5d4d04f4d7b35fbc8f495502d4ac
BLAKE2b-256 02dd31f480732cac0978d2eef968cd870dd1843b909a75666a3caf80117e280a

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