# 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](https://openapi-generator.tech) 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](https://bsub.io)

## Requirements.

Python 3.9+

## Installation & Usage
### pip install

Install from PyPI:

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

Then import the package:
```python
import bsubio
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import bsubio
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

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**](docs/JobsApi.md#cancel_job) | **POST** /v1/jobs/{jobId}/cancel | Cancel a job
*JobsApi* | [**create_job**](docs/JobsApi.md#create_job) | **POST** /v1/jobs | Create a new job
*JobsApi* | [**delete_job**](docs/JobsApi.md#delete_job) | **DELETE** /v1/jobs/{jobId} | Delete a job
*JobsApi* | [**get_job**](docs/JobsApi.md#get_job) | **GET** /v1/jobs/{jobId} | Get job details
*JobsApi* | [**list_jobs**](docs/JobsApi.md#list_jobs) | **GET** /v1/jobs | List jobs
*JobsApi* | [**submit_job**](docs/JobsApi.md#submit_job) | **POST** /v1/jobs/{jobId}/submit | Submit job for processing
*JobsApi* | [**upload_job_data**](docs/JobsApi.md#upload_job_data) | **POST** /v1/upload/{jobId} | Upload data to a job
*OutputApi* | [**get_job_logs**](docs/OutputApi.md#get_job_logs) | **GET** /v1/jobs/{jobId}/logs | Get job logs (stderr)
*OutputApi* | [**get_job_output**](docs/OutputApi.md#get_job_output) | **GET** /v1/jobs/{jobId}/output | Get job output (stdout)
*SystemApi* | [**get_types**](docs/SystemApi.md#get_types) | **GET** /v1/types | Get available processing types
*SystemApi* | [**get_version**](docs/SystemApi.md#get_version) | **GET** /v1/version | Get API version


## Documentation For Models

 - [CancelJob200Response](docs/CancelJob200Response.md)
 - [CreateJob201Response](docs/CreateJob201Response.md)
 - [CreateJobRequest](docs/CreateJobRequest.md)
 - [Error](docs/Error.md)
 - [GetTypes200Response](docs/GetTypes200Response.md)
 - [GetVersion200Response](docs/GetVersion200Response.md)
 - [Job](docs/Job.md)
 - [ListJobs200Response](docs/ListJobs200Response.md)
 - [ListJobs200ResponseData](docs/ListJobs200ResponseData.md)
 - [ProcessingType](docs/ProcessingType.md)
 - [ProcessingTypeExample](docs/ProcessingTypeExample.md)
 - [ProcessingTypeInput](docs/ProcessingTypeInput.md)
 - [ProcessingTypeOutput](docs/ProcessingTypeOutput.md)
 - [SubmitJob200Response](docs/SubmitJob200Response.md)
 - [UploadJobData200Response](docs/UploadJobData200Response.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="BearerAuth"></a>
### BearerAuth

- **Type**: Bearer authentication (API Key)


## Author




