Search in sources :

Example 1 with UpdateUDFRequest

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

the class PSFUpdateHandler method handle.

@Override
public ResponseData handle(RequestHeader header, RequestData data) throws Exception {
    UpdateUDFRequest request = (UpdateUDFRequest) data;
    Class<? extends UpdateFunc> funcClass = (Class<? extends UpdateFunc>) Class.forName(request.getUpdaterFuncClass());
    Constructor<? extends UpdateFunc> constructor = funcClass.getConstructor();
    constructor.setAccessible(true);
    UpdateFunc func = constructor.newInstance();
    func.setPsContext(context);
    func.partitionUpdate(request.getPartParam());
    return new UpdateUDFResponse();
}
Also used : UpdateFunc(com.tencent.angel.ml.matrix.psf.update.base.UpdateFunc) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest) UpdateUDFResponse(com.tencent.angel.ps.server.data.response.UpdateUDFResponse)

Example 2 with UpdateUDFRequest

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

the class MatrixTransportClient method update.

@Override
public FutureResult<VoidResult> update(UpdateFunc func, PartitionUpdateParam param) {
    // Request header
    RequestHeader header = createRequestHeader(-1, TransportMethod.UPDATE_PSF, param.getMatrixId(), param.getPartKey().getPartitionId());
    // Request body
    UpdateUDFRequest requestData = new UpdateUDFRequest(func.getClass().getName(), param);
    // Request
    Request request = new Request(header, requestData);
    FutureResult<VoidResult> resultFuture = new FutureResult<>();
    requestToResultMap.put(request, resultFuture);
    // Send the request
    sendUpdateRequest(request);
    return resultFuture;
}
Also used : VoidResult(com.tencent.angel.ml.matrix.psf.update.base.VoidResult) 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) UpdateUDFRequest(com.tencent.angel.ps.server.data.request.UpdateUDFRequest)

Example 3 with UpdateUDFRequest

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

the class PSFUpdateHandler method parseRequest.

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

Example 4 with UpdateUDFRequest

use of com.tencent.angel.ps.server.data.request.UpdateUDFRequest 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)

Aggregations

UpdateUDFRequest (com.tencent.angel.ps.server.data.request.UpdateUDFRequest)4 GetUDFRequest (com.tencent.angel.ps.server.data.request.GetUDFRequest)2 Request (com.tencent.angel.ps.server.data.request.Request)2 RequestHeader (com.tencent.angel.ps.server.data.request.RequestHeader)2 UpdateFunc (com.tencent.angel.ml.matrix.psf.update.base.UpdateFunc)1 VoidResult (com.tencent.angel.ml.matrix.psf.update.base.VoidResult)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 UpdateUDFResponse (com.tencent.angel.ps.server.data.response.UpdateUDFResponse)1 UserRequest (com.tencent.angel.psagent.matrix.transport.adapter.UserRequest)1