elkpy.SushiController

class elkpy.sushicontroller.SushiController(address='localhost:51051', sushi_proto_def='/usr/share/sushi/sushi_rpc.proto')[source]

Bases: object

A class to control sushi via gRPC. This class creates one instance of each different controller type and makes these sub-controllers available as member variables. See the documentation of the separate sub-controllers for their usage.

Attributes:
_stub (SushiControllerStub): Connection stubs to the gRPC interface implemented in sushi.
Notes:
close() should ALWAYS be called as part of an application housekeeping/cleanup-before-shutdown routine as it ensure proper releasing of resources and clean joining of concurrent threads.
__init__(address='localhost:51051', sushi_proto_def='/usr/share/sushi/sushi_rpc.proto')[source]

The constructor for the SushiController class setting up the gRPC connection with sushi.

Parameters:
address (str): ‘ip-addres:port’ The ip-addres and port at which to connect to sushi. sushi_proto_def (str): path to .proto file with SUSHI’s gRPC services definition
close()[source]

This method should be called at app close. It should call any sub-controller close routines whenever they exist. i.e.: NotificationController has an infinite event loop running in its own thread, which has to be stopped and joined

to ensure clean closing and proper releasing of any resources.
exception elkpy.sushicontroller.SushiInternalError[source]

Bases: Exception

Error thrown if sushi encountered an internal error

exception elkpy.sushicontroller.SushiInvalidArgumentError[source]

Bases: Exception

Error thrown if one or more of the passed arguments are invalid

exception elkpy.sushicontroller.SushiNotFoundError[source]

Bases: Exception

Error thrown if the requested entity is not found in sushi

exception elkpy.sushicontroller.SushiOutOfRangeError[source]

Bases: Exception

Error thrown if one or more of the passed arguments are out of their allowed range

exception elkpy.sushicontroller.SushiUnkownError[source]

Bases: Exception

Error thrown when the source of the error can’t be determined

exception elkpy.sushicontroller.SushiUnsupportedOperationError[source]

Bases: Exception

Error thrown when the operation attempted is not currently supported in sushi

elkpy.sushicontroller.grpc_error_handling(e, context_info='')[source]

Maps a gRPC exception to the corresponding sushi error. If the exception doesn’t have a mapping the context info will be printed and the same exception will be re-raised