gyoza.models#
gyoza domain models.
Single source of truth for all shared domain types, aggregates, and value objects used by the server, worker, and CLI.
- class gyoza.models.Constraints(cpu=None, ram_mb=None, vram_mb=None)[source]#
Bases:
objectHardware requirements for execution.
- Parameters:
cpu (
int | None) – Number of CPU cores required.ram_mb (
int | None) – RAM in megabytes.vram_mb (
int | None) – VRAM in megabytes.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the constraints.
- Return type:
dict[str,Any]
- class gyoza.models.EventDelivery(topic='', attributes=<factory>)[source]#
Bases:
objectEvent delivery configuration for op runs.
- Parameters:
topic (
str) – Topic name to publish events to.attributes (
dict[str,Any]) – Additional metadata attached to each event.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the event delivery config.
- Return type:
dict[str,Any]
- class gyoza.models.EventEntry(t, type, msg, payload=<factory>)[source]#
Bases:
objectA single event in the op run timeline.
- Parameters:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the event entry.
- Return type:
dict[str,Any]
- class gyoza.models.EventType(*values)[source]#
-
Event types emitted during an op run.
- STARTED = 'STARTED'#
- INFO = 'INFO'#
- PROGRESS = 'PROGRESS'#
- COMPLETED = 'COMPLETED'#
- FAILED = 'FAILED'#
- CANCELLED = 'CANCELLED'#
- ERROR = 'ERROR'#
- class gyoza.models.ExecutionSummary(duration_ms=None, worker_id=None, error_message=None, gpu_id=None)[source]#
Bases:
objectHigh-level execution metadata attached to a completed op run.
- Parameters:
duration_ms (
int | None) – Total execution time in milliseconds.worker_id (
str | None) – Identifier of the worker that ran the operation.error_message (
str | None) – Error description when the run failed.gpu_id (
int | None) – GPU identifier used during execution, if any.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the execution summary.
- Return type:
dict[str,Any]
- class gyoza.models.InputSpec(type, required=True, default=None)[source]#
Bases:
objectSpecification for a single input parameter.
- Parameters:
- class gyoza.models.InputSpecs(specs=<factory>)[source]#
Bases:
objectCollection of input specifications keyed by parameter name.
- Parameters:
specs (
dict[str,InputSpec]) – Mapping of input names to their specifications.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Mapping of input names to their serialised specs.
- Return type:
dict[str,Any]
- classmethod from_dict(data)[source]#
Deserialise from a dictionary.
- Parameters:
data (
dict[str,Any]) – Mapping of input names to raw spec dictionaries.- Returns:
Populated instance.
- Return type:
- exception gyoza.models.InputValidationError(errors)[source]#
Bases:
ExceptionRaised when input validation fails against an OpDefinition’s specs.
- Parameters:
errors (
list[str]) – List of validation error messages.- Return type:
None
- class gyoza.models.OpAttempt(id, op_run_id, attempt, state, progress=0, events=<factory>, inputs=<factory>, outputs=<factory>, execution_summary=<factory>, constraints=<factory>, started_at=None, finished_at=None)[source]#
Bases:
objectA single execution attempt belonging to an OpRun.
OpRuns can have multiple attempts when retries are configured. Each attempt has its own event timeline, outputs, and execution summary.
- Parameters:
id (
str) – Unique identifier for the attempt (<run_id>_att_<n>).op_run_id (
str) – Parent OpRun identifier.attempt (
int) – Attempt number (1-indexed).state (
OpRunState) – Current state of this attempt.progress (
int) – Completion percentage (0–100).events (
list[EventEntry]) – Timeline of events during this attempt.inputs (
dict[str,Any]) – Snapshot of inputs at execution time.outputs (
dict[str,Any]) – Outputs produced by this attempt.execution_summary (
ExecutionSummary) – Execution metadata (worker, duration, GPU, error).constraints (
Constraints) – Hardware constraints snapshot for this attempt.started_at (
datetime | None) – When the container started.finished_at (
datetime | None) – When the container exited.
- state: OpRunState#
- events: list[EventEntry]#
- execution_summary: ExecutionSummary#
- constraints: Constraints#
- class gyoza.models.OpDefinition(id, version, image, input_specs=<factory>, output_specs=<factory>, constraints=<factory>, retry_policy=<factory>, event_delivery=<factory>, created_at=<factory>, updated_at=<factory>)[source]#
Bases:
objectAggregate root describing an operation and its execution requirements.
Serves as the template from which op runs are created. Holds the full lifecycle of a definition: creation, input validation, defaults, and updates.
- Parameters:
id (
str) – Unique human-readable identifier (e.g."sugarcane_lines_product").version (
str) – Semantic version string (e.g."1.2.0").image (
str) – Docker image reference including registry and tag.input_specs (
InputSpecs) – Accepted input parameters.output_specs (
OutputSpecs) – Output fields produced by the operation.constraints (
Constraints) – Hardware requirements for execution.retry_policy (
RetryPolicy) – Failure recovery rules.event_delivery (
EventDelivery) – Event delivery configuration for runs of this definition.created_at (
datetime) – Timestamp when the definition was registered.updated_at (
datetime) – Timestamp of the most recent update.
- input_specs: InputSpecs#
- output_specs: OutputSpecs#
- constraints: Constraints#
- retry_policy: RetryPolicy#
- event_delivery: EventDelivery#
- classmethod create(id, version, image, input_specs=None, output_specs=None, constraints=None, retry_policy=None, event_delivery=None)[source]#
Create a new OpDefinition with auto-set timestamps.
- Parameters:
id (
str) – Unique human-readable identifier.version (
str) – Semantic version of the definition.image (
str) – Docker image reference.input_specs (
InputSpecs | dict[str,Any] | None) – Accepted input parameters.output_specs (
OutputSpecs | dict[str,Any] | None) – Output field definitions.constraints (
Constraints | None) – Hardware requirements.retry_policy (
RetryPolicy | None) – Failure recovery rules.event_delivery (
EventDelivery | None) – Event delivery configuration.
- Returns:
A new OpDefinition instance with timestamps set to now.
- Return type:
- validate_inputs(inputs)[source]#
Validate inputs against the definition’s input specs.
- Parameters:
inputs (
dict[str,Any]) – The inputs to validate.- Raises:
InputValidationError – If required inputs are missing.
- Return type:
- prepare_inputs(inputs)[source]#
Validate inputs and apply defaults.
- Parameters:
inputs (
dict[str,Any]) – The inputs to prepare.- Returns:
Inputs with defaults applied.
- Return type:
dict[str,Any]- Raises:
InputValidationError – If required inputs are missing.
- update(version=None, image=None, input_specs=None, output_specs=None, constraints=None, retry_policy=None)[source]#
Update definition fields in place.
- Parameters:
version (
str | None) – New version string.image (
str | None) – New Docker image reference.input_specs (
InputSpecs | dict[str,Any] | None) – New input specifications.output_specs (
OutputSpecs | dict[str,Any] | None) – New output specifications.constraints (
Constraints | None) – New hardware requirements.retry_policy (
RetryPolicy | None) – New retry policy.
- Return type:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation including camelCase timestamp keys for API compatibility.
- Return type:
dict[str,Any]
- class gyoza.models.OpRun(id, state, priority, image, inputs=<factory>, constraints=<factory>, retry_policy=<factory>, event_delivery=<factory>, op_definition=None, created_at=<factory>, updated_at=<factory>, _attempts=<factory>, _current_attempt_index=-1)[source]#
Bases:
objectAggregate root for execution runs.
Encapsulates all attempts internally. Users interact only with OpRun; the current attempt’s data (progress, events, outputs, execution_summary) is exposed directly via properties.
A new OpRun always starts with its first attempt. Additional attempts are only created via
retry().- Parameters:
id (
str) – Unique identifier for the run.state (
OpRunState) – Current state of the run.priority (
int) – Execution queue priority.image (
str) – Docker image reference.inputs (
dict[str,Any]) – Input parameters for execution.constraints (
Constraints) – Hardware requirements.retry_policy (
RetryPolicy) – Failure recovery rules.event_delivery (
EventDelivery) – Event delivery configuration.op_definition (
str | None) – Parent OpDefinition name (Nonefor ad-hoc runs).created_at (
datetime) – When the run was created.updated_at (
datetime) – Last state update timestamp._current_attempt_index (int)
- state: OpRunState#
- constraints: Constraints#
- retry_policy: RetryPolicy#
- event_delivery: EventDelivery#
- classmethod create(image, priority=0, inputs=None, constraints=None, retry_policy=None, event_delivery=None, op_definition=None)[source]#
Create a new OpRun in PENDING state with its first attempt.
- Parameters:
image (
str) – Docker image reference.priority (
int) – Scheduling priority (default 0).inputs (
dict[str,Any] | None) – Input parameters.constraints (
Constraints | None) – Hardware requirements.retry_policy (
RetryPolicy | None) – Failure recovery rules.event_delivery (
EventDelivery | None) – Event delivery configuration.op_definition (
str | None) – Parent OpDefinition name.
- Returns:
A new OpRun in PENDING state with its first attempt created.
- Return type:
- property events: list[EventEntry]#
Event timeline from the current attempt.
- property execution_summary: ExecutionSummary#
Execution metadata from the current attempt.
- set_state(new_state)[source]#
Update the run state directly.
- Parameters:
new_state (
OpRunState) – New state to apply.- Return type:
- assign(worker_id)[source]#
Transition the run from PENDING to ASSIGNED.
- Parameters:
worker_id (
str) – ID of the worker that will execute this run.- Raises:
ValueError – If the run is not in PENDING state.
OpRunLockedException – If the run is in a terminal state.
- Return type:
- set_priority(priority)[source]#
Update the scheduling priority.
- Parameters:
priority (
int) – New priority value (must be ≥ 0).- Raises:
ValueError – If priority is negative.
- Return type:
- set_outputs(outputs)[source]#
Set outputs on the current attempt.
- Parameters:
outputs (
dict[str,Any]) – Output values to attach.- Return type:
- set_execution_summary(duration_ms=None, worker_id=None, error_message=None, gpu_id=None)[source]#
Update execution metadata on the current attempt.
- Parameters:
duration_ms (
int | None) – Execution duration in milliseconds.worker_id (
str | None) – ID of the executing worker.error_message (
str | None) – Error description on failure.gpu_id (
int | None) – GPU identifier used.
- Return type:
- add_event(event_type, msg, payload=None)[source]#
Append an event to the current attempt and react to its type.
Special event types trigger state transitions:
STARTED: requires ASSIGNED state → transitions to RUNNINGPROGRESS: updates progress percentage (msg must be 0–100)COMPLETED: locks run, sets state to COMPLETEDFAILED: locks run, sets state to FAILEDCANCELLED: locks run, sets state to CANCELLEDOther (
INFO,ERROR): recorded without state change
- Parameters:
- Raises:
OpRunLockedException – If the run is already in a terminal state.
ValueError – If a required payload is missing or the event is invalid in the current state.
- Return type:
- can_retry()[source]#
Return True if another attempt is allowed.
- Returns:
True when current attempt count is below max_attempts.
- Return type:
- retry(force=False)[source]#
Create a new attempt and reset the run to PENDING.
- Parameters:
force (
bool) – Skip the max_attempts check when True.- Raises:
ValueError – If max attempts are exhausted and force is False.
- Return type:
- exception gyoza.models.OpRunLockedException[source]#
Bases:
ExceptionRaised when trying to modify a terminal-state OpRun.
- class gyoza.models.OpRunState(*values)[source]#
-
Lifecycle states for an op run.
- PENDING = 'PENDING'#
- ASSIGNED = 'ASSIGNED'#
- RUNNING = 'RUNNING'#
- COMPLETED = 'COMPLETED'#
- FAILED = 'FAILED'#
- CANCELLED = 'CANCELLED'#
- class gyoza.models.OutputSpec(type)[source]#
Bases:
objectSpecification for a single output field.
- Parameters:
type (
str) – Type name of the output (e.g."string","float").
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the output spec.
- Return type:
dict[str,Any]
- class gyoza.models.OutputSpecs(specs=<factory>)[source]#
Bases:
objectCollection of output specifications keyed by field name.
- Parameters:
specs (
dict[str,OutputSpec]) – Mapping of output field names to their specifications.
- specs: dict[str, OutputSpec]#
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Mapping of output names to their serialised specs.
- Return type:
dict[str,Any]
- class gyoza.models.RetryPolicy(max_attempts=1, backoff_ms=0)[source]#
Bases:
objectRules for failure recovery.
- Parameters:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the retry policy.
- Return type:
dict[str,Any]
OpDefinition aggregate and input/output specification types.
- exception gyoza.models.op_definition.InputValidationError(errors)[source]#
Bases:
ExceptionRaised when input validation fails against an OpDefinition’s specs.
- Parameters:
errors (
list[str]) – List of validation error messages.- Return type:
None
- class gyoza.models.op_definition.InputSpec(type, required=True, default=None)[source]#
Bases:
objectSpecification for a single input parameter.
- Parameters:
- class gyoza.models.op_definition.InputSpecs(specs=<factory>)[source]#
Bases:
objectCollection of input specifications keyed by parameter name.
- Parameters:
specs (
dict[str,InputSpec]) – Mapping of input names to their specifications.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Mapping of input names to their serialised specs.
- Return type:
dict[str,Any]
- classmethod from_dict(data)[source]#
Deserialise from a dictionary.
- Parameters:
data (
dict[str,Any]) – Mapping of input names to raw spec dictionaries.- Returns:
Populated instance.
- Return type:
- class gyoza.models.op_definition.OutputSpec(type)[source]#
Bases:
objectSpecification for a single output field.
- Parameters:
type (
str) – Type name of the output (e.g."string","float").
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the output spec.
- Return type:
dict[str,Any]
- class gyoza.models.op_definition.OutputSpecs(specs=<factory>)[source]#
Bases:
objectCollection of output specifications keyed by field name.
- Parameters:
specs (
dict[str,OutputSpec]) – Mapping of output field names to their specifications.
- specs: dict[str, OutputSpec]#
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Mapping of output names to their serialised specs.
- Return type:
dict[str,Any]
- class gyoza.models.op_definition.OpDefinition(id, version, image, input_specs=<factory>, output_specs=<factory>, constraints=<factory>, retry_policy=<factory>, event_delivery=<factory>, created_at=<factory>, updated_at=<factory>)[source]#
Bases:
objectAggregate root describing an operation and its execution requirements.
Serves as the template from which op runs are created. Holds the full lifecycle of a definition: creation, input validation, defaults, and updates.
- Parameters:
id (
str) – Unique human-readable identifier (e.g."sugarcane_lines_product").version (
str) – Semantic version string (e.g."1.2.0").image (
str) – Docker image reference including registry and tag.input_specs (
InputSpecs) – Accepted input parameters.output_specs (
OutputSpecs) – Output fields produced by the operation.constraints (
Constraints) – Hardware requirements for execution.retry_policy (
RetryPolicy) – Failure recovery rules.event_delivery (
EventDelivery) – Event delivery configuration for runs of this definition.created_at (
datetime) – Timestamp when the definition was registered.updated_at (
datetime) – Timestamp of the most recent update.
- input_specs: InputSpecs#
- output_specs: OutputSpecs#
- constraints: Constraints#
- retry_policy: RetryPolicy#
- event_delivery: EventDelivery#
- classmethod create(id, version, image, input_specs=None, output_specs=None, constraints=None, retry_policy=None, event_delivery=None)[source]#
Create a new OpDefinition with auto-set timestamps.
- Parameters:
id (
str) – Unique human-readable identifier.version (
str) – Semantic version of the definition.image (
str) – Docker image reference.input_specs (
InputSpecs | dict[str,Any] | None) – Accepted input parameters.output_specs (
OutputSpecs | dict[str,Any] | None) – Output field definitions.constraints (
Constraints | None) – Hardware requirements.retry_policy (
RetryPolicy | None) – Failure recovery rules.event_delivery (
EventDelivery | None) – Event delivery configuration.
- Returns:
A new OpDefinition instance with timestamps set to now.
- Return type:
- validate_inputs(inputs)[source]#
Validate inputs against the definition’s input specs.
- Parameters:
inputs (
dict[str,Any]) – The inputs to validate.- Raises:
InputValidationError – If required inputs are missing.
- Return type:
- prepare_inputs(inputs)[source]#
Validate inputs and apply defaults.
- Parameters:
inputs (
dict[str,Any]) – The inputs to prepare.- Returns:
Inputs with defaults applied.
- Return type:
dict[str,Any]- Raises:
InputValidationError – If required inputs are missing.
- update(version=None, image=None, input_specs=None, output_specs=None, constraints=None, retry_policy=None)[source]#
Update definition fields in place.
- Parameters:
version (
str | None) – New version string.image (
str | None) – New Docker image reference.input_specs (
InputSpecs | dict[str,Any] | None) – New input specifications.output_specs (
OutputSpecs | dict[str,Any] | None) – New output specifications.constraints (
Constraints | None) – New hardware requirements.retry_policy (
RetryPolicy | None) – New retry policy.
- Return type:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation including camelCase timestamp keys for API compatibility.
- Return type:
dict[str,Any]
OpRun aggregate root — execution run lifecycle management.
- exception gyoza.models.op_run.OpRunLockedException[source]#
Bases:
ExceptionRaised when trying to modify a terminal-state OpRun.
- class gyoza.models.op_run.OpRun(id, state, priority, image, inputs=<factory>, constraints=<factory>, retry_policy=<factory>, event_delivery=<factory>, op_definition=None, created_at=<factory>, updated_at=<factory>, _attempts=<factory>, _current_attempt_index=-1)[source]#
Bases:
objectAggregate root for execution runs.
Encapsulates all attempts internally. Users interact only with OpRun; the current attempt’s data (progress, events, outputs, execution_summary) is exposed directly via properties.
A new OpRun always starts with its first attempt. Additional attempts are only created via
retry().- Parameters:
id (
str) – Unique identifier for the run.state (
OpRunState) – Current state of the run.priority (
int) – Execution queue priority.image (
str) – Docker image reference.inputs (
dict[str,Any]) – Input parameters for execution.constraints (
Constraints) – Hardware requirements.retry_policy (
RetryPolicy) – Failure recovery rules.event_delivery (
EventDelivery) – Event delivery configuration.op_definition (
str | None) – Parent OpDefinition name (Nonefor ad-hoc runs).created_at (
datetime) – When the run was created.updated_at (
datetime) – Last state update timestamp._current_attempt_index (int)
- state: OpRunState#
- constraints: Constraints#
- retry_policy: RetryPolicy#
- event_delivery: EventDelivery#
- classmethod create(image, priority=0, inputs=None, constraints=None, retry_policy=None, event_delivery=None, op_definition=None)[source]#
Create a new OpRun in PENDING state with its first attempt.
- Parameters:
image (
str) – Docker image reference.priority (
int) – Scheduling priority (default 0).inputs (
dict[str,Any] | None) – Input parameters.constraints (
Constraints | None) – Hardware requirements.retry_policy (
RetryPolicy | None) – Failure recovery rules.event_delivery (
EventDelivery | None) – Event delivery configuration.op_definition (
str | None) – Parent OpDefinition name.
- Returns:
A new OpRun in PENDING state with its first attempt created.
- Return type:
- property events: list[EventEntry]#
Event timeline from the current attempt.
- property execution_summary: ExecutionSummary#
Execution metadata from the current attempt.
- set_state(new_state)[source]#
Update the run state directly.
- Parameters:
new_state (
OpRunState) – New state to apply.- Return type:
- assign(worker_id)[source]#
Transition the run from PENDING to ASSIGNED.
- Parameters:
worker_id (
str) – ID of the worker that will execute this run.- Raises:
ValueError – If the run is not in PENDING state.
OpRunLockedException – If the run is in a terminal state.
- Return type:
- set_priority(priority)[source]#
Update the scheduling priority.
- Parameters:
priority (
int) – New priority value (must be ≥ 0).- Raises:
ValueError – If priority is negative.
- Return type:
- set_outputs(outputs)[source]#
Set outputs on the current attempt.
- Parameters:
outputs (
dict[str,Any]) – Output values to attach.- Return type:
- set_execution_summary(duration_ms=None, worker_id=None, error_message=None, gpu_id=None)[source]#
Update execution metadata on the current attempt.
- Parameters:
duration_ms (
int | None) – Execution duration in milliseconds.worker_id (
str | None) – ID of the executing worker.error_message (
str | None) – Error description on failure.gpu_id (
int | None) – GPU identifier used.
- Return type:
- add_event(event_type, msg, payload=None)[source]#
Append an event to the current attempt and react to its type.
Special event types trigger state transitions:
STARTED: requires ASSIGNED state → transitions to RUNNINGPROGRESS: updates progress percentage (msg must be 0–100)COMPLETED: locks run, sets state to COMPLETEDFAILED: locks run, sets state to FAILEDCANCELLED: locks run, sets state to CANCELLEDOther (
INFO,ERROR): recorded without state change
- Parameters:
- Raises:
OpRunLockedException – If the run is already in a terminal state.
ValueError – If a required payload is missing or the event is invalid in the current state.
- Return type:
- can_retry()[source]#
Return True if another attempt is allowed.
- Returns:
True when current attempt count is below max_attempts.
- Return type:
- retry(force=False)[source]#
Create a new attempt and reset the run to PENDING.
- Parameters:
force (
bool) – Skip the max_attempts check when True.- Raises:
ValueError – If max attempts are exhausted and force is False.
- Return type:
OpAttempt entity — a single execution attempt within an OpRun.
- class gyoza.models.op_attempt.OpAttempt(id, op_run_id, attempt, state, progress=0, events=<factory>, inputs=<factory>, outputs=<factory>, execution_summary=<factory>, constraints=<factory>, started_at=None, finished_at=None)[source]#
Bases:
objectA single execution attempt belonging to an OpRun.
OpRuns can have multiple attempts when retries are configured. Each attempt has its own event timeline, outputs, and execution summary.
- Parameters:
id (
str) – Unique identifier for the attempt (<run_id>_att_<n>).op_run_id (
str) – Parent OpRun identifier.attempt (
int) – Attempt number (1-indexed).state (
OpRunState) – Current state of this attempt.progress (
int) – Completion percentage (0–100).events (
list[EventEntry]) – Timeline of events during this attempt.inputs (
dict[str,Any]) – Snapshot of inputs at execution time.outputs (
dict[str,Any]) – Outputs produced by this attempt.execution_summary (
ExecutionSummary) – Execution metadata (worker, duration, GPU, error).constraints (
Constraints) – Hardware constraints snapshot for this attempt.started_at (
datetime | None) – When the container started.finished_at (
datetime | None) – When the container exited.
- state: OpRunState#
- events: list[EventEntry]#
- execution_summary: ExecutionSummary#
- constraints: Constraints#
Shared value objects for the gyoza domain.
Contains hardware requirements, policy types, op run states, event types, and execution metadata — all pure data structures with no dependencies on other model files, making them safe to import from anywhere.
- class gyoza.models.resources.Constraints(cpu=None, ram_mb=None, vram_mb=None)[source]#
Bases:
objectHardware requirements for execution.
- Parameters:
cpu (
int | None) – Number of CPU cores required.ram_mb (
int | None) – RAM in megabytes.vram_mb (
int | None) – VRAM in megabytes.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the constraints.
- Return type:
dict[str,Any]
- class gyoza.models.resources.RetryPolicy(max_attempts=1, backoff_ms=0)[source]#
Bases:
objectRules for failure recovery.
- Parameters:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the retry policy.
- Return type:
dict[str,Any]
- class gyoza.models.resources.EventDelivery(topic='', attributes=<factory>)[source]#
Bases:
objectEvent delivery configuration for op runs.
- Parameters:
topic (
str) – Topic name to publish events to.attributes (
dict[str,Any]) – Additional metadata attached to each event.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the event delivery config.
- Return type:
dict[str,Any]
- class gyoza.models.resources.OpRunState(*values)[source]#
-
Lifecycle states for an op run.
- PENDING = 'PENDING'#
- ASSIGNED = 'ASSIGNED'#
- RUNNING = 'RUNNING'#
- COMPLETED = 'COMPLETED'#
- FAILED = 'FAILED'#
- CANCELLED = 'CANCELLED'#
- class gyoza.models.resources.EventType(*values)[source]#
-
Event types emitted during an op run.
- STARTED = 'STARTED'#
- INFO = 'INFO'#
- PROGRESS = 'PROGRESS'#
- COMPLETED = 'COMPLETED'#
- FAILED = 'FAILED'#
- CANCELLED = 'CANCELLED'#
- ERROR = 'ERROR'#
- class gyoza.models.resources.EventEntry(t, type, msg, payload=<factory>)[source]#
Bases:
objectA single event in the op run timeline.
- Parameters:
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the event entry.
- Return type:
dict[str,Any]
- class gyoza.models.resources.ExecutionSummary(duration_ms=None, worker_id=None, error_message=None, gpu_id=None)[source]#
Bases:
objectHigh-level execution metadata attached to a completed op run.
- Parameters:
duration_ms (
int | None) – Total execution time in milliseconds.worker_id (
str | None) – Identifier of the worker that ran the operation.error_message (
str | None) – Error description when the run failed.gpu_id (
int | None) – GPU identifier used during execution, if any.
- to_dict()[source]#
Serialise to a JSON-compatible dictionary.
- Returns:
Dictionary representation of the execution summary.
- Return type:
dict[str,Any]