use of com.tencent.angel.ml.matrix.psf.update.base.UpdateParam in project angel by Tencent.
the class UserRequestAdapter method update.
/**
* Update matrix use a udf.
*
* @param updateFunc update udf function
* @return Future<VoidResult> update future result
*/
public Future<VoidResult> update(UpdateFunc updateFunc) {
MatrixTransportClient matrixClient = PSAgentContext.get().getMatrixTransportClient();
UpdateParam param = updateFunc.getParam();
// Split the param use matrix partitions
List<PartitionUpdateParam> partParams = param.split();
int size = partParams.size();
UpdatePSFRequest request = new UpdatePSFRequest(updateFunc);
ResponseCache cache = new MapResponseCache(size);
FutureResult<VoidResult> result = new FutureResult<>();
int requestId = request.getRequestId();
requests.put(requestId, request);
requestIdToResponseCache.put(requestId, cache);
requestIdToResultMap.put(requestId, result);
// Send request to PSS
for (int i = 0; i < size; i++) {
sendUpdateUDFRequest(matrixClient, requestId, partParams.get(i).getMatrixId(), partParams.get(i).getPartKey().getPartitionId(), updateFunc, partParams.get(i));
}
return result;
}
Aggregations