gnes.service.base module

class gnes.service.base.BaseService(args)[source]

Bases: object

close()[source]
default_host = '0.0.0.0'
dump()[source]
handler = <gnes.service.base.MessageHandler object>
load_model(base_class: Type[gnes.base.TrainableBase]) → T[source]
message_handler(msg: gnes_pb2.Message, out_sck, ctrl_sck)[source]
post_init()[source]
run()[source]
status
class gnes.service.base.BetterEnum[source]

Bases: enum.Enum

An enumeration.

from_string = <bound method BetterEnum.from_string of <enum 'BetterEnum'>>[source]
exception gnes.service.base.BlockMessage[source]

Bases: Exception

exception gnes.service.base.ComponentNotLoad[source]

Bases: Exception

class gnes.service.base.ConcurrentService[source]

Bases: type

exception gnes.service.base.EventLoopEnd[source]

Bases: Exception

class gnes.service.base.MessageHandler(mh: Optional[gnes.service.base.MessageHandler] = None)[source]

Bases: object

register()[source]
serve(msg: gnes_pb2.Message)[source]
class gnes.service.base.ParallelType[source]

Bases: gnes.service.base.BetterEnum

An enumeration.

PUB_BLOCK = 2
PUB_NONBLOCK = 3
PUSH_BLOCK = 0
PUSH_NONBLOCK = 1
is_block
is_push
class gnes.service.base.ReduceOp[source]

Bases: gnes.service.base.BetterEnum

An enumeration.

ALWAYS_ONE = 1
CONCAT = 0
exception gnes.service.base.ServiceError[source]

Bases: Exception

class gnes.service.base.ServiceManager(service_cls, args)[source]

Bases: object

join()[source]
class gnes.service.base.SocketType[source]

Bases: gnes.service.base.BetterEnum

An enumeration.

PAIR_BIND = 8
PAIR_CONNECT = 9
PUB_BIND = 6
PUB_CONNECT = 7
PULL_BIND = 0
PULL_CONNECT = 1
PUSH_BIND = 2
PUSH_CONNECT = 3
SUB_BIND = 4
SUB_CONNECT = 5
is_bind
gnes.service.base.build_socket(ctx: zmq.sugar.context.Context, host: str, port: int, socket_type: gnes.service.base.SocketType, identity: Optional[str] = None) → Tuple[zmq.sugar.socket.Socket, str][source]
gnes.service.base.send_ctrl_message(address: str, msg: gnes_pb2.Message, timeout: int)[source]