Metadata-Version: 2.1
Name: compute-horde-facilitator-sdk
Version: 0.0.3
Summary: SDK library to communicate with ComputeHorde Facilitator
Author: Backend Developers LTD
License: MIT
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27.0
Description-Content-Type: text/markdown

# compute-horde-facilitator-sdk

## Installation

```shell
pip install compute-horde-facilitator-sdk
```

## Usage

Register at https://facilitator.computehorde.io and generate an API Token.

Example:

```python
import time

from compute_horde_facilitator_sdk.v1 import FacilitatorClient

computehorde = FacilitatorClient(
    token=...,
)

job = computehorde.create_docker_job(
        docker_image='backenddevelopersltd/gen_caption_v2',
        input_url='https://raw.githubusercontent.com/backend-developers-ltd/'
                  'ComputeHorde-examples/master/input_shapes.zip'
        # The zip file will be extracted within the Docker container to the /volume directory
)

while True:
    job = computehorde.get_job(job['uuid'])
    if job['status'] in ['Completed', 'Failed']:
        break
    time.sleep(10)

print(f'Job finished with status: {job["status"]}. Stdout is: "{job["stdout"]}",'
      f' output_url is {job["output_download_url"]}')
# During job execution, any files generated in the /output directory will be incorporated into the final job result, 
# which can be downloaded from the url printed above. Full STDOUT and STDERR will also be there.
```