Java Code Examples for org.apache.flink.runtime.checkpoint.AbstractCheckpointStats#getAllTaskStateStats()
The following examples show how to use
org.apache.flink.runtime.checkpoint.AbstractCheckpointStats#getAllTaskStateStats() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskCheckpointStatisticDetailsHandler.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
@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; }
Example 4
Source File: CheckpointStatistics.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public static CheckpointStatistics generateCheckpointStatistics(AbstractCheckpointStats checkpointStats, boolean includeTaskCheckpointStatistics) { Preconditions.checkNotNull(checkpointStats); Map<JobVertexID, TaskCheckpointStatistics> checkpointStatisticsPerTask; if (includeTaskCheckpointStatistics) { Collection<TaskStateStats> taskStateStats = checkpointStats.getAllTaskStateStats(); checkpointStatisticsPerTask = new HashMap<>(taskStateStats.size()); for (TaskStateStats taskStateStat : taskStateStats) { checkpointStatisticsPerTask.put( taskStateStat.getJobVertexId(), new TaskCheckpointStatistics( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStateStat.getLatestAckTimestamp(), taskStateStat.getStateSize(), taskStateStat.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), taskStateStat.getAlignmentBuffered(), taskStateStat.getNumberOfSubtasks(), taskStateStat.getNumberOfAcknowledgedSubtasks())); } } else { checkpointStatisticsPerTask = Collections.emptyMap(); } if (checkpointStats instanceof CompletedCheckpointStats) { final CompletedCheckpointStats completedCheckpointStats = ((CompletedCheckpointStats) checkpointStats); return new CheckpointStatistics.CompletedCheckpointStatistics( completedCheckpointStats.getCheckpointId(), completedCheckpointStats.getStatus(), completedCheckpointStats.getProperties().isSavepoint(), completedCheckpointStats.getTriggerTimestamp(), completedCheckpointStats.getLatestAckTimestamp(), completedCheckpointStats.getStateSize(), completedCheckpointStats.getEndToEndDuration(), completedCheckpointStats.getAlignmentBuffered(), completedCheckpointStats.getNumberOfSubtasks(), completedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, completedCheckpointStats.getExternalPath(), completedCheckpointStats.isDiscarded()); } else if (checkpointStats instanceof FailedCheckpointStats) { final FailedCheckpointStats failedCheckpointStats = ((FailedCheckpointStats) checkpointStats); return new CheckpointStatistics.FailedCheckpointStatistics( failedCheckpointStats.getCheckpointId(), failedCheckpointStats.getStatus(), failedCheckpointStats.getProperties().isSavepoint(), failedCheckpointStats.getTriggerTimestamp(), failedCheckpointStats.getLatestAckTimestamp(), failedCheckpointStats.getStateSize(), failedCheckpointStats.getEndToEndDuration(), failedCheckpointStats.getAlignmentBuffered(), failedCheckpointStats.getNumberOfSubtasks(), failedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, failedCheckpointStats.getFailureTimestamp(), failedCheckpointStats.getFailureMessage()); } else if (checkpointStats instanceof PendingCheckpointStats) { final PendingCheckpointStats pendingCheckpointStats = ((PendingCheckpointStats) checkpointStats); return new CheckpointStatistics.PendingCheckpointStatistics( pendingCheckpointStats.getCheckpointId(), pendingCheckpointStats.getStatus(), pendingCheckpointStats.getProperties().isSavepoint(), pendingCheckpointStats.getTriggerTimestamp(), pendingCheckpointStats.getLatestAckTimestamp(), pendingCheckpointStats.getStateSize(), pendingCheckpointStats.getEndToEndDuration(), pendingCheckpointStats.getAlignmentBuffered(), pendingCheckpointStats.getNumberOfSubtasks(), pendingCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask ); } else { throw new IllegalArgumentException("Given checkpoint stats object of type " + checkpointStats.getClass().getName() + " cannot be converted."); } }
Example 5
Source File: CheckpointStatistics.java From flink with Apache License 2.0 | 4 votes |
public static CheckpointStatistics generateCheckpointStatistics(AbstractCheckpointStats checkpointStats, boolean includeTaskCheckpointStatistics) { Preconditions.checkNotNull(checkpointStats); Map<JobVertexID, TaskCheckpointStatistics> checkpointStatisticsPerTask; if (includeTaskCheckpointStatistics) { Collection<TaskStateStats> taskStateStats = checkpointStats.getAllTaskStateStats(); checkpointStatisticsPerTask = new HashMap<>(taskStateStats.size()); for (TaskStateStats taskStateStat : taskStateStats) { checkpointStatisticsPerTask.put( taskStateStat.getJobVertexId(), new TaskCheckpointStatistics( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStateStat.getLatestAckTimestamp(), taskStateStat.getStateSize(), taskStateStat.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), taskStateStat.getAlignmentBuffered(), taskStateStat.getNumberOfSubtasks(), taskStateStat.getNumberOfAcknowledgedSubtasks())); } } else { checkpointStatisticsPerTask = Collections.emptyMap(); } if (checkpointStats instanceof CompletedCheckpointStats) { final CompletedCheckpointStats completedCheckpointStats = ((CompletedCheckpointStats) checkpointStats); return new CheckpointStatistics.CompletedCheckpointStatistics( completedCheckpointStats.getCheckpointId(), completedCheckpointStats.getStatus(), completedCheckpointStats.getProperties().isSavepoint(), completedCheckpointStats.getTriggerTimestamp(), completedCheckpointStats.getLatestAckTimestamp(), completedCheckpointStats.getStateSize(), completedCheckpointStats.getEndToEndDuration(), completedCheckpointStats.getAlignmentBuffered(), completedCheckpointStats.getNumberOfSubtasks(), completedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, completedCheckpointStats.getExternalPath(), completedCheckpointStats.isDiscarded()); } else if (checkpointStats instanceof FailedCheckpointStats) { final FailedCheckpointStats failedCheckpointStats = ((FailedCheckpointStats) checkpointStats); return new CheckpointStatistics.FailedCheckpointStatistics( failedCheckpointStats.getCheckpointId(), failedCheckpointStats.getStatus(), failedCheckpointStats.getProperties().isSavepoint(), failedCheckpointStats.getTriggerTimestamp(), failedCheckpointStats.getLatestAckTimestamp(), failedCheckpointStats.getStateSize(), failedCheckpointStats.getEndToEndDuration(), failedCheckpointStats.getAlignmentBuffered(), failedCheckpointStats.getNumberOfSubtasks(), failedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, failedCheckpointStats.getFailureTimestamp(), failedCheckpointStats.getFailureMessage()); } else if (checkpointStats instanceof PendingCheckpointStats) { final PendingCheckpointStats pendingCheckpointStats = ((PendingCheckpointStats) checkpointStats); return new CheckpointStatistics.PendingCheckpointStatistics( pendingCheckpointStats.getCheckpointId(), pendingCheckpointStats.getStatus(), pendingCheckpointStats.getProperties().isSavepoint(), pendingCheckpointStats.getTriggerTimestamp(), pendingCheckpointStats.getLatestAckTimestamp(), pendingCheckpointStats.getStateSize(), pendingCheckpointStats.getEndToEndDuration(), pendingCheckpointStats.getAlignmentBuffered(), pendingCheckpointStats.getNumberOfSubtasks(), pendingCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask ); } else { throw new IllegalArgumentException("Given checkpoint stats object of type " + checkpointStats.getClass().getName() + " cannot be converted."); } }
Example 6
Source File: CheckpointStatistics.java From flink with Apache License 2.0 | 4 votes |
public static CheckpointStatistics generateCheckpointStatistics(AbstractCheckpointStats checkpointStats, boolean includeTaskCheckpointStatistics) { Preconditions.checkNotNull(checkpointStats); Map<JobVertexID, TaskCheckpointStatistics> checkpointStatisticsPerTask; if (includeTaskCheckpointStatistics) { Collection<TaskStateStats> taskStateStats = checkpointStats.getAllTaskStateStats(); checkpointStatisticsPerTask = new HashMap<>(taskStateStats.size()); for (TaskStateStats taskStateStat : taskStateStats) { checkpointStatisticsPerTask.put( taskStateStat.getJobVertexId(), new TaskCheckpointStatistics( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStateStat.getLatestAckTimestamp(), taskStateStat.getStateSize(), taskStateStat.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), 0, taskStateStat.getNumberOfSubtasks(), taskStateStat.getNumberOfAcknowledgedSubtasks())); } } else { checkpointStatisticsPerTask = Collections.emptyMap(); } if (checkpointStats instanceof CompletedCheckpointStats) { final CompletedCheckpointStats completedCheckpointStats = ((CompletedCheckpointStats) checkpointStats); return new CheckpointStatistics.CompletedCheckpointStatistics( completedCheckpointStats.getCheckpointId(), completedCheckpointStats.getStatus(), completedCheckpointStats.getProperties().isSavepoint(), completedCheckpointStats.getTriggerTimestamp(), completedCheckpointStats.getLatestAckTimestamp(), completedCheckpointStats.getStateSize(), completedCheckpointStats.getEndToEndDuration(), 0, completedCheckpointStats.getNumberOfSubtasks(), completedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, completedCheckpointStats.getExternalPath(), completedCheckpointStats.isDiscarded()); } else if (checkpointStats instanceof FailedCheckpointStats) { final FailedCheckpointStats failedCheckpointStats = ((FailedCheckpointStats) checkpointStats); return new CheckpointStatistics.FailedCheckpointStatistics( failedCheckpointStats.getCheckpointId(), failedCheckpointStats.getStatus(), failedCheckpointStats.getProperties().isSavepoint(), failedCheckpointStats.getTriggerTimestamp(), failedCheckpointStats.getLatestAckTimestamp(), failedCheckpointStats.getStateSize(), failedCheckpointStats.getEndToEndDuration(), 0, failedCheckpointStats.getNumberOfSubtasks(), failedCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask, failedCheckpointStats.getFailureTimestamp(), failedCheckpointStats.getFailureMessage()); } else if (checkpointStats instanceof PendingCheckpointStats) { final PendingCheckpointStats pendingCheckpointStats = ((PendingCheckpointStats) checkpointStats); return new CheckpointStatistics.PendingCheckpointStatistics( pendingCheckpointStats.getCheckpointId(), pendingCheckpointStats.getStatus(), pendingCheckpointStats.getProperties().isSavepoint(), pendingCheckpointStats.getTriggerTimestamp(), pendingCheckpointStats.getLatestAckTimestamp(), pendingCheckpointStats.getStateSize(), pendingCheckpointStats.getEndToEndDuration(), 0, pendingCheckpointStats.getNumberOfSubtasks(), pendingCheckpointStats.getNumberOfAcknowledgedSubtasks(), checkpointStatisticsPerTask ); } else { throw new IllegalArgumentException("Given checkpoint stats object of type " + checkpointStats.getClass().getName() + " cannot be converted."); } }