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();
}
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;
}
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;
}
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);
}
Aggregations