nvflare.app_opt.xgboost.histogram_based_v2.adaptors.grpc_server_adaptor module¶
- class GrpcServerAdaptor(int_client_grpc_options=None, xgb_server_ready_timeout=10.0, in_process=True)[source]¶
Bases:
XGBServerAdaptor
Implementation of XGBServerAdaptor that uses an internal GrpcClient.
The GrpcServerAdaptor class serves as an interface between the XGBoost federated client and federated server components. It employs its XGBRunner to initiate an XGBoost federated gRPC server and utilizes an internal GrpcClient to forward client requests/responses.
- The communication flow is as follows:
XGBoost federated gRPC client talks to GrpcClientAdaptor, which encapsulates a GrpcServer. Requests are then forwarded to GrpcServerAdaptor, which internally manages a GrpcClient responsible for interacting with the XGBoost federated gRPC server.
XGBoost federated gRPC server talks to GrpcServerAdaptor, which encapsulates a GrpcClient. Responses are then forwarded to GrpcClientAdaptor, which internally manages a GrpcServer responsible for interacting with the XGBoost federated gRPC client.
Constructor method to initialize the object.
- Parameters:
int_client_grpc_options – An optional list of key-value pairs (channel_arguments in gRPC Core runtime) to configure the gRPC channel of internal GrpcClient.
in_process (bool) – Specifies whether to call the AppRunner.run() in the same process or not.
xgb_server_ready_timeout (float) – Duration for which the internal GrpcClient should wait for the XGBoost gRPC server before timing out.
- all_gather(rank: int, seq: int, send_buf: bytes, fl_ctx: FLContext) bytes [source]¶
Called by the XGB Controller to perform Allgather operation, per XGBoost spec.
- Parameters:
rank – rank of the calling client
seq – sequence number of the request
send_buf – operation input data
fl_ctx – FL context
Returns: operation result
- all_gather_v(rank: int, seq: int, send_buf: bytes, fl_ctx: FLContext) bytes [source]¶
Called by the XGB Controller to perform AllgatherV operation, per XGBoost spec.
- Parameters:
rank – rank of the calling client
seq – sequence number of the request
send_buf – input data
fl_ctx – FL context
Returns: operation result
- all_reduce(rank: int, seq: int, data_type: int, reduce_op: int, send_buf: bytes, fl_ctx: FLContext) bytes [source]¶
Called by the XGB Controller to perform Allreduce operation, per XGBoost spec.
- Parameters:
rank – rank of the calling client
seq – sequence number of the request
data_type – data type of the input
reduce_op – reduce operation to be performed
send_buf – input data
fl_ctx – FL context
Returns: operation result
- broadcast(rank: int, seq: int, root: int, send_buf: bytes, fl_ctx: FLContext) bytes [source]¶
Called by the XGB Controller to perform Broadcast operation, per XGBoost spec.
- Parameters:
rank – rank of the calling client
seq – sequence number of the request
root – root rank of the broadcast
send_buf – input data
fl_ctx – FL context
Returns: operation result