Search in sources :

Example 1 with ObjectNotFoundException

use of com.tencent.angel.ps.server.data.exception.ObjectNotFoundException in project angel by Tencent.

the class MatrixUtils method getPart.

public static ServerPartition getPart(MatrixStorageManager storageManager, int matrixId, int partId) {
    ServerMatrix matrix = storageManager.getMatrix(matrixId);
    if (matrix == null) {
        throw new ObjectNotFoundException("Can not find matrix " + matrixId);
    }
    ServerPartition part = matrix.getPartition(partId);
    if (part == null) {
        throw new ObjectNotFoundException("Can not find partition " + partId + " of matrix " + matrixId);
    }
    return part;
}
Also used : ServerMatrix(com.tencent.angel.ps.storage.matrix.ServerMatrix) ObjectNotFoundException(com.tencent.angel.ps.server.data.exception.ObjectNotFoundException) ServerPartition(com.tencent.angel.ps.storage.partition.ServerPartition)

Example 2 with ObjectNotFoundException

use of com.tencent.angel.ps.server.data.exception.ObjectNotFoundException in project angel by Tencent.

the class MatrixUtils method getRow.

public static ServerRow getRow(MatrixStorageManager storageManager, int matrixId, int partId, int rowId) {
    ServerMatrix matrix = storageManager.getMatrix(matrixId);
    if (matrix == null) {
        throw new ObjectNotFoundException("Can not find matrix " + matrixId);
    }
    ServerPartition part = matrix.getPartition(partId);
    if (part == null) {
        throw new ObjectNotFoundException("Can not find partition " + partId + " of matrix " + matrixId);
    }
    if (!(part instanceof RowBasedPartition)) {
        throw new UnsupportedOperationException("Get row only support for RowBasedPartition");
    }
    ServerRow row = ((RowBasedPartition) part).getRow(rowId);
    if (row == null) {
        throw new ObjectNotFoundException("Can not find row " + rowId + " of matrix " + matrixId + " in partition " + partId);
    }
    return row;
}
Also used : ServerMatrix(com.tencent.angel.ps.storage.matrix.ServerMatrix) ObjectNotFoundException(com.tencent.angel.ps.server.data.exception.ObjectNotFoundException) ServerRow(com.tencent.angel.ps.storage.vector.ServerRow) RowBasedPartition(com.tencent.angel.ps.storage.partition.RowBasedPartition) ServerPartition(com.tencent.angel.ps.storage.partition.ServerPartition)

Aggregations

ObjectNotFoundException (com.tencent.angel.ps.server.data.exception.ObjectNotFoundException)2 ServerMatrix (com.tencent.angel.ps.storage.matrix.ServerMatrix)2 ServerPartition (com.tencent.angel.ps.storage.partition.ServerPartition)2 RowBasedPartition (com.tencent.angel.ps.storage.partition.RowBasedPartition)1 ServerRow (com.tencent.angel.ps.storage.vector.ServerRow)1