jobs
ImageWorkerJob
Bases: HordeWorkerJob[ImageSingleGeneration, ImageGenerationParameters]
A job containing only image generations.
Source code in horde_sdk/worker/jobs.py
generation_cls
property
The (python) type created by the job.
generation_parameters_cls
property
The (python) type of the generation parameters.
job_config
property
Return the configuration associated with this job.
dispatch_job_id
property
Return the identifier provided by the dispatch source, if any.
time_received
property
The time the job response was either received or constructed (in epoch time).
Note: This generally will be the time the job was popped from the server. However, manually constructed api responses or jobs that are not popped from a queue may imbue this property with a different meaning.
You can manually set this value with the time_received parameter in the constructor.
time_since_received
property
The time since the job was popped from the queue in seconds, or None if not yet received.
time_submitted
property
The time the job was submitted to the API in epoch time or None if not submitted.
time_spent_generating
class-attribute
instance-attribute
The time spent generating the job in seconds.
time_to_download_aux_models
class-attribute
instance-attribute
The time spent downloading user-specified auxiliary models specific to the job (i.e., LoRas) in seconds.
faulted_reason
property
The reason the job was faulted or None if not faulted.
faulted_at
property
The time the job was faulted in epoch time or None if not faulted.
should_censor_nsfw
property
Whether or not the user has requested that NSFW content be censored.
is_job_finalized
property
Return true if the generation in the job is finalized.
Note: This means the generation has been submitted as either successful or failed, or has been abandoned. Accordingly, there is nothing more to do with the job.
job_completed_successfully
property
Return true if the generation in the job completed successfully.
__init__
__init__(
*,
generation: ImageSingleGeneration,
job_config: HordeWorkerJobConfig | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
preserve_generation_id: bool = False
) -> None
Initialize the image worker job.
Parameters:
-
generation(ImageSingleGeneration) –The generation to use for the job.
-
job_config(HordeWorkerJobConfig | None, default:None) –The configuration for the job.
-
job_config(HordeWorkerJobConfig, default:None) –The configuration for the job. If
None, the default configuration will be used. Defaults to None. -
job_id(ID_TYPES | None, default:None) –Optional identifier to associate with the job.
-
dispatch_job_id(ID_TYPES | None, default:None) –Identifier supplied by dispatch for the job.
-
dispatch_result_ids(Sequence[ID_TYPES] | None, default:None) –Result identifiers supplied by dispatch for the generation.
-
preserve_generation_id(bool, default:False) –Retain the existing generation identifier instead of overwriting it with the job identifier.
Source code in horde_sdk/worker/jobs.py
job_worker_type
classmethod
from_template
classmethod
from_template(
template: ImageGenerationParametersTemplate,
*,
generation_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
base_param_updates: (
BasicImageGenerationParametersTemplate | None
) = None,
additional_param_updates: (
ImageGenerationComponentContainer | None
) = None,
result_ids: Sequence[ID_TYPES] | None = None,
allocator: ResultIdAllocator | None = None,
seed: str = "image",
generation_kwargs: (
ImageGenerationInitKwargs | None
) = None,
job_config: HordeWorkerJobConfig | None = None,
preserve_generation_id: bool = False
) -> ImageWorkerJob
Instantiate an image job from a template.
Source code in horde_sdk/worker/jobs.py
set_dispatch_job_id
Bind the job to the identifier supplied by dispatch.
set_job_faulted
set_job_faulted(
faulted_reason: WORKER_ERRORS,
failure_exception: Exception | None = None,
) -> None
Mark the entire job as faulted.
Note: This will mark all generations in the job as faulted.
Source code in horde_sdk/worker/job_base.py
AlchemyWorkerJob
Bases: HordeWorkerJob[AlchemySingleGeneration, SingleAlchemyParameters]
A job containing only alchemy generations.
Source code in horde_sdk/worker/jobs.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
generation_cls
property
The (python) type created by the job.
generation_parameters_cls
property
The (python) type of the generation parameters.
job_config
property
Return the configuration associated with this job.
dispatch_job_id
property
Return the identifier provided by the dispatch source, if any.
time_received
property
The time the job response was either received or constructed (in epoch time).
Note: This generally will be the time the job was popped from the server. However, manually constructed api responses or jobs that are not popped from a queue may imbue this property with a different meaning.
You can manually set this value with the time_received parameter in the constructor.
time_since_received
property
The time since the job was popped from the queue in seconds, or None if not yet received.
time_submitted
property
The time the job was submitted to the API in epoch time or None if not submitted.
time_spent_generating
class-attribute
instance-attribute
The time spent generating the job in seconds.
time_to_download_aux_models
class-attribute
instance-attribute
The time spent downloading user-specified auxiliary models specific to the job (i.e., LoRas) in seconds.
faulted_reason
property
The reason the job was faulted or None if not faulted.
faulted_at
property
The time the job was faulted in epoch time or None if not faulted.
should_censor_nsfw
property
Whether or not the user has requested that NSFW content be censored.
is_job_finalized
property
Return true if the generation in the job is finalized.
Note: This means the generation has been submitted as either successful or failed, or has been abandoned. Accordingly, there is nothing more to do with the job.
job_completed_successfully
property
Return true if the generation in the job completed successfully.
__init__
__init__(
*,
generation: AlchemySingleGeneration,
job_config: HordeWorkerJobConfig | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
preserve_generation_id: bool = False
) -> None
Initialize the alchemy worker job.
Parameters:
-
generation(AlchemySingleGeneration) –The response from the API.
-
job_config(HordeWorkerJobConfig | None, default:None) –The configuration for the job. If
None, the default configuration will be used. Defaults to None. -
job_id(ID_TYPES | None, default:None) –Optional identifier to associate with the job.
-
dispatch_job_id(ID_TYPES | None, default:None) –Identifier supplied by dispatch for the job.
-
dispatch_result_ids(Sequence[ID_TYPES] | None, default:None) –Result identifiers supplied by dispatch for the generation.
-
preserve_generation_id(bool, default:False) –Retain the existing generation identifier instead of overwriting it with the job identifier.
Source code in horde_sdk/worker/jobs.py
job_worker_type
classmethod
from_template
classmethod
from_template(
template: SingleAlchemyParametersTemplate,
*,
source_image: bytes | str | None = None,
default_form: (
KNOWN_ALCHEMY_FORMS | str | None
) = KNOWN_ALCHEMY_FORMS.post_process,
generation_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
result_id: ID_TYPES | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
allocator: ResultIdAllocator | None = None,
seed: str = "alchemy",
generation_kwargs: (
AlchemyGenerationInitKwargs | None
) = None,
job_config: HordeWorkerJobConfig | None = None,
preserve_generation_id: bool = False
) -> AlchemyWorkerJob
Instantiate an alchemy job from a template.
Source code in horde_sdk/worker/jobs.py
set_dispatch_job_id
Bind the job to the identifier supplied by dispatch.
set_job_faulted
set_job_faulted(
faulted_reason: WORKER_ERRORS,
failure_exception: Exception | None = None,
) -> None
Mark the entire job as faulted.
Note: This will mark all generations in the job as faulted.
Source code in horde_sdk/worker/job_base.py
TextWorkerJob
Bases: HordeWorkerJob[TextSingleGeneration, TextGenerationParameters]
A job containing only text generations.
Source code in horde_sdk/worker/jobs.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
generation_cls
property
The (python) type created by the job.
generation_parameters_cls
property
The (python) type of the generation parameters.
job_config
property
Return the configuration associated with this job.
dispatch_job_id
property
Return the identifier provided by the dispatch source, if any.
time_received
property
The time the job response was either received or constructed (in epoch time).
Note: This generally will be the time the job was popped from the server. However, manually constructed api responses or jobs that are not popped from a queue may imbue this property with a different meaning.
You can manually set this value with the time_received parameter in the constructor.
time_since_received
property
The time since the job was popped from the queue in seconds, or None if not yet received.
time_submitted
property
The time the job was submitted to the API in epoch time or None if not submitted.
time_spent_generating
class-attribute
instance-attribute
The time spent generating the job in seconds.
time_to_download_aux_models
class-attribute
instance-attribute
The time spent downloading user-specified auxiliary models specific to the job (i.e., LoRas) in seconds.
faulted_reason
property
The reason the job was faulted or None if not faulted.
faulted_at
property
The time the job was faulted in epoch time or None if not faulted.
should_censor_nsfw
property
Whether or not the user has requested that NSFW content be censored.
is_job_finalized
property
Return true if the generation in the job is finalized.
Note: This means the generation has been submitted as either successful or failed, or has been abandoned. Accordingly, there is nothing more to do with the job.
job_completed_successfully
property
Return true if the generation in the job completed successfully.
__init__
__init__(
generation: TextSingleGeneration,
job_config: HordeWorkerJobConfig | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
preserve_generation_id: bool = False,
) -> None
Initialize the text worker job.
Parameters:
-
generation(TextSingleGeneration) –The response from the API.
-
job_config(HordeWorkerJobConfig | None, default:None) –The configuration for the job. If
None, the default configuration will be used. Defaults to None. -
job_id(ID_TYPES | None, default:None) –Optional identifier to associate with the job.
-
dispatch_job_id(ID_TYPES | None, default:None) –Identifier supplied by dispatch for the job.
-
dispatch_result_ids(Sequence[ID_TYPES] | None, default:None) –Result identifiers supplied by dispatch for the generation.
-
preserve_generation_id(bool, default:False) –Retain the existing generation identifier instead of overwriting it with the job identifier.
Source code in horde_sdk/worker/jobs.py
job_worker_type
classmethod
from_template
classmethod
from_template(
template: TextGenerationParametersTemplate,
*,
generation_id: ID_TYPES | None = None,
dispatch_result_ids: Sequence[ID_TYPES] | None = None,
job_id: ID_TYPES | None = None,
dispatch_job_id: ID_TYPES | None = None,
base_param_updates: (
BasicTextGenerationParametersTemplate | None
) = None,
result_ids: Sequence[ID_TYPES] | None = None,
allocator: ResultIdAllocator | None = None,
seed: str = "text",
generation_kwargs: (
TextGenerationInitKwargs | None
) = None,
job_config: HordeWorkerJobConfig | None = None,
preserve_generation_id: bool = False
) -> TextWorkerJob
Instantiate a text job from a template.
Source code in horde_sdk/worker/jobs.py
set_dispatch_job_id
Bind the job to the identifier supplied by dispatch.
set_job_faulted
set_job_faulted(
faulted_reason: WORKER_ERRORS,
failure_exception: Exception | None = None,
) -> None
Mark the entire job as faulted.
Note: This will mark all generations in the job as faulted.