Search in sources :

Example 16 with ServerPartition

use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.

the class PeriodPusher method recover.

@Override
public FutureResult<Response> recover(RecoverPartKey partKey) {
    FutureResult<Response> result = new FutureResult<>();
    workerPool.execute(() -> {
        ServerPartition part = context.getMatrixStorageManager().getPart(partKey.partKey);
        if (part == null) {
            result.set(new Response(ResponseType.UNKNOWN_ERROR, "Can not find partition " + partKey.partKey.getMatrixId() + ":" + partKey.partKey.getPartitionId()));
            return;
        }
        try {
            result.set(psClient.recoverPart(partKey.psLoc.psId, partKey.psLoc.loc, part).get());
        } catch (Throwable e) {
            LOG.error("recover part " + partKey + " falied ", e);
            result.set(new Response(ResponseType.UNKNOWN_ERROR, e.getMessage()));
        }
    });
    return result;
}
Also used : Response(com.tencent.angel.ml.matrix.transport.Response) FutureResult(com.tencent.angel.psagent.matrix.transport.FutureResult) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 17 with ServerPartition

use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.

the class MatrixCache method update.

/**
 * Update a row split in the cache
 *
 * @param partKey partition key
 * @param rowSplit row split
 */
public void update(PartitionKey partKey, ServerRow rowSplit) {
    ServerPartition partCache = partitionCacheMap.get(partKey);
    if (partCache == null) {
        partitionCacheMap.putIfAbsent(partKey, new ServerPartition(partKey, PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId).getRowType()));
        partCache = partitionCacheMap.get(partKey);
    }
    partCache.update(rowSplit);
}
Also used : ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 18 with ServerPartition

use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.

the class MatrixCache method update.

/**
 * Update a batch row splits in the cache
 *
 * @param partKey partition key
 * @param rowsSplit a batch row splits
 */
public void update(PartitionKey partKey, List<ServerRow> rowsSplit) {
    ServerPartition partCache = partitionCacheMap.get(partKey);
    if (partCache == null) {
        partitionCacheMap.putIfAbsent(partKey, new ServerPartition(partKey, PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId).getRowType()));
        partCache = partitionCacheMap.get(partKey);
    }
    partCache.update(rowsSplit);
}
Also used : ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Aggregations

ServerPartition (com.tencent.angel.ps.impl.matrix.ServerPartition)18 ServerRow (com.tencent.angel.ps.impl.matrix.ServerRow)9 Response (com.tencent.angel.ml.matrix.transport.Response)2 FutureResult (com.tencent.angel.psagent.matrix.transport.FutureResult)2 PartitionKey (com.tencent.angel.PartitionKey)1 ParameterServerId (com.tencent.angel.ps.ParameterServerId)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1