Search in sources :

Example 16 with Request

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

the class UserRequestAdapter method sendUpdateUDFRequest.

private void sendUpdateUDFRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int partId, UpdateFunc updateFunc, PartitionUpdateParam partParam) {
    // Request header
    RequestHeader header = createRequestHeader(userRequestId, TransportMethod.UPDATE_PSF, matrixId, partId);
    // Request body
    UpdateUDFRequest requestData = new UpdateUDFRequest(updateFunc.getClass().getName(), partParam);
    // Request
    Request request = new Request(header, requestData);
    // Send the request
    matrixClient.sendUpdateRequest(request);
}
Also used : 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) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest)

Example 17 with Request

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

the class UserRequestAdapter method sendIndexGetRowRequest.

private void sendIndexGetRowRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int rowId, int partId, KeyPart keyPart, InitFunc func) {
    // Request header
    RequestHeader header = createRequestHeader(userRequestId, TransportMethod.INDEX_GET_ROW, matrixId, partId);
    // Request body
    IndexPartGetRowRequest requestData = new IndexPartGetRowRequest(rowId, keyPart, func);
    // Request
    Request request = new Request(header, requestData);
    // Send the request
    matrixClient.sendGetRequest(request);
}
Also used : IndexPartGetRowRequest(com.tencent.angel.ps.server.data.request.IndexPartGetRowRequest) 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 18 with Request

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

the class MatrixTransportClient method requestFailed.

private void requestFailed(int seqId, ResponseType failedType, String errorLog) {
    Request request = seqIdToRequestMap.remove(seqId);
    if (request == null) {
        return;
    }
    // Check need retry or not
    if (isOverTryLimit(request, failedType, errorLog)) {
        LOG.error("request " + request + " failed over " + maxTryNum + ", notify to caller");
        FutureResult response = requestToResultMap.remove(request);
        if (response != null) {
            response.setExecuteError(errorLog);
        } else {
            LOG.warn("can not find response for request " + request);
        }
        // Clear the cache for this request
        PSAgentContext.get().getUserRequestAdapter().clear(request.getUserRequestId());
        return;
    }
    rpcContext.after(request.getContext().getServerId());
    seqIdToSendCFMap.remove(seqId);
    // LOG.debug("request failed " + request + ", failedType=" + failedType + ", errorLog=" + errorLog);
    returnChannel(request);
    returnBuffer(request);
    resetContext(request);
    switch(request.getType()) {
        case GET_PART:
        case GET_ROWSPLIT:
        case GET_ROWSSPLIT:
        case GET_PSF:
        case INDEX_GET_ROW:
        case INDEX_GET_ROWS:
            getRequestFailed(request, failedType, errorLog);
            break;
        case PUT_PART:
        case UPDATE:
        case UPDATE_PSF:
        case CHECKPOINT:
            putRequestFailed(request, failedType, errorLog);
            break;
        default:
            LOG.error("unvalid request " + request);
            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)

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