use of com.tencent.angel.protobuf.generated.MLProtos.MatrixClock in project angel by Tencent.
the class MasterClient method getTaskMatrixClocks.
/**
* Get task clocks for all matrices from Master
*
* @return task clocks for all matrices from Master
* @throws ServiceException
*/
public Int2ObjectOpenHashMap<Int2IntOpenHashMap> getTaskMatrixClocks() throws ServiceException {
GetTaskMatrixClockResponse response = masterProxy.getTaskMatrixClocks(null, GetTaskMatrixClockRequest.newBuilder().build());
Int2ObjectOpenHashMap<Int2IntOpenHashMap> taskIdToMatrixClocksMap = new Int2ObjectOpenHashMap<>(response.getTaskMatrixClocksCount());
List<TaskMatrixClock> taskMatrixClocks = response.getTaskMatrixClocksList();
int size = taskMatrixClocks.size();
int matrixNum;
for (int i = 0; i < size; i++) {
Int2IntOpenHashMap matrixIdToClockMap = new Int2IntOpenHashMap(taskMatrixClocks.get(i).getMatrixClocksCount());
taskIdToMatrixClocksMap.put(taskMatrixClocks.get(i).getTaskId().getTaskIndex(), matrixIdToClockMap);
List<MatrixClock> matrixClocks = taskMatrixClocks.get(i).getMatrixClocksList();
matrixNum = matrixClocks.size();
for (int j = 0; j < matrixNum; j++) {
matrixIdToClockMap.put(matrixClocks.get(j).getMatrixId(), matrixClocks.get(j).getClock());
}
}
return taskIdToMatrixClocksMap;
}
Aggregations