use of org.apache.flink.runtime.rest.messages.job.SubtasksAllAccumulatorsInfo in project flink by apache.
the class SubtasksAllAccumulatorsHandler method handleRequest.
@Override
protected SubtasksAllAccumulatorsInfo handleRequest(HandlerRequest<EmptyRequestBody> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException {
JobVertexID jobVertexId = jobVertex.getJobVertexId();
int parallelism = jobVertex.getParallelism();
final List<SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo> subtaskAccumulatorsInfos = new ArrayList<>();
for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) {
TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation();
String locationString = location == null ? "(unassigned)" : location.getHostname();
StringifiedAccumulatorResult[] accs = vertex.getCurrentExecutionAttempt().getUserAccumulatorsStringified();
List<UserAccumulator> userAccumulators = new ArrayList<>(accs.length);
for (StringifiedAccumulatorResult acc : accs) {
userAccumulators.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue()));
}
subtaskAccumulatorsInfos.add(new SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo(vertex.getCurrentExecutionAttempt().getParallelSubtaskIndex(), vertex.getCurrentExecutionAttempt().getAttemptNumber(), locationString, userAccumulators));
}
return new SubtasksAllAccumulatorsInfo(jobVertexId, parallelism, subtaskAccumulatorsInfos);
}
Aggregations