openpectus.protocol.engine_dispatcher

Attributes

logger

EngineMessageHandler

Handler in engine that handles aggregator messages of a given type

engine_headers

ssl_context

Classes

EngineDispatcher

Engine dispatcher for the Aggregator-Engine Protocol.

Module Contents

openpectus.protocol.engine_dispatcher.logger
openpectus.protocol.engine_dispatcher.EngineMessageHandler

Handler in engine that handles aggregator messages of a given type

openpectus.protocol.engine_dispatcher.engine_headers
openpectus.protocol.engine_dispatcher.ssl_context
class openpectus.protocol.engine_dispatcher.EngineDispatcher(aggregator_host, secure, uod_options, secret='')

Engine dispatcher for the Aggregator-Engine Protocol. Allows sending messages via HTTP POST and JSON-RPC.

Parameters:
  • aggregator_host (str)

  • secure (bool)

  • uod_options (dict[str, str])

  • secret (str)

class EngineRpcMethods(dispatcher, engine_id)

Bases: fastapi_websocket_rpc.RpcMethodsBase

The basic interface RPC channels expects method groups to implement.
  • create copy of the method object

  • set channel

  • provide ‘_ping_’ for keep-alive

Parameters:
disp
engine_id
async dispatch_message_async(message_json)

Handle RPC call from aggregator. Dispatch message to registered handler.

Parameters:

message_json (dict[str, Any])

async get_engine_id_async()
_aggregator_host
_uod_name
_uod_author_name
_uod_author_email
_uod_filename
_location
_rpc_client: fastapi_websocket_rpc.WebSocketRpcClient | None = None
_handlers: dict[type, Callable[[Any], Awaitable[openpectus.protocol.messages.MessageBase]]]
_engine_id = None
_sequence_number = 1
_secret = ''
_ssl_context: ssl.SSLContext | bool
_post_url = 'https://Uninferable/engine-rest'
_health_url = 'https://Uninferable/health'
_rpc_url = 'wss://Uninferable/engine-rpc'
_auth_config_url = 'https://Uninferable/auth/config'
__str__()
Return type:

str

check_aggregator_alive()
Return type:

bool

is_aggregator_authentication_enabled()
Return type:

bool

async connect_async()
async on_disconnect(channel)
async disconnect_async()
async send_registration_msg_async(message)

Send message registration message via post

Parameters:

message (openpectus.protocol.engine_messages.RegisterEngineMsg)

Return type:

openpectus.protocol.messages.MessageBase

async send_async(message)

Send message via websocket.

Parameters:

message (openpectus.protocol.engine_messages.EngineMessage)

Return type:

openpectus.protocol.messages.MessageBase

set_rpc_handler(message_type, handler)

Register handler for given message_type.

Parameters:
async dispatch_message_async(message)

Dispatch incoming message to registered handler.

Parameters:

message (openpectus.protocol.messages.MessageBase)

Return type:

openpectus.protocol.messages.MessageBase

async _register_for_engine_id_async()
Return type:

str | None

assign_sequence_number(message)
Parameters:

message (openpectus.protocol.engine_messages.EngineMessage | openpectus.protocol.engine_messages.RegisterEngineMsg)