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