Java源码示例:org.apache.flink.runtime.webmonitor.history.ArchivedJson
示例1
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
for (TaskStateStats subtaskStats : checkpoint.getAllTaskStateStats()) {
ResponseBody json = createCheckpointDetails(checkpoint, subtaskStats);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()))
.replace(':' + JobVertexIdPathParameter.KEY, subtaskStats.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
}
return archive;
}
示例2
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例3
/**
* Reads the given archive file and returns a {@link Collection} of contained {@link ArchivedJson}.
*
* @param file archive to extract
* @return collection of archived jsons
* @throws IOException if the file can't be opened, read or doesn't contain valid json
*/
public static Collection<ArchivedJson> getArchivedJsons(Path file) throws IOException {
try (FSDataInputStream input = file.getFileSystem().open(file);
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
IOUtils.copyBytes(input, output);
JsonNode archive = mapper.readTree(output.toByteArray());
Collection<ArchivedJson> archives = new ArrayList<>();
for (JsonNode archivePart : archive.get(ARCHIVE)) {
String path = archivePart.get(PATH).asText();
String json = archivePart.get(JSON).asText();
archives.add(new ArchivedJson(path, json));
}
return archives;
}
}
示例4
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
for (TaskStateStats subtaskStats : checkpoint.getAllTaskStateStats()) {
ResponseBody json = createCheckpointDetails(checkpoint, subtaskStats);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()))
.replace(':' + JobVertexIdPathParameter.KEY, subtaskStats.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
}
return archive;
}
示例5
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例6
/**
* Reads the given archive file and returns a {@link Collection} of contained {@link ArchivedJson}.
*
* @param file archive to extract
* @return collection of archived jsons
* @throws IOException if the file can't be opened, read or doesn't contain valid json
*/
public static Collection<ArchivedJson> getArchivedJsons(Path file) throws IOException {
try (FSDataInputStream input = file.getFileSystem().open(file);
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
IOUtils.copyBytes(input, output);
JsonNode archive = mapper.readTree(output.toByteArray());
Collection<ArchivedJson> archives = new ArrayList<>();
for (JsonNode archivePart : archive.get(ARCHIVE)) {
String path = archivePart.get(PATH).asText();
String json = archivePart.get(JSON).asText();
archives.add(new ArchivedJson(path, json));
}
return archives;
}
}
示例7
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
for (TaskStateStats subtaskStats : checkpoint.getAllTaskStateStats()) {
ResponseBody json = createCheckpointDetails(checkpoint, subtaskStats);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()))
.replace(':' + JobVertexIdPathParameter.KEY, subtaskStats.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
}
return archive;
}
示例8
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
if (stats == null) {
return Collections.emptyList();
}
CheckpointStatsHistory history = stats.getHistory();
List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例9
/**
* Reads the given archive file and returns a {@link Collection} of contained {@link ArchivedJson}.
*
* @param file archive to extract
* @return collection of archived jsons
* @throws IOException if the file can't be opened, read or doesn't contain valid json
*/
public static Collection<ArchivedJson> getArchivedJsons(Path file) throws IOException {
try (FSDataInputStream input = file.getFileSystem().open(file);
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
IOUtils.copyBytes(input, output);
try {
JsonNode archive = mapper.readTree(output.toByteArray());
Collection<ArchivedJson> archives = new ArrayList<>();
for (JsonNode archivePart : archive.get(ARCHIVE)) {
String path = archivePart.get(PATH).asText();
String json = archivePart.get(JSON).asText();
archives.add(new ArchivedJson(path, json));
}
return archives;
} catch (NullPointerException npe) {
// occurs if the archive is empty or any of the expected fields are not present
throw new IOException("Job archive (" + file.getPath() + ") did not conform to expected format.");
}
}
}
示例10
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<ArchivedJson> archivedJson = new ArrayList<>(archivingHandlers.size());
for (JsonArchivist archivist : archivingHandlers) {
Collection<ArchivedJson> subArchive = archivist.archiveJsonWithPath(graph);
archivedJson.addAll(subArchive);
}
return archivedJson;
}
示例11
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<? extends AccessExecutionJobVertex> allVertices = graph.getAllVertices().values();
List<ArchivedJson> archive = new ArrayList<>(allVertices.size());
for (AccessExecutionJobVertex task : allVertices) {
ResponseBody json = createSubtaskTimesInfo(task);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例12
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobAccumulatorsInfo(graph, true);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例13
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
List<ArchivedJson> archive = new ArrayList<>(16);
for (AccessExecutionJobVertex task : graph.getAllVertices().values()) {
for (AccessExecutionVertex subtask : task.getTaskVertices()) {
ResponseBody curAttemptJson = createDetailsInfo(subtask.getCurrentExecutionAttempt(), graph.getJobID(), task.getJobVertexId(), null);
String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber()));
archive.add(new ArchivedJson(curAttemptPath, curAttemptJson));
for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) {
AccessExecution attempt = subtask.getPriorExecutionAttempt(x);
if (attempt != null) {
ResponseBody json = createDetailsInfo(attempt, graph.getJobID(), task.getJobVertexId(), null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber()));
archive.add(new ArchivedJson(path, json));
}
}
}
}
return archive;
}
示例14
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobPlanInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例15
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<? extends AccessExecutionJobVertex> vertices = graph.getAllVertices().values();
List<ArchivedJson> archive = new ArrayList<>(vertices.size());
for (AccessExecutionJobVertex task : vertices) {
ResponseBody json = createJobVertexTaskManagersInfo(task, graph.getJobID(), null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例16
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singletonList(new ArchivedJson(path, json));
}
示例17
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobExceptionsInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singletonList(new ArchivedJson(path, json));
}
示例18
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobConfigInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例19
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
List<ArchivedJson> archive = new ArrayList<>(16);
for (AccessExecutionJobVertex task : graph.getAllVertices().values()) {
for (AccessExecutionVertex subtask : task.getTaskVertices()) {
ResponseBody curAttemptJson = createAccumulatorInfo(subtask.getCurrentExecutionAttempt());
String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber()));
archive.add(new ArchivedJson(curAttemptPath, curAttemptJson));
for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) {
AccessExecution attempt = subtask.getPriorExecutionAttempt(x);
if (attempt != null){
ResponseBody json = createAccumulatorInfo(attempt);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber()));
archive.add(new ArchivedJson(path, json));
}
}
}
}
return archive;
}
示例20
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<? extends AccessExecutionJobVertex> vertices = graph.getAllVertices().values();
List<ArchivedJson> archive = new ArrayList<>(vertices.size());
for (AccessExecutionJobVertex task : vertices) {
ResponseBody json = createJobVertexDetailsInfo(task, graph.getJobID(), null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例21
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobDetailsInfo(graph, null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例22
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<ArchivedJson> archivedJson = new ArrayList<>(archivingHandlers.size());
for (JsonArchivist archivist : archivingHandlers) {
Collection<ArchivedJson> subArchive = archivist.archiveJsonWithPath(graph);
archivedJson.addAll(subArchive);
}
return archivedJson;
}
示例23
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<? extends AccessExecutionJobVertex> allVertices = graph.getAllVertices().values();
List<ArchivedJson> archive = new ArrayList<>(allVertices.size());
for (AccessExecutionJobVertex task : allVertices) {
ResponseBody json = createSubtaskTimesInfo(task);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例24
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobAccumulatorsInfo(graph, true);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例25
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
List<ArchivedJson> archive = new ArrayList<>(16);
for (AccessExecutionJobVertex task : graph.getAllVertices().values()) {
for (AccessExecutionVertex subtask : task.getTaskVertices()) {
ResponseBody curAttemptJson = createDetailsInfo(subtask.getCurrentExecutionAttempt(), graph.getJobID(), task.getJobVertexId(), null);
String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber()));
archive.add(new ArchivedJson(curAttemptPath, curAttemptJson));
for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) {
AccessExecution attempt = subtask.getPriorExecutionAttempt(x);
if (attempt != null) {
ResponseBody json = createDetailsInfo(attempt, graph.getJobID(), task.getJobVertexId(), null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString())
.replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex()))
.replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber()));
archive.add(new ArchivedJson(path, json));
}
}
}
}
return archive;
}
示例26
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobPlanInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}
示例27
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
Collection<? extends AccessExecutionJobVertex> vertices = graph.getAllVertices().values();
List<ArchivedJson> archive = new ArrayList<>(vertices.size());
for (AccessExecutionJobVertex task : vertices) {
ResponseBody json = createJobVertexTaskManagersInfo(task, graph.getJobID(), null);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
archive.add(new ArchivedJson(path, json));
}
return archive;
}
示例28
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singletonList(new ArchivedJson(path, json));
}
示例29
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobExceptionsInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singletonList(new ArchivedJson(path, json));
}
示例30
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
ResponseBody json = createJobConfigInfo(graph);
String path = getMessageHeaders().getTargetRestEndpointURL()
.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
return Collections.singleton(new ArchivedJson(path, json));
}