Skip to content

ai_horde_parameters

Contains the implemented classes that encapsulate the parameters for the dispatching of a task to a worker.

This includes meta-parameters that are API-specific (ids), pertain to API expectations (time to live, etc), or otherwise required for the worker to complete the task (such as r2 upload URLs).

AIHordeDispatchParameters

Bases: DispatchParameterBase

Base class for all AI Horde dispatch parameter sets.

Source code in horde_sdk/worker/dispatch/ai_horde_parameters.py
class AIHordeDispatchParameters(DispatchParameterBase):
    """Base class for all AI Horde dispatch parameter sets."""

    generation_ids: list[GenerationID]
    """The UUIDs for this generation."""

    no_valid_request_found_reasons: NoValidRequestFound | HordeAPIObjectBaseModel  # FIXME
    """The reasons why no valid request was found for this worker (as in, no job to dispatch to this worker)."""

    source_image_fallback_choice: REQUESTED_SOURCE_IMAGE_FALLBACK_CHOICE | str = (
        REQUESTED_SOURCE_IMAGE_FALLBACK_CHOICE.ABANDON
    )
    """The source image fallback choice to use for this job."""

generation_ids instance-attribute

generation_ids: list[GenerationID]

The UUIDs for this generation.

no_valid_request_found_reasons instance-attribute

no_valid_request_found_reasons: (
    NoValidRequestFound | HordeAPIObjectBaseModel
)

The reasons why no valid request was found for this worker (as in, no job to dispatch to this worker).

source_image_fallback_choice class-attribute instance-attribute

source_image_fallback_choice: (
    REQUESTED_SOURCE_IMAGE_FALLBACK_CHOICE | str
) = ABANDON

The source image fallback choice to use for this job.

dispatch_source class-attribute instance-attribute

dispatch_source: KNOWN_DISPATCH_SOURCE | str = (
    LOCAL_CUSTOM_3RD_PARTY
)

The source of the dispatch request. Defaults to KNOWN_DISPATCH_SOURCE.LOCAL_CUSTOM_3RD_PARTY.

ttl class-attribute instance-attribute

ttl: int | None = None

The amount of seconds before this job is considered stale and aborted on the server. Defaults to None.

inference_backend class-attribute instance-attribute

inference_backend: KNOWN_INFERENCE_BACKEND | str | None = (
    None
)

The inference backend to use for this job. Defaults to None.

requested_backend_constraints class-attribute instance-attribute

requested_backend_constraints: (
    REQUESTED_BACKEND_CONSTRAINTS | str
) = ANY

User/server request constraints on which backend to use. Defaults to REQUESTED_BACKEND_CONSTRAINTS.ANY.

AIHordeR2DispatchParameters

Bases: AIHordeDispatchParameters

Dispatch parameters for R2 tasks.

Source code in horde_sdk/worker/dispatch/ai_horde_parameters.py
class AIHordeR2DispatchParameters(AIHordeDispatchParameters):
    """Dispatch parameters for R2 tasks."""

    r2_upload_url_map: Mapping[GenerationID, str]
    """The map of GenerationID to R2 upload URLs for this job."""

r2_upload_url_map instance-attribute

r2_upload_url_map: Mapping[GenerationID, str]

The map of GenerationID to R2 upload URLs for this job.

generation_ids instance-attribute

generation_ids: list[GenerationID]

The UUIDs for this generation.

dispatch_source class-attribute instance-attribute

dispatch_source: KNOWN_DISPATCH_SOURCE | str = (
    LOCAL_CUSTOM_3RD_PARTY
)

The source of the dispatch request. Defaults to KNOWN_DISPATCH_SOURCE.LOCAL_CUSTOM_3RD_PARTY.

ttl class-attribute instance-attribute

ttl: int | None = None

The amount of seconds before this job is considered stale and aborted on the server. Defaults to None.

inference_backend class-attribute instance-attribute

inference_backend: KNOWN_INFERENCE_BACKEND | str | None = (
    None
)

The inference backend to use for this job. Defaults to None.

requested_backend_constraints class-attribute instance-attribute

requested_backend_constraints: (
    REQUESTED_BACKEND_CONSTRAINTS | str
) = ANY

User/server request constraints on which backend to use. Defaults to REQUESTED_BACKEND_CONSTRAINTS.ANY.

no_valid_request_found_reasons instance-attribute

no_valid_request_found_reasons: (
    NoValidRequestFound | HordeAPIObjectBaseModel
)

The reasons why no valid request was found for this worker (as in, no job to dispatch to this worker).

source_image_fallback_choice class-attribute instance-attribute

source_image_fallback_choice: (
    REQUESTED_SOURCE_IMAGE_FALLBACK_CHOICE | str
) = ABANDON

The source image fallback choice to use for this job.