Skip to main content

prefect.server.schemas.states

State schemas.

Functions

Scheduled

Convenience function for creating Scheduled states. Returns:
  • a Scheduled state

Completed

Convenience function for creating Completed states. Returns:
  • a Completed state

Running

Convenience function for creating Running states. Returns:
  • a Running state

Failed

Convenience function for creating Failed states. Returns:
  • a Failed state

Crashed

Convenience function for creating Crashed states. Returns:
  • a Crashed state

Cancelling

Convenience function for creating Cancelling states. Returns:
  • a Cancelling state

Cancelled

Convenience function for creating Cancelled states. Returns:
  • a Cancelled state

Pending

Convenience function for creating Pending states. Returns:
  • a Pending state

Paused

Convenience function for creating Paused states. Returns:
  • a Paused state

Suspended

Convenience function for creating Suspended states. Returns:
  • a Suspended state

AwaitingRetry

Convenience function for creating AwaitingRetry states. Returns:
  • an AwaitingRetry state

AwaitingConcurrencySlot

Convenience function for creating AwaitingConcurrencySlot states. Returns:
  • an AwaitingConcurrencySlot state

Submitting

Convenience function for creating Submitting states. Returns:
  • a Submitting state

InfrastructurePending

Convenience function for creating InfrastructurePending states. Returns:
  • an InfrastructurePending state

Retrying

Convenience function for creating Retrying states. Returns:
  • a Retrying state

Late

Convenience function for creating Late states. Returns:
  • a Late state

Classes

StateType

Enumeration of state types. Methods:

auto

Exposes enum.auto() to avoid requiring a second import to use AutoEnum

CountByState

Methods:

check_key

model_validate_list

reset_fields

Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

StateDetails

Methods:

model_validate_list

reset_fields

Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

StateBaseModel

Methods:

orm_dict

This method is used as a convenience method for constructing fixtues by first building a State schema object and converting it into an ORM-compatible format. Because the data field is not writable on ORM states, this method omits the data field entirely for the purposes of constructing an ORM model. If state data is required, an artifact must be created separately.

State

Represents the state of a run. Methods:

default_name_from_type

If a name is not provided, use the type

default_scheduled_start_time

fresh_copy

Return a fresh copy of the state with a new ID.

from_orm_without_result

During orchestration, ORM states can be instantiated prior to inserting results into the artifact table and the data field will not be eagerly loaded. In these cases, sqlalchemy will attempt to lazily load the the relationship, which will fail when called within a synchronous pydantic method. This method will construct a State object from an ORM model without a loaded artifact and attach data passed using the with_data argument to the data field.

is_cancelled

is_cancelling

is_completed

is_crashed

is_failed

is_final

is_paused

is_pending

is_running

is_scheduled

orm_dict

This method is used as a convenience method for constructing fixtues by first building a State schema object and converting it into an ORM-compatible format. Because the data field is not writable on ORM states, this method omits the data field entirely for the purposes of constructing an ORM model. If state data is required, an artifact must be created separately.

result

result

result

result

to_state_create