Skip to main content

SDK library to communicate with ComputeHorde Facilitator

Project description

compute-horde-facilitator-sdk

 Continuous Integration License python versions PyPI version

Installation

pip install compute-horde-facilitator-sdk

Usage

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

[!IMPORTANT] This package uses ApiVer, make sure to import compute_horde_facilitator_sdk.v1.

Example:

import os
import time

from compute_horde.executor_class import DEFAULT_EXECUTOR_CLASS
from compute_horde_facilitator_sdk.v1 import BittensorWalletSigner, FacilitatorClient

signer = None
# Optionally, you can sign each request with your wallet for additional security & higher execution priority.
try:
    import bittensor

    signer = BittensorWalletSigner(bittensor.wallet())
except ImportError:
    print('bittensor package not installed, skipping wallet signing')


compute_horde = FacilitatorClient(
    token=os.environ["COMPUTE_HORDE_FACILITATOR_TOKEN"],
    signer=signer,
)

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

job = compute_horde.wait_for_job(job["uuid"])

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.

For more information about Request Signing, see the SDK signing documentation.

Versioning

This package uses Semantic Versioning. TL;DR you are safe to use compatible release version specifier ~=MAJOR.MINOR in your pyproject.toml or requirements.txt.

Additionally, this package uses ApiVer to further reduce the risk of breaking changes. This means, the public API of this package is explicitly versioned, e.g. compute_horde_facilitator_sdk.v1, and will not change in a backwards-incompatible way even when compute_horde_facilitator_sdk.v2 is released.

Internal packages, i.e. prefixed by compute_horde_facilitator_sdk._ do not share these guarantees and may change in a backwards-incompatible way at any time even in patch releases.

Development

Pre-requisites:

Ideally, you should run nox -t format lint before every commit to ensure that the code is properly formatted and linted. Before submitting a PR, make sure that tests pass as well, you can do so using:

nox -t check # equivalent to `nox -t format lint test`

If you wish to install dependencies into .venv so your IDE can pick them up, you can do so using:

pdm install --dev

Release process

Run nox -s make_release -- X.Y.Z where X.Y.Z is the version you're releasing and follow the printed instructions.

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

compute_horde_facilitator_sdk-0.0.7.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

compute_horde_facilitator_sdk-0.0.7-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file compute_horde_facilitator_sdk-0.0.7.tar.gz.

File metadata

File hashes

Hashes for compute_horde_facilitator_sdk-0.0.7.tar.gz
Algorithm Hash digest
SHA256 9f2bf355c33ac281c777f1fcacdad3c611743f9c6d5771310d0045b8f5d822dd
MD5 863f56116b5a4fd0e7627ad311da1dec
BLAKE2b-256 0181648112a15a590511a851a9684feda5909cbe399b018d7888816284f11969

See more details on using hashes here.

Provenance

The following attestation bundles were made for compute_horde_facilitator_sdk-0.0.7.tar.gz:

Publisher: publish.yml on backend-developers-ltd/compute-horde-facilitator-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compute_horde_facilitator_sdk-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for compute_horde_facilitator_sdk-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 be7e0b71a2bdcffa62954f1682df2686d739712545e089c20e3c84c692442932
MD5 66e6eebd949998a178c7f04ae3b0ddab
BLAKE2b-256 d01c20a8af07c2f81ff1dd6b2199a74a9442171d038f37ce5304b880b86120ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for compute_horde_facilitator_sdk-0.0.7-py3-none-any.whl:

Publisher: publish.yml on backend-developers-ltd/compute-horde-facilitator-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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