Events¶
EventType
¶
Bases: enum.Enum
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
ASSET_DATA_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
ASSET_DATA_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
ASSET_DATA_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
BACKFILL_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
BACKFILL_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
BACKFILL_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_READ_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_READ_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_READ_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_WRITE_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_WRITE_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
DEST_WRITE_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
HOOK_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
HOOK_FIRED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
LOG
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_CANCELED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_QUEUED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_RETRIED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
OPERATION_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
RUN_COMPLETED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
RUN_FAILED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
RUN_STARTED
¶
Every framework lifecycle event type.
Each event carries id, type, timestamp and metadata. The
metadata noted on a member comes on top of the run-level metadata
(run_id, backfill_id, anything the caller passed) that every
event inherits:
- operation events carry
component_id,component_kind,component_key,parent_id,windowandmessage; - asset data events add
qualified_keyto those; - destination I/O events add
destination_key; - failures add
errorand, when the operation captures tracebacks,traceback.
The backfill and hook types are defined here so every consumer shares one vocabulary, but the platform records them, not the core runners: the backfill store records a backfill's start and verdict, the hook evaluator a hook's firing.
Event
¶
Event(type: EventType, timestamp: datetime = <factory>, metadata: dict[str, Any] = <factory>, id: str = <factory>)
An event emitted during the framework lifecycle.
Carries a stable unique id, a type, a UTC timestamp, and an
arbitrary metadata dict. The id is assigned once by the producer
and preserved across serialization, so the same logical event can be
persisted idempotently even when it is delivered more than once (e.g.
re-emitted from a child process's log stream and also written directly).
Supports JSON and dict serialization for forwarding and persistence.
subject
¶
What the event is about: its qualified key, else its component key, else "-".
Returns:
| Type | Description |
|---|---|
|
The key the event names, or |
summary
¶
What the event says: its message, else its error, else "-".
Returns:
| Type | Description |
|---|---|
|
The message the event carries, or |
from_dict
¶
from_dict(data: dict[str, Any]) -> Event
Deserialize an Event from a dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Flat mapping as produced by |
required |
Returns:
| Type | Description |
|---|---|
Event
|
The deserialized Event instance. |
Raises:
| Type | Description |
|---|---|
EventError
|
If required fields are missing or have invalid values. |
from_json
¶
from_json(json_str: str) -> Event
Deserialize an Event from a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_str
|
str
|
JSON object as produced by |
required |
Returns:
| Type | Description |
|---|---|
Event
|
The deserialized Event instance. |
from_log_line
¶
from_log_line(line: str) -> Event | None
Try to parse an Event from a log line.
An event line is @EVENT:{...}, as StderrEventHandler writes
it. Any other line, or one whose JSON is malformed, is not an event
and None is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
A single log line (may include trailing newline). |
required |
Returns:
| Type | Description |
|---|---|
Event | None
|
The parsed Event, or |
to_dict
¶
Serialize to a flat dict with event_id, type, timestamp, and metadata.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with |
dict[str, Any]
|
keys, plus all metadata entries inlined. |
to_json
¶
Serialize to a JSON string.
Returns:
| Type | Description |
|---|---|
str
|
JSON-encoded string of the event. |
EventBus
¶
Thread-safe singleton event bus.
Events are enqueued via emit and processed asynchronously by a
background daemon thread. Handlers are called in subscription order.
All interaction goes through static methods — the singleton is an implementation detail:
Initialize handlers, queue, and background worker (runs once).
emit
¶
emit(
event_type: EventType,
*,
metadata: dict[str, Any] | None = None,
) -> None
Emit an event on the global bus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_type
|
EventType
|
The type of event to emit. |
required |
metadata
|
dict[str, Any] | None
|
Optional key-value pairs attached to the event. |
None
|
emit_event
¶
emit_event(event: Event) -> None
Emit an existing Event as-is on the global bus.
Unlike emit, this preserves the event's id and
timestamp rather than creating a fresh event. Use it to
re-emit an event received from another process (e.g. parsed from a
child container's stderr) so its identity survives end-to-end and
the event persists idempotently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The event to enqueue unchanged. |
required |
flush
¶
Block until all currently queued events have been processed.
Places a sentinel on the queue and waits for the worker to reach it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | None
|
Maximum seconds to wait. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
|
shutdown
¶
Drain the queue and stop the background worker.
Safe to call multiple times (idempotent).