gnes.router.map module

class gnes.router.map.BlockRouter(sleep_sec=5, *args, **kwargs)[source]

Bases: gnes.router.base.BaseMapRouter

Wait for ‘sleep_sec’ seconds and forward messages, useful for benchmark

apply(msg, *args, **kwargs)[source]

Modify the incoming message

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

Train the model, need to be overrided

class gnes.router.map.DocBatchRouter(*args, **kwargs)[source]

Bases: gnes.router.base.BaseMapRouter

apply(msg, *args, **kwargs)[source]

Modify the incoming message

Parameters:msg (Message) – incoming message
Return type:Generator[+T_co, -T_contra, +V_co]
train(*args, **kwargs)

Train the model, need to be overrided

class gnes.router.map.PublishRouter(num_part, *args, **kwargs)[source]

Bases: gnes.router.base.BaseMapRouter

Copy a message ‘num_part’ time and forward it, useful for PUB-SUB sockets. ‘num_part’ is an indicator for downstream sync-barrier, e.g. a ReduceRouter

apply(msg, *args, **kwargs)[source]

Modify the incoming message

Parameters:msg (Message) – incoming message
Return type:Generator[+T_co, -T_contra, +V_co]
train(*args, **kwargs)

Train the model, need to be overrided