prefect.events.schemas.events

Functions

matches

matches(expected: str, value: Optional[str]) -> bool
Returns true if the given value matches the expected string, which may include a a negation prefix (“!this-value”) or a wildcard suffix (“any-value-starting-with*“)

Classes

Resource

An observable business object of interest to the user Methods:

as_label_value_array

as_label_value_array(self) -> List[Dict[str, str]]

enforce_maximum_labels

enforce_maximum_labels(self) -> Self

get

get(self, label: str, default: Optional[str] = None) -> Optional[str]

has_all_labels

has_all_labels(self, labels: Dict[str, str]) -> bool

id

id(self) -> str

items

items(self) -> Iterable[Tuple[str, str]]

keys

keys(self) -> Iterable[str]

labels

labels(self) -> LabelDiver

name

name(self) -> Optional[str]

prefect_object_id

prefect_object_id(self, kind: str) -> UUID
Extracts the UUID from an event’s resource ID if it’s the expected kind of prefect resource

requires_resource_id

requires_resource_id(self) -> Self

RelatedResource

A Resource with a specific role in an Event Methods:

enforce_maximum_labels

enforce_maximum_labels(self) -> Self

id

id(self) -> str

name

name(self) -> Optional[str]

prefect_object_id

prefect_object_id(self, kind: str) -> UUID
Extracts the UUID from an event’s resource ID if it’s the expected kind of prefect resource

requires_resource_id

requires_resource_id(self) -> Self

requires_resource_role

requires_resource_role(self) -> Self

role

role(self) -> str

Event

The client-side view of an event that has happened to a Resource Methods:

find_resource_label

find_resource_label(self, label: str) -> Optional[str]
Finds the value of the given label in this event’s resource or one of its related resources. If the label starts with related:<role>:, search for the first matching label in a related resource with that role.

involved_resources

involved_resources(self) -> Sequence[Resource]

model_validate_list

model_validate_list(cls, obj: Any) -> list[Self]

reset_fields

reset_fields(self: Self) -> Self
Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

resource_in_role

resource_in_role(self) -> Mapping[str, RelatedResource]
Returns a mapping of roles to the first related resource in that role

resources_in_role

resources_in_role(self) -> Mapping[str, Sequence[RelatedResource]]
Returns a mapping of roles to related resources in that role

ReceivedEvent

The server-side view of an event that has happened to a Resource after it has been received by the server Methods:

is_set

is_set(self)

set

set(self) -> None
Set the flag, notifying all waiters. Unlike asyncio.Event, waiters may not be notified immediately when this is called; instead, notification will be placed on the owning loop of each waiter for thread safety.

wait

wait(self) -> Literal[True]
Block until the internal flag is true. If the internal flag is true on entry, return True immediately. Otherwise, block until another set() is called, then return True.

ResourceSpecification

Methods:

deepcopy

deepcopy(self) -> 'ResourceSpecification'

get

get(self, key: str, default: Optional[Union[str, List[str]]] = None) -> Optional[List[str]]

includes

includes(self, candidates: Iterable[Resource]) -> bool

items

items(self) -> Iterable[Tuple[str, List[str]]]

matches

matches(self, resource: Resource) -> bool

matches_every_resource

matches_every_resource(self) -> bool

matches_every_resource_of_kind

matches_every_resource_of_kind(self, prefix: str) -> bool

pop

pop(self, key: str, default: Optional[Union[str, List[str]]] = None) -> Optional[List[str]]