nvflare.fuel.f3.drivers.aio_grpc_driver module

class AioGrpcDriver[source]

Bases: BaseDriver

aio_ctx = None
static capabilities() Dict[str, Any][source]

Return a dictionary of capabilities of the driver.

connect(connector: ConnectorInfo)[source]

Start the driver in active mode

Parameters:

connector – Connector with parameters

Raises:

CommError – If any errors

static get_urls(scheme: str, resources: dict) -> (<class 'str'>, <class 'str'>)[source]

Get active and passive URL pair based on resources

Parameters:
  • scheme – A scheme supported by the driver, like http or https

  • resources – User specified resources like host and port ranges.

Returns:

A tuple with active and passive URLs

Raises:

CommError – If no free port can be found

listen(connector: ConnectorInfo)[source]

Start the driver in passive mode

Parameters:

connector – Connector with parameters

Raises:

CommError – If any errors

shutdown()[source]

Stop driver and disconnect all the connections created by it

Raises:

CommError – If any errors

static supported_transports() List[str][source]

Return a list of transports supported by this driver, for example [“http”, “https”, “ws”, “wss”]

class AioStreamSession(aio_ctx: AioContext, connector: ConnectorInfo, conn_props: dict, context=None, channel=None)[source]

Bases: Connection

close()[source]

Close connection

Raises:

CommError – If any errors

async generate_output()[source]
get_conn_properties() dict[source]

Get connection specific properties, like peer address, TLS certificate etc

Raises:

CommError – If any errors

async read_loop(msg_iter)[source]
async read_oq()[source]
send_frame(frame: bytes | bytearray | memoryview | list)[source]

Send a SFM frame through the connection to the remote endpoint.

Parameters:

frame – The frame to be sent

Raises:

CommError – If any error happens while sending the frame

seq_num = 0
class Server(driver, connector, aio_ctx: AioContext, options, conn_ctx: _ConnCtx)[source]

Bases: object

async shutdown()[source]
async start(conn_ctx: _ConnCtx)[source]
class Servicer(server, aio_ctx: AioContext)[source]

Bases: StreamerServicer

async Stream(request_iterator, context)[source]

A Bidirectional streaming RPC.