Search in sources :

Example 6 with Request

use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.

the class MatrixTransportClient method removePendingRPCS.

private void removePendingRPCS(PSLocation psLoc) {
    Iterator<Entry<Integer, SendResultKey>> iter = seqIdToSendCFMap.entrySet().iterator();
    Entry<Integer, SendResultKey> entry;
    while (iter.hasNext()) {
        entry = iter.next();
        if (entry.getValue().psLoc.equals(psLoc)) {
            SendResultKey sendResultKey = seqIdToSendCFMap.get(entry.getKey());
            Request request = seqIdToRequestMap.get(entry.getKey());
            if (request != null && request.getContext().getChannel() != null) {
                sendResultKey.cf.cancel(true);
            }
            requestFailed(entry.getKey(), ResponseType.NETWORK_ERROR, "Server no response");
        }
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Entry(java.util.Map.Entry) UserRequest(com.tencent.angel.psagent.matrix.transport.adapter.UserRequest) Request(com.tencent.angel.ps.server.data.request.Request) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest)

Example 7 with Request

use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.

the class MatrixTransportClient method get.

@Override
public FutureResult<PartitionGetResult> get(GetFunc func, PartitionGetParam param) {
    // Request header
    RequestHeader header = createRequestHeader(-1, TransportMethod.GET_PSF, param.getMatrixId(), param.getPartKey().getPartitionId());
    // Request body
    GetUDFRequest requestData = new GetUDFRequest(func.getClass().getName(), param);
    // Request
    Request request = new Request(header, requestData);
    FutureResult<PartitionGetResult> resultFuture = new FutureResult<>();
    requestToResultMap.put(request, resultFuture);
    // Send the request
    sendGetRequest(request);
    return resultFuture;
}
Also used : UserRequest(com.tencent.angel.psagent.matrix.transport.adapter.UserRequest) Request(com.tencent.angel.ps.server.data.request.Request) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest) RequestHeader(com.tencent.angel.ps.server.data.request.RequestHeader) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)

Example 8 with Request

use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.

the class MatrixTransportClient method requestSuccess.

private void requestSuccess(int seqId) {
    Request request = seqIdToRequestMap.remove(seqId);
    if (request == null) {
        return;
    }
    rpcContext.after(request.getContext().getServerId());
    seqIdToSendCFMap.remove(seqId);
    returnChannel(request);
    switch(request.getType()) {
        case GET_PART:
        case GET_ROWSPLIT:
        case GET_ROWSSPLIT:
        case GET_PSF:
        case INDEX_GET_ROW:
        case INDEX_GET_ROWS:
            getRequestSuccess(request);
            break;
        case PUT_PART:
        case UPDATE:
        case UPDATE_PSF:
            putRequestSuccess(request);
            break;
        default:
            LOG.error("unvalid response for request " + request + " with seqId " + seqId);
            break;
    }
}
Also used : UserRequest(com.tencent.angel.psagent.matrix.transport.adapter.UserRequest) Request(com.tencent.angel.ps.server.data.request.Request) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest)

Example 9 with Request

use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.

the class UserRequestAdapter method sendGetRowsRequest.

private void sendGetRowsRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int[] rowIds, int partId) {
    // Request header
    RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_ROWSSPLIT, matrixId, partId);
    // Request body
    GetRowsSplitRequest requestData = new GetRowsSplitRequest(rowIds);
    // Request
    Request request = new Request(header, requestData);
    // Send the request
    matrixClient.sendGetRequest(request);
}
Also used : GetRowsSplitRequest(com.tencent.angel.ps.server.data.request.GetRowsSplitRequest) GetRowSplitRequest(com.tencent.angel.ps.server.data.request.GetRowSplitRequest) UpdateRequest(com.tencent.angel.ps.server.data.request.UpdateRequest) Request(com.tencent.angel.ps.server.data.request.Request) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) GetRowsSplitRequest(com.tencent.angel.ps.server.data.request.GetRowsSplitRequest) IndexPartGetRowRequest(com.tencent.angel.ps.server.data.request.IndexPartGetRowRequest) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest) IndexPartGetRowsRequest(com.tencent.angel.ps.server.data.request.IndexPartGetRowsRequest) RequestHeader(com.tencent.angel.ps.server.data.request.RequestHeader)

Example 10 with Request

use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.

the class UserRequestAdapter method sendGetRowRequest.

private void sendGetRowRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int rowId, int partId) {
    // Request header
    RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_ROWSPLIT, matrixId, partId);
    // Request body
    GetRowSplitRequest requestData = new GetRowSplitRequest(rowId);
    // Request
    Request request = new Request(header, requestData);
    // Send the request
    matrixClient.sendGetRequest(request);
}
Also used : GetRowSplitRequest(com.tencent.angel.ps.server.data.request.GetRowSplitRequest) GetRowSplitRequest(com.tencent.angel.ps.server.data.request.GetRowSplitRequest) UpdateRequest(com.tencent.angel.ps.server.data.request.UpdateRequest) Request(com.tencent.angel.ps.server.data.request.Request) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) GetRowsSplitRequest(com.tencent.angel.ps.server.data.request.GetRowsSplitRequest) IndexPartGetRowRequest(com.tencent.angel.ps.server.data.request.IndexPartGetRowRequest) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest) IndexPartGetRowsRequest(com.tencent.angel.ps.server.data.request.IndexPartGetRowsRequest) RequestHeader(com.tencent.angel.ps.server.data.request.RequestHeader)

Aggregations

Request (com.tencent.angel.ps.server.data.request.Request)18 GetUDFRequest (com.tencent.angel.ps.server.data.request.GetUDFRequest)14 UpdateUDFRequest (com.tencent.angel.ps.server.data.request.UpdateUDFRequest)14 UserRequest (com.tencent.angel.psagent.matrix.transport.adapter.UserRequest)11 RequestHeader (com.tencent.angel.ps.server.data.request.RequestHeader)9 IndexPartGetRowRequest (com.tencent.angel.ps.server.data.request.IndexPartGetRowRequest)8 IndexPartGetRowsRequest (com.tencent.angel.ps.server.data.request.IndexPartGetRowsRequest)8 GetRowSplitRequest (com.tencent.angel.ps.server.data.request.GetRowSplitRequest)7 GetRowsSplitRequest (com.tencent.angel.ps.server.data.request.GetRowsSplitRequest)7 UpdateRequest (com.tencent.angel.ps.server.data.request.UpdateRequest)7 Response (com.tencent.angel.ps.server.data.response.Response)4 Vector (com.tencent.angel.ml.math2.vector.Vector)2 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)2 VoidResult (com.tencent.angel.ml.matrix.psf.update.base.VoidResult)2 RequestContext (com.tencent.angel.ps.server.data.request.RequestContext)2 GetUDFResponse (com.tencent.angel.ps.server.data.response.GetUDFResponse)1 IndexPartGetRowsResponse (com.tencent.angel.ps.server.data.response.IndexPartGetRowsResponse)1 StreamIndexPartGetRowResponse (com.tencent.angel.ps.server.data.response.StreamIndexPartGetRowResponse)1 UpdateUDFResponse (com.tencent.angel.ps.server.data.response.UpdateUDFResponse)1 GetPSFRequest (com.tencent.angel.psagent.matrix.transport.adapter.GetPSFRequest)1