Search in sources :

Example 1 with GetUDFRequest

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

the class PSFGetHandler method handle.

@Override
public ResponseData handle(RequestHeader header, RequestData data) throws Exception {
    GetUDFRequest request = (GetUDFRequest) data;
    Class<? extends GetFunc> funcClass = (Class<? extends GetFunc>) Class.forName(request.getGetFuncClass());
    Constructor<? extends GetFunc> constructor = funcClass.getConstructor();
    constructor.setAccessible(true);
    GetFunc func = constructor.newInstance();
    // LOG.info("Get PSF func = " + func.getClass().getName());
    func.setPsContext(context);
    PartitionGetResult partResult = func.partitionGet(request.getPartParam());
    return new GetUDFResponse(partResult);
}
Also used : GetFunc(com.tencent.angel.ml.matrix.psf.get.base.GetFunc) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult) GetUDFResponse(com.tencent.angel.ps.server.data.response.GetUDFResponse)

Example 2 with GetUDFRequest

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

the class UserRequestAdapter method sendGetUDFRequest.

private void sendGetUDFRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int partId, GetFunc func, PartitionGetParam partGetParam) {
    // Request header
    RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_PSF, matrixId, partId);
    // Request body
    GetUDFRequest requestData = new GetUDFRequest(func.getClass().getName(), partGetParam);
    // Request
    Request request = new Request(header, requestData);
    // Send the request
    matrixClient.sendGetRequest(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) GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest)

Example 3 with GetUDFRequest

use of com.tencent.angel.ps.server.data.request.GetUDFRequest 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 4 with GetUDFRequest

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

the class PSFGetHandler method parseRequest.

@Override
public RequestData parseRequest(ByteBuf in) {
    GetUDFRequest request = new GetUDFRequest();
    request.deserialize(in);
    return request;
}
Also used : GetUDFRequest(com.tencent.angel.ps.server.data.request.GetUDFRequest)

Aggregations

GetUDFRequest (com.tencent.angel.ps.server.data.request.GetUDFRequest)4 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)2 Request (com.tencent.angel.ps.server.data.request.Request)2 RequestHeader (com.tencent.angel.ps.server.data.request.RequestHeader)2 UpdateUDFRequest (com.tencent.angel.ps.server.data.request.UpdateUDFRequest)2 GetFunc (com.tencent.angel.ml.matrix.psf.get.base.GetFunc)1 GetRowSplitRequest (com.tencent.angel.ps.server.data.request.GetRowSplitRequest)1 GetRowsSplitRequest (com.tencent.angel.ps.server.data.request.GetRowsSplitRequest)1 IndexPartGetRowRequest (com.tencent.angel.ps.server.data.request.IndexPartGetRowRequest)1 IndexPartGetRowsRequest (com.tencent.angel.ps.server.data.request.IndexPartGetRowsRequest)1 UpdateRequest (com.tencent.angel.ps.server.data.request.UpdateRequest)1 GetUDFResponse (com.tencent.angel.ps.server.data.response.GetUDFResponse)1 UserRequest (com.tencent.angel.psagent.matrix.transport.adapter.UserRequest)1