Search in sources :

Example 1 with GetRowRequest

use of com.tencent.angel.psagent.matrix.transport.adapter.GetRowRequest 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)

Aggregations

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