Search in sources :

Example 11 with ResponseBody

use of org.apache.flink.runtime.rest.messages.ResponseBody in project flink by apache.

the class JobDetailsHandler method archiveJsonWithPath.

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

Example 12 with ResponseBody

use of org.apache.flink.runtime.rest.messages.ResponseBody in project flink by apache.

the class JobPlanHandler method archiveJsonWithPath.

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

Example 13 with ResponseBody

use of org.apache.flink.runtime.rest.messages.ResponseBody 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 14 with ResponseBody

use of org.apache.flink.runtime.rest.messages.ResponseBody 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 15 with ResponseBody

use of org.apache.flink.runtime.rest.messages.ResponseBody 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)

Aggregations

ResponseBody (org.apache.flink.runtime.rest.messages.ResponseBody)16 ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)15 ArrayList (java.util.ArrayList)8 AccessExecutionJobVertex (org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex)5 ErrorResponseBody (org.apache.flink.runtime.rest.messages.ErrorResponseBody)3 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)2 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)2 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)2 AccessExecution (org.apache.flink.runtime.executiongraph.AccessExecution)2 AccessExecutionVertex (org.apache.flink.runtime.executiongraph.AccessExecutionVertex)2 RestHandlerException (org.apache.flink.runtime.rest.handler.RestHandlerException)2 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 StringWriter (java.io.StringWriter)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1