Skip to main content

bsub.io API

Project description

bsubio - Python SDK for bsub.io

REST API for batch processing compute-intensive workloads.

Submit jobs, upload data, and retrieve results through a simple API. Perfect for PDF processing, video transcoding, audio transcription, and more.

Authentication

All endpoints require Bearer token authentication using your API key:

Authorization: Bearer <your-api-key>

Get your API key from the Dashboard.

Job Lifecycle

  1. Create a job with POST /v1/jobs - Returns job ID and upload token
  2. Upload data with POST /v1/upload/{jobId} - Uses upload token
  3. Submit for processing with POST /v1/jobs/{jobId}/submit
  4. Monitor status with GET /v1/jobs/{jobId}
  5. Retrieve output with GET /v1/jobs/{jobId}/output

Job States

  • created - Job created, awaiting data upload
  • loaded - Data uploaded successfully
  • pending - Waiting in queue for a worker
  • claimed - Worker claimed the job
  • preparing - Worker preparing to process
  • processing - Processing started
  • finished - Processing completed successfully
  • failed - Processing failed with error

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Generator version: 7.17.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://bsub.io

Requirements.

Python 3.9+

Installation & Usage

pip install

Install from PyPI:

pip install bsubio

(or from source: pip install git+https://github.com/bsubio/bsubio-python.git)

Then import the package:

import bsubio

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import bsubio

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import os
import bsubio
from bsubio.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.bsub.io
# See configuration.py for a list of all supported configuration parameters.
configuration = bsubio.Configuration(
    host = "https://app.bsub.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): BearerAuth
configuration = bsubio.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with bsubio.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = bsubio.JobsApi(api_client)
    job_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' # str | Unique job identifier (UUID)

    try:
        # Cancel a job
        api_response = api_instance.cancel_job(job_id)
        print("The response of JobsApi->cancel_job:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling JobsApi->cancel_job: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://app.bsub.io

Class Method HTTP request Description
JobsApi cancel_job POST /v1/jobs/{jobId}/cancel Cancel a job
JobsApi create_job POST /v1/jobs Create a new job
JobsApi delete_job DELETE /v1/jobs/{jobId} Delete a job
JobsApi get_job GET /v1/jobs/{jobId} Get job details
JobsApi list_jobs GET /v1/jobs List jobs
JobsApi submit_job POST /v1/jobs/{jobId}/submit Submit job for processing
JobsApi upload_job_data POST /v1/upload/{jobId} Upload data to a job
OutputApi get_job_logs GET /v1/jobs/{jobId}/logs Get job logs (stderr)
OutputApi get_job_output GET /v1/jobs/{jobId}/output Get job output (stdout)
SystemApi get_types GET /v1/types Get available processing types
SystemApi get_version GET /v1/version Get API version

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: Bearer authentication (API Key)

Author

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

bsubio-0.0.4.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

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

bsubio-0.0.4-py3-none-any.whl (61.5 kB view details)

Uploaded Python 3

File details

Details for the file bsubio-0.0.4.tar.gz.

File metadata

  • Download URL: bsubio-0.0.4.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for bsubio-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a2309ded666072a0abfea461e2c50793995037c37b23f67fb5cc53bdb95de9bb
MD5 31f0ec0ec6b100d00c6fdd227b735caa
BLAKE2b-256 71bcd96cea593db2751788e5389cf9ed0852c76f550a6420b0c0fa60e3c302a7

See more details on using hashes here.

File details

Details for the file bsubio-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: bsubio-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 61.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for bsubio-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 72fe252265cffc2bec48cd0fcb80acdd210a90976b64f5503edb479fb5b7f691
MD5 fb42e489239414f8f26252fd49c499e4
BLAKE2b-256 77197ed38cb2b699aa4de988ffc6b114bd6b1109070cde2ba6a1879fb315a313

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