Events
EventData
Bases: BaseModel
Main container for an event provided to the worker function
Attributes:
Name | Type | Description |
---|---|---|
event_number |
EventNumber
|
Current event number relative to the trigger map provided |
streams |
dict[StreamName, StreamData]
|
Data for each stream present in the event |
Source code in dranspose/event.py
from_internals(msgs)
classmethod
Helper function to assemble an event from the internal messages received from the ingesters. This is a factory method
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msgs |
list[InternalWorkerMessage]
|
Internal messages each containing a subset of the streams for the event |
required |
Returns:
Type | Description |
---|---|
EventData
|
A new object with all data combined. |
Source code in dranspose/event.py
InternalWorkerMessage
Bases: BaseModel
A container for partial events which carries one or more streams. This is the message between ingesters and workers.
Attributes:
Name | Type | Description |
---|---|---|
event_number |
EventNumber
|
event number |
streams |
dict[StreamName, StreamData]
|
one or more streams from an ingester |
Source code in dranspose/event.py
ResultData
Bases: BaseModel
Container for transferring results from the worker to the reducer. In enhances the pure payload with useful meta data
Attributes:
Name | Type | Description |
---|---|---|
event_number |
EventNumber
|
which event the result belongs to. NB: results may arrive out of order |
worker |
WorkerName
|
which worker processed it. |
parameters_hash |
Optional[Digest]
|
which version of parameters was used to process the event |
payload |
Any
|
the data return from the custom worker function: process_event |
Source code in dranspose/event.py
StreamData
Bases: BaseModel
Data container for a single stream with all zmq frames belonging to it
Attributes:
Name | Type | Description |
---|---|---|
typ |
str
|
arbitrary typ set by the ingester to common parsing |
frames |
list[Frame] | list[bytes]
|
all frames received for this event for the stream |
Source code in dranspose/event.py
length: int
property
Calculates the length of frames.
Returns:
Type | Description |
---|---|
int
|
length of frames |
get_bytes()
Copies the data from the zmq buffer
Returns:
Type | Description |
---|---|
StreamData
|
An object with a list of bytes. |
Source code in dranspose/event.py
EventNumber = NewType('EventNumber', int)
module-attribute
strongly typed event number (int)
StreamName = NewType('StreamName', str)
module-attribute
strongly typed stream name (str)
VirtualConstraint = NewType('VirtualConstraint', int)
module-attribute
Stronly typed constraint for workers (int)
WorkerTag = NewType('WorkerTag', _WorkerTagT)
module-attribute
Strongly typed worker tag (str)
VirtualWorker
Bases: BaseModel
virtual worker with a number and tags
Attributes:
Name | Type | Description |
---|---|---|
tags |
set[WorkerTag]
|
set of tags which a worker must have to get this event |
constraint |
Optional[VirtualConstraint]
|
a VirtualConstraint to which worker this event should be delivered, if None, deliver to all workers with matching tags |