Search in sources :

Example 21 with FutureResult

use of com.tencent.angel.psagent.matrix.transport.FutureResult in project angel by Tencent.

the class MatrixClientImpl method asyncIncrement.

@Override
public Future<VoidResult> asyncIncrement(int[] rowIds, Vector[] rows) throws AngelException {
    checkNotNull(rowIds, "rowIds");
    checkNotNull(rows, "rows");
    assert rowIds.length == rows.length;
    // Just return
    if (rowIds.length == 0) {
        LOG.warn("parameter rowIds is empty, you should check it, just return now!!!");
        FutureResult result = new FutureResult<VoidResult>();
        result.set(new VoidResult(ResponseType.SUCCESS));
        return result;
    }
    return PSAgentContext.get().getUserRequestAdapter().update(matrixId, rowIds, rows, UpdateOp.PLUS);
}
Also used : FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult) VoidResult(com.tencent.angel.ml.matrix.psf.update.base.VoidResult)

Example 22 with FutureResult

use of com.tencent.angel.psagent.matrix.transport.FutureResult in project angel by Tencent.

the class MatrixClientImpl method flush.

@Deprecated
@Override
public Future<VoidResult> flush() throws AngelException {
    FutureResult<VoidResult> result = new FutureResult<>();
    result.set(new VoidResult(ResponseType.SUCCESS));
    return result;
// return PSAgentContext.get().getMatrixOpLogCache().flush(taskContext, matrixId);
}
Also used : VoidResult(com.tencent.angel.ml.matrix.psf.update.base.VoidResult) FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult)

Example 23 with FutureResult

use of com.tencent.angel.psagent.matrix.transport.FutureResult in project angel by Tencent.

the class MatrixClientImpl method asyncInitAndGet.

@Override
public Future<Vector[]> asyncInitAndGet(int[] rowIds, long[] indices, InitFunc func) throws AngelException {
    checkNotNull(rowIds, "rowIds");
    checkNotNull(indices, "indices");
    if (rowIds.length == 0) {
        LOG.warn("parameter rowIds is empty, you should check it, just return a empty vector array now!!!");
        FutureResult<Vector[]> result = new FutureResult<>();
        result.set(new Vector[0]);
        return result;
    }
    // Return a empty vector
    if (indices.length == 0) {
        LOG.warn("parameter indices is empty, you should check it, just return empty vectors now!!!");
        FutureResult<Vector[]> result = new FutureResult<>();
        result.set(generateEmptyVecs(rowIds));
        return result;
    }
    try {
        return PSAgentContext.get().getUserRequestAdapter().get(matrixId, rowIds, indices, func);
    } catch (Throwable x) {
        throw new AngelException(x);
    }
}
Also used : AngelException(com.tencent.angel.exception.AngelException) FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult)

Example 24 with FutureResult

use of com.tencent.angel.psagent.matrix.transport.FutureResult in project angel by Tencent.

the class MatrixClientImpl method asyncInitAndGet.

@Override
public Future<Vector[]> asyncInitAndGet(int[] rowIds, int[] indices, InitFunc func) throws AngelException {
    checkNotNull(rowIds, "rowIds");
    checkNotNull(indices, "indices");
    if (rowIds.length == 0) {
        LOG.warn("parameter rowIds is empty, you should check it, just return a empty vector array now!!!");
        FutureResult<Vector[]> result = new FutureResult<>();
        result.set(new Vector[0]);
        return result;
    }
    // Return a empty vector
    if (indices.length == 0) {
        LOG.warn("parameter indices is empty, you should check it, just return empty vectors now!!!");
        FutureResult<Vector[]> result = new FutureResult<>();
        result.set(generateEmptyVecs(rowIds));
        return result;
    }
    try {
        return PSAgentContext.get().getUserRequestAdapter().get(matrixId, rowIds, indices, func);
    } catch (Throwable x) {
        throw new AngelException(x);
    }
}
Also used : AngelException(com.tencent.angel.exception.AngelException) FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult)

Example 25 with FutureResult

use of com.tencent.angel.psagent.matrix.transport.FutureResult in project angel by Tencent.

the class MatrixClientImpl method clock.

@Deprecated
@Override
public Future<VoidResult> clock(boolean flushFirst) throws AngelException {
    FutureResult<VoidResult> result = new FutureResult<>();
    result.set(new VoidResult(ResponseType.SUCCESS));
    return result;
// return PSAgentContext.get().getConsistencyController().clock(taskContext, matrixId, flushFirst);
}
Also used : VoidResult(com.tencent.angel.ml.matrix.psf.update.base.VoidResult) FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult)

Aggregations

FutureResult (com.tencent.angel.psagent.matrix.transport.FutureResult)29 PartitionKey (com.tencent.angel.PartitionKey)10 AngelException (com.tencent.angel.exception.AngelException)10 MatrixTransportClient (com.tencent.angel.psagent.matrix.transport.MatrixTransportClient)9 MapResponseCache (com.tencent.angel.psagent.matrix.transport.response.MapResponseCache)9 ResponseCache (com.tencent.angel.psagent.matrix.transport.response.ResponseCache)9 VoidResult (com.tencent.angel.ml.matrix.psf.update.base.VoidResult)8 Vector (com.tencent.angel.ml.math2.vector.Vector)6 MatrixMeta (com.tencent.angel.ml.matrix.MatrixMeta)5 Response (com.tencent.angel.ml.matrix.transport.Response)4 CompStreamKeyValuePart (com.tencent.angel.psagent.matrix.transport.router.CompStreamKeyValuePart)3 ServerPartition (com.tencent.angel.ps.impl.matrix.ServerPartition)2 KeyPart (com.tencent.angel.psagent.matrix.transport.router.KeyPart)2 ByteBuf (io.netty.buffer.ByteBuf)2 ArrayList (java.util.ArrayList)2 ExecutionException (java.util.concurrent.ExecutionException)2 GetParam (com.tencent.angel.ml.matrix.psf.get.base.GetParam)1 GetResult (com.tencent.angel.ml.matrix.psf.get.base.GetResult)1 PartitionGetParam (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam)1 PartitionUpdateParam (com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam)1