grid.workers

Package Contents

class grid.workers.WebsocketIOServerWorker(hook, host: str, port: int, payload=None, id: Union[int, str] = 0, log_msgs: bool = False, verbose: bool = False, data: List[Union[torch.Tensor, AbstractTensor]] = None)

Bases: syft.workers.virtual.VirtualWorker

Objects of this class can act as a remote worker or as a plain socket IO.

By adding a payload to the object it will execute it forwarding the messages to the participants in the setup.

If no payload is added, this object will be a plain socketIO sitting between two clients that implement the protocol.

start(self)
_send_msg(self, message: bin)
_recv_msg(self, message: bin)

Forwards a message to the WebsocketIOClientWorker

_init_job_thread(self)
static _start_job_loop(loop)

Switch to new event loop and run forever

_start_payload(self)
terminate(self)
class grid.workers.WebsocketIOClientWorker(hook, host: str, port: int, id: Union[int, str] = 0, is_client_worker: bool = False, log_msgs: bool = False, verbose: bool = False, data: List[Union[torch.Tensor, AbstractTensor]] = None)

Bases: syft.workers.virtual.VirtualWorker

A worker that forwards a message to a SocketIO server and wait for its response.

This client then waits until the server returns with a result or an ACK at which point it finishes the _recv_msg operation.

_send_msg(self, message: bin)
_recv_msg(self, message: bin)
connect(self)
disconnect(self)