Search in sources :

Example 1 with GetMatricesResponse

use of com.tencent.angel.protobuf.generated.PSAgentMasterServiceProtos.GetMatricesResponse in project angel by Tencent.

the class MasterService method getMatrices.

/**
 * Get matrices metadata
 */
@Override
public GetMatricesResponse getMatrices(RpcController controller, GetMatricesRequest request) throws ServiceException {
    GetMatricesResponse.Builder builder = GetMatricesResponse.newBuilder();
    AMMatrixMetaManager matrixMetaManager = context.getMatrixMetaManager();
    List<String> matrixNames = request.getMatrixNamesList();
    int size = matrixNames.size();
    for (int i = 0; i < size; i++) {
        MatrixMeta matrixMeta = matrixMetaManager.getMatrix(matrixNames.get(i));
        if (matrixMeta == null) {
            throw new ServiceException("Can not find matrix " + matrixNames.get(i));
        }
        builder.addMatrixMetas(ProtobufUtil.convertToMatrixMetaProto(matrixMeta));
    }
    return builder.build();
}
Also used : ServiceException(com.google.protobuf.ServiceException) AMMatrixMetaManager(com.tencent.angel.master.matrixmeta.AMMatrixMetaManager) MatrixMeta(com.tencent.angel.ml.matrix.MatrixMeta) GetMatricesResponse(com.tencent.angel.protobuf.generated.PSAgentMasterServiceProtos.GetMatricesResponse)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 AMMatrixMetaManager (com.tencent.angel.master.matrixmeta.AMMatrixMetaManager)1 MatrixMeta (com.tencent.angel.ml.matrix.MatrixMeta)1 GetMatricesResponse (com.tencent.angel.protobuf.generated.PSAgentMasterServiceProtos.GetMatricesResponse)1