Tile Poll Management

This module implements polling management for a TileComponentManager.

class RequestIterator

A class that returns attributes allowed given a TpmStatus.

__init__()

Construct a instance of RequestIterator.

calculate_stale_attributes(new_status)

Return a set of attribute that will no longer be polled.

Parameters:

new_status (Optional[TpmStatus]) – the new TpmStatus

Return type:

set[Any]

Returns:

a set of attribute that will no longer be polled.

property state: TpmStatus

Return the TpmStatus.

Returns:

the TpmStatus

class TileLRCRequest(name, command_object, *args, publish=False, task_callback=None, **kwargs)

Class handling a Long Running Command request.

__init__(name, command_object, *args, publish=False, task_callback=None, **kwargs)

Initialise a new LRC request for execution in a poll.

Parameters:
  • name (str) – Name of the command.

  • command_object (Any) – The object to call

  • args (Any) – optional arguments to pass

  • publish (bool) – Whether to publish the results of poll to the TANGO device on poll_success

  • task_callback (Optional[Callable]) – An optional callback to update with command status.

  • kwargs (Any) – Optional kwargs

notify_completed()

Notify task callback that this command has COMPLETED.

Return type:

None

notify_failed(message='')

Notify task callback that this command is FAILED.

Parameters:

message (str) – an optional message to report to the task callback.

Return type:

None

notify_in_progress()

Notify task callback that this command is IN_PROGRESS.

Return type:

None

notify_queued()

Notify task callback that this command is QUEUED.

Return type:

None

notify_removed_from_queue()

Notify task callback that this command has been removed.

NOTE: Since we have just wiped this request it will never be picked up during a poll, we must abort the command. The client to the LRC will then see QUEUED -> ABORTED, and the command will never be executed.

Return type:

None

class TileRequest(name, command_object, *args, publish=False, **kwargs)

Class representing an action to be performed by a poll.

__init__(name, command_object, *args, publish=False, **kwargs)

Initialise a new request for execution in a poll.

Parameters:
  • name (str) – Name of the command.

  • command_object (Callable) – The object to call

  • args (Any) – optional arguments to pass

  • publish (bool) – Whether to publish the results of poll to the TANGO device on poll_success

  • kwargs (Any) – Optional kwargs

class TileRequestProvider(stale_attribute_callback=None, _request_iterator=None)

A class that manages requests for the Tile.

It ensures that:

  • commands get executed as promptly as possible

  • only attributes allowed to be polled given a TpmStatus are returned.

__init__(stale_attribute_callback=None, _request_iterator=None)

Initialise a new instance.

Parameters:
  • stale_attribute_callback (Optional[Callable]) – an optional callback to call with attributes no longer being updated.

  • _request_iterator (Optional[RequestIterator]) – an optional RequestIterator to supply for testing.

cleanup()

Clean up and notify callbacks.

Return type:

None

desire_configuration_read()

Register a request to read configuration from the TPM.

Return type:

None

desire_connection()

Register a request to connect with the TPM.

Return type:

None

enqueue_lrc(request, priority=999, wipe_time=None)

Register a request to be executed on the Tile.

Parameters:
  • priority (int) – The priority of the request. Lower number means higher priority.

  • request (TileLRCRequest) – The LRC request to execute on a poll.

  • wipe_time (Optional[float]) – the approx time at which to wipe this command.

Return type:

None

get_request(tpm_status)

Get the next request to execute on the Tile.

Parameters:

tpm_status (TpmStatus) – the tpm_status at the time of the request.

Return type:

UnionType[str, TileRequest, None]

Returns:

the next request to execute on the Tile.

inform_configuration_read()

Remove request to read configuration from TPM.

Return type:

None

class TileResponse(command, data, publish)

Class representing the result of a poll.

It comprises the command name, the return data and a flag to represent if the result is to be published.

__init__(command, data, publish)