pipert.core.message

Module Contents

Classes

Payload

Helper class that provides a standard way to create an ABC using

FramePayload

Helper class that provides a standard way to create an ABC using

PredictionPayload

Helper class that provides a standard way to create an ABC using

FrameMetadataPayload

Helper class that provides a standard way to create an ABC using

Message

Functions

message_encode(msg, generator=None)

Encodes the message object.

message_decode(encoded_msg, lazy=False)

Decodes the message object.

class pipert.core.message.Payload(data)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract decode(self)[source]
abstract encode(self, generator)[source]
abstract is_empty(self)[source]
class pipert.core.message.FramePayload(data)[source]

Bases: pipert.core.message.Payload

Helper class that provides a standard way to create an ABC using inheritance.

decode(self)[source]
encode(self, generator)[source]
is_empty(self)[source]
_get_frame(self)[source]
class pipert.core.message.PredictionPayload(data)[source]

Bases: pipert.core.message.Payload

Helper class that provides a standard way to create an ABC using inheritance.

decode(self)[source]
encode(self, generator)[source]
is_empty(self)[source]
class pipert.core.message.FrameMetadataPayload(data)[source]

Bases: pipert.core.message.Payload

Helper class that provides a standard way to create an ABC using inheritance.

decode(self)[source]
encode(self, generator)[source]
is_empty(self)[source]
_get_frame(self)[source]
class pipert.core.message.Message(data, source_address)[source]
counter = 0[source]
update_payload(self, data)[source]
get_payload(self)[source]
is_empty(self)[source]
record_entry(self, component_name, logger)[source]

Records the timestamp of the message’s entry into a component.

Args:

component_name: the name of the component that the message entered. logger: the logger object of the component’s input routine.

record_custom(self, component_name, section)[source]

Records the timestamp of the message’s entry into some section of a component.

Args:

component_name: the name of the component that the message is in. section: the name of the section within the component that the message entered.

record_exit(self, component_name, logger)[source]

Records the timestamp of the message’s exit out of a component. Additionally, it enables a flag called ‘reached_exit’ if the message is exiting the pipeline’s “output component”.

Args:

component_name: the name of the component that the message exited. logger: the logger object of the component’s output routine.

get_latency(self, component_name)[source]

Returns the time it took for a message to pass through a whole component.

Using the message’s history, this method calculates and returns the amount of time that passed from the moment the message entered a component, to the moment that it left it. Args:

component_name: the name of the relevant component.

get_end_to_end_latency(self, output_component)[source]

Returns the time it took for a message to pass through the pipeline.

Args:

output_component: the name of the pipeline’s output component.

__str__(self)[source]

Return str(self).

full_description(self)[source]
pipert.core.message.message_encode(msg, generator=None)[source]

Encodes the message object.

This method compresses the message payload and then serializes the whole message object into bytes, using pickle.

Args:

msg: the message to encode. generator: generator necessary for shared memory usage.

pipert.core.message.message_decode(encoded_msg, lazy=False)[source]

Decodes the message object.

This method deserializes the pickled message, and decodes the message payload if ‘lazy’ is False.

Args:

encoded_msg: the message to decode. lazy: if this is True, then the payload will only be decoded once it’s accessed.