Polling component manager

This module provides a polling component manager.

class ska_tango_base.poller.polling_component_manager.PollingComponentManager[source]

Bases: BaseComponentManager, PollModel[PollRequestT, PollResponseT]

Abstract base class for a component manager that polls its component.

__init__(logger: Logger, communication_state_callback: Callable[[CommunicationStatus], None], component_state_callback: Callable[[...], None], poll_rate: float = 0.1, **kwargs: Any) None[source]

Initialise a new base component manager instance.

Parameters:
  • logger – a logger for this component manager to use for logging

  • communication_state_callback – callback to be called when the status of communications between the component manager and its component changes.

  • component_state_callback – callback to be called when the state of the component changes.

  • poll_rate – how often to poll, in seconds

  • kwargs – initial values for additional attributes.

cleanup() None[source]

Cleanup the polling thread.

start_communicating() None[source]

Start polling the component.

polling_started() None[source]

Respond to polling having started.

This is a hook called by the poller when it starts polling.

stop_communicating() None[source]

Stop polling the spectrum analyser.

polling_stopped() None[source]

Respond to polling having stopped.

This is a hook called by the poller when it stops polling.

poll_failed(exception: Exception) None[source]

Respond to an exception being raised by a poll attempt.

This is a hook called by the poller when an exception occurs.

Parameters:

exception – the exception that was raised by a recent poll attempt.

poll_succeeded(poll_response: PollResponseT) None[source]

Handle a successful poll, including any values received.

This is a hook called by the poller at the end of each successful poll.

Parameters:

poll_response – response to the poll, including any values received.

get_request() PollRequestT[source]

Return the reads and writes to be executed in the next poll.

Raises:

NotImplementedError – because this class is abstract.

Returns:

reads and writes to be executed in the next poll.

poll(poll_request: PollRequestT) PollResponseT[source]

Poll the hardware.

Connect to the hardware, write any values that are to be written, and then read all values.

Parameters:

poll_request – specification of the reads and writes to be performed in this poll.

Raises:

NotImplementedError – because this class is abstract.

Returns:

responses to queries in this poll