pypz.core.channels.status module
- class pypz.core.channels.status.ChannelFilter
Bases:
object
This interface contains the methods that shall implement the checking of different statuses. This interface can be used to restrict access to ChannelStatusMonitor object.
- get_channel_context_name() str
- get_channel_group_name() str
- get_channel_unique_name() str
- is_channel_closed() bool
- is_channel_error() bool
- is_channel_healthy() bool
- is_channel_not_initialised() bool
- is_channel_opened() bool
- is_channel_started() bool
- is_channel_stopped() bool
- class pypz.core.channels.status.ChannelStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- Acknowledged = 'Acknowledged'
- Closed = 'Closed'
- Error = 'Error'
- HealthCheck = 'HealthCheck'
- Opened = 'Opened'
- Started = 'Started'
- Stopped = 'Stopped'
- WaitingForSchema = 'WaitingForSchema'
- class pypz.core.channels.status.ChannelStatusMessage(channel_name: str, channel_context_name: str, channel_group_name: str = None, channel_group_index: int = 0, status: ChannelStatus | str = None, payload: Any = None, timestamp: int = None)
Bases:
object
This class is a Data Transfer Object (DTO) for the status messages sent between the channels.
- Parameters:
channel_name – name of the channel
channel_context_name – name of the context of the channel, which is the full name of the plugin
channel_group_name – name of the group of the channel, which is the group name of the plugin
channel_group_index – index of the operator in the group, which is inherited by the plugin
status – status
payload – optional payload
timestamp – timestamp of the message at creation
- static create_from_json(source)
- get_channel_unique_name()
- class pypz.core.channels.status.ChannelStatusMonitor(channel_name: str, channel_context_name: str, channel_group_name: str = None, logger: ContextLogger = None)
Bases:
ChannelFilter
This class has the responsibility to monitor and track state of the connected channel RW entities. If the counterpart sends a status message, this class has to parse and interpret it. In addition, it provides an implementation for the
ChannelFilter
interface to enable certain queries.- Parameters:
channel_name – name of the channel
channel_context_name – name of the context of the channel, which is the full name of the plugin
channel_group_name – name of the group of the channel, which is the group name of the plugin
logger – the context logger of the plugin, which is inherited from the operator
- ValidPatienceTimeInMs = 120000
This is the patience time for not receiving any update from the ChannelReader. Once this time is up, the ChannelReader will be invalidated
- get_channel_context_name() str
- get_channel_group_name() str
- get_channel_unique_name() str
- is_channel_closed()
- is_channel_error()
- is_channel_healthy() bool
- is_channel_not_initialised()
- is_channel_opened()
- is_channel_started()
- is_channel_stopped()
- on_status_update(statusUpdateCallback: Callable)
- update(status_message: ChannelStatusMessage)
This method implements the logic to handle status message updates. Note that to overcome messaging issues e.g., missing status update, we don’t introduce a state machine. It means that most of the states can overwrite the actual state with one exception. If “error” status has been sent, it can only be overwritten by “open” or “start”. This allows us to retain error information until the counterpart has been restarted.
- Parameters:
status_message – the status message received from the other ChannelRW entity
- pypz.core.channels.status.NameSeparator = '@'
Used to construct channel unique name