use of io.seldon.protos.CombinerGrpc.CombinerBlockingStub in project seldon-core by SeldonIO.
the class InternalPredictionService method aggregate.
public SeldonMessage aggregate(List<SeldonMessage> outputs, PredictiveUnitState state) throws InvalidProtocolBufferException {
final Endpoint endpoint = state.endpoint;
SeldonMessageList outputsList = SeldonMessageList.newBuilder().addAllSeldonMessages(outputs).build();
switch(endpoint.getType()) {
case REST:
String dataString = ProtoBufUtils.toJson(outputsList);
return queryREST("aggregate", dataString, state, endpoint, true);
case GRPC:
if (state.type == PredictiveUnitType.UNKNOWN_TYPE) {
GenericBlockingStub stub = GenericGrpc.newBlockingStub(getChannel(endpoint)).withDeadlineAfter(TIMEOUT, TimeUnit.SECONDS);
return stub.aggregate(outputsList);
} else {
CombinerBlockingStub stub = CombinerGrpc.newBlockingStub(getChannel(endpoint)).withDeadlineAfter(TIMEOUT, TimeUnit.SECONDS);
return stub.aggregate(outputsList);
}
}
throw new APIException(APIException.ApiExceptionType.ENGINE_MICROSERVICE_ERROR, "no service available");
}
Aggregations