Search in sources :

Example 1 with UpdateParam

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateParam in project angel by Tencent.

the class MatrixClientAdapter 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();
    List<PartitionUpdateParam> partParams = param.split();
    int size = partParams.size();
    UpdaterRequest request = new UpdaterRequest(param);
    UpdaterResponseCache cache = new UpdaterResponseCache(size);
    for (int i = 0; i < size; i++) {
        cache.addResult(matrixClient.update(updateFunc, partParams.get(i)));
    }
    requestToResponseMap.put(request, cache);
    return cache.getMergedResult();
}
Also used : MatrixTransportClient(com.tencent.angel.psagent.matrix.transport.MatrixTransportClient) PartitionUpdateParam(com.tencent.angel.ml.matrix.psf.update.enhance.PartitionUpdateParam) PartitionUpdateParam(com.tencent.angel.ml.matrix.psf.update.enhance.PartitionUpdateParam) UpdateParam(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateParam)

Aggregations

PartitionUpdateParam (com.tencent.angel.ml.matrix.psf.update.enhance.PartitionUpdateParam)1 UpdateParam (com.tencent.angel.ml.matrix.psf.update.enhance.UpdateParam)1 MatrixTransportClient (com.tencent.angel.psagent.matrix.transport.MatrixTransportClient)1