gnes.router.base module

class gnes.router.base.BaseMapRouter(*args, **kwargs)[source]

Bases: gnes.router.base.BaseRouter

apply(msg: gnes_pb2.Message, *args, **kwargs) → Generator[source]

Modify the incoming message

Parameters:msg – incoming message
train(*args, **kwargs)

Train the model, need to be overrided

class gnes.router.base.BaseReduceRouter(*args, **kwargs)[source]

Bases: gnes.router.base.BaseRouter

apply(msg: gnes_pb2.Message, accum_msgs: List[gnes_pb2.Message], *args, **kwargs) → None[source]

Modify the current message based on accumulated messages

Parameters:
  • msg – the current message
  • accum_msgs – accumulated messages
train(*args, **kwargs)

Train the model, need to be overrided

class gnes.router.base.BaseRouter(*args, **kwargs)[source]

Bases: gnes.base.TrainableBase

Base class for the router. Inherit from this class to create a new router.

Router forwards messages between services. Essentially, it receives a ‘gnes_pb2.Message’ and call apply() method on it.

apply(msg: gnes_pb2.Message, *args, **kwargs)[source]

Modify the incoming message

Parameters:msg – incoming message
train(*args, **kwargs)

Train the model, need to be overrided