use of com.tencent.angel.ml.matrix.psf.get.base.GetResult in project angel by Tencent.
the class UserRequestAdapter method get.
/**
* Get a row from ps use a udf.
*
* @param func get row udf
* @return GetResult the result of the udf
* @throws ExecutionException exception thrown when attempting to retrieve the result of a task
* that aborted by throwing an exception
* @throws InterruptedException interrupted while wait the result
*/
public FutureResult<GetResult> get(GetFunc func) throws InterruptedException, ExecutionException {
MatrixTransportClient matrixClient = PSAgentContext.get().getMatrixTransportClient();
GetParam param = func.getParam();
// Split param use matrix partitons
List<PartitionGetParam> partParams = param.split();
int size = partParams.size();
GetPSFRequest request = new GetPSFRequest(func);
int requestId = request.getRequestId();
FutureResult<GetResult> result = new FutureResult<>();
ResponseCache cache = new MapResponseCache(size);
requests.put(requestId, request);
requestIdToResponseCache.put(requestId, cache);
requestIdToResultMap.put(requestId, result);
for (int i = 0; i < size; i++) {
sendGetUDFRequest(matrixClient, requestId, partParams.get(i).getMatrixId(), partParams.get(i).getPartKey().getPartitionId(), func, partParams.get(i));
}
return result;
}
Aggregations