Search in sources :

Example 1 with GetRowSplitResponse

use of com.tencent.angel.ps.server.data.response.GetRowSplitResponse in project angel by Tencent.

the class GetRowHandler method handle.

@Override
public ResponseData handle(RequestHeader header, RequestData data) throws Exception {
    GetRowSplitRequest request = (GetRowSplitRequest) data;
    ServerRow row = MatrixUtils.getRow(context.getMatrixStorageManager(), header.matrixId, header.partId, request.getRowId());
    return new GetRowSplitResponse(row);
}
Also used : GetRowSplitRequest(com.tencent.angel.ps.server.data.request.GetRowSplitRequest) GetRowSplitResponse(com.tencent.angel.ps.server.data.response.GetRowSplitResponse) ServerRow(com.tencent.angel.ps.storage.vector.ServerRow)

Example 2 with GetRowSplitResponse

use of com.tencent.angel.ps.server.data.response.GetRowSplitResponse in project angel by Tencent.

the class GetRowHandler method handle.

@Override
public void handle(FutureResult finalResult, UserRequest userRequest, ResponseCache responseCache) {
    GetRowRequest getRowRequest = (GetRowRequest) userRequest;
    MapResponseCache cache = (MapResponseCache) responseCache;
    // Merge the sub-response
    List<ServerRow> serverRows = new ArrayList<>(cache.expectedResponseNum);
    for (Response response : cache.getResponses().values()) {
        serverRows.add(((GetRowSplitResponse) (response.getData())).getRowSplit());
    }
    Vector vector = MergeUtils.combineServerRowSplits(serverRows, getRowRequest.getMatrixId(), getRowRequest.getRowId());
    // Set matrix/row information
    vector.setMatrixId(getRowRequest.getMatrixId());
    vector.setRowId(getRowRequest.getRowId());
    // Set result
    finalResult.set(vector);
}
Also used : Response(com.tencent.angel.ps.server.data.response.Response) GetRowSplitResponse(com.tencent.angel.ps.server.data.response.GetRowSplitResponse) GetRowRequest(com.tencent.angel.psagent.matrix.transport.adapter.GetRowRequest) ArrayList(java.util.ArrayList) ServerRow(com.tencent.angel.ps.storage.vector.ServerRow) Vector(com.tencent.angel.ml.math2.vector.Vector)

Example 3 with GetRowSplitResponse

use of com.tencent.angel.ps.server.data.response.GetRowSplitResponse in project angel by Tencent.

the class GetRowHandler method parseResponse.

@Override
public ResponseData parseResponse(ByteBuf in) {
    GetRowSplitResponse response = new GetRowSplitResponse();
    response.deserialize(in);
    return response;
}
Also used : GetRowSplitResponse(com.tencent.angel.ps.server.data.response.GetRowSplitResponse)

Aggregations

GetRowSplitResponse (com.tencent.angel.ps.server.data.response.GetRowSplitResponse)3 ServerRow (com.tencent.angel.ps.storage.vector.ServerRow)2 Vector (com.tencent.angel.ml.math2.vector.Vector)1 GetRowSplitRequest (com.tencent.angel.ps.server.data.request.GetRowSplitRequest)1 Response (com.tencent.angel.ps.server.data.response.Response)1 GetRowRequest (com.tencent.angel.psagent.matrix.transport.adapter.GetRowRequest)1 ArrayList (java.util.ArrayList)1