Search in sources :

Example 31 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class JobsOverviewHandler method archiveJsonWithPath.

@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    ResponseBody json = new MultipleJobsDetails(Collections.singleton(JobDetails.createDetailsForJob(graph)));
    String path = getMessageHeaders().getTargetRestEndpointURL().replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
    return Collections.singletonList(new ArchivedJson(path, json));
}
Also used : ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) MultipleJobsDetails(org.apache.flink.runtime.messages.webmonitor.MultipleJobsDetails) ResponseBody(org.apache.flink.runtime.rest.messages.ResponseBody)

Example 32 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class SubtaskExecutionAttemptAccumulatorsHandler method archiveJsonWithPath.

@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;
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution) ArrayList(java.util.ArrayList) AccessExecutionVertex(org.apache.flink.runtime.executiongraph.AccessExecutionVertex) ResponseBody(org.apache.flink.runtime.rest.messages.ResponseBody)

Example 33 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class TaskCheckpointStatisticDetailsHandler method archiveJsonWithPath.

@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;
}
Also used : AbstractCheckpointStats(org.apache.flink.runtime.checkpoint.AbstractCheckpointStats) TaskStateStats(org.apache.flink.runtime.checkpoint.TaskStateStats) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) ArrayList(java.util.ArrayList) CheckpointStatsHistory(org.apache.flink.runtime.checkpoint.CheckpointStatsHistory) CheckpointStatsSnapshot(org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot) ResponseBody(org.apache.flink.runtime.rest.messages.ResponseBody)

Example 34 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class JobVertexTaskManagersHandler method archiveJsonWithPath.

@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;
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) ArrayList(java.util.ArrayList) ResponseBody(org.apache.flink.runtime.rest.messages.ResponseBody)

Example 35 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class WebMonitorEndpoint method archiveJsonWithPath.

@Override
public Collection<ArchivedJson> archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo) throws IOException {
    Collection<ArchivedJson> archivedJson = new ArrayList<>(archivingHandlers.size());
    for (JsonArchivist archivist : archivingHandlers) {
        Collection<ArchivedJson> subArchive = archivist.archiveJsonWithPath(executionGraphInfo);
        archivedJson.addAll(subArchive);
    }
    return archivedJson;
}
Also used : JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) ArrayList(java.util.ArrayList)

Aggregations

ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)35 JsonArchivist (org.apache.flink.runtime.webmonitor.history.JsonArchivist)18 Test (org.junit.Test)17 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)16 ResponseBody (org.apache.flink.runtime.rest.messages.ResponseBody)15 AccessExecutionJobVertex (org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex)12 ArrayList (java.util.ArrayList)10 AccessExecution (org.apache.flink.runtime.executiongraph.AccessExecution)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 JobID (org.apache.flink.api.common.JobID)4 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)4 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)3 AccessExecutionVertex (org.apache.flink.runtime.executiongraph.AccessExecutionVertex)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 TaskStateStats (org.apache.flink.runtime.checkpoint.TaskStateStats)2 RestHandlerException (org.apache.flink.runtime.rest.handler.RestHandlerException)2 ErrorResponseBody (org.apache.flink.runtime.rest.messages.ErrorResponseBody)2