org.apache.flink.runtime.checkpoint.TaskStateStats Java Examples
The following examples show how to use
org.apache.flink.runtime.checkpoint.TaskStateStats.
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-CEPplus with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails createCheckpointDetails(AbstractCheckpointStats checkpointStats, TaskStateStats taskStatistics) { final TaskCheckpointStatisticsWithSubtaskDetails.Summary summary = createSummary( taskStatistics.getSummaryStats(), checkpointStats.getTriggerTimestamp()); final List<SubtaskCheckpointStatistics> subtaskCheckpointStatistics = createSubtaskCheckpointStatistics( taskStatistics.getSubtaskStats(), checkpointStats.getTriggerTimestamp()); return new TaskCheckpointStatisticsWithSubtaskDetails( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStatistics.getLatestAckTimestamp(), taskStatistics.getStateSize(), taskStatistics.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), taskStatistics.getAlignmentBuffered(), taskStatistics.getNumberOfSubtasks(), taskStatistics.getNumberOfAcknowledgedSubtasks(), summary, subtaskCheckpointStatistics); }
Example #3
Source File: TaskCheckpointStatisticDetailsHandler.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails.Summary createSummary(TaskStateStats.TaskStateStatsSummary taskStatisticsSummary, long triggerTimestamp) { final MinMaxAvgStats stateSizeStats = taskStatisticsSummary.getStateSizeStats(); final MinMaxAvgStats ackTSStats = taskStatisticsSummary.getAckTimestampStats(); final MinMaxAvgStats syncDurationStats = taskStatisticsSummary.getSyncCheckpointDurationStats(); final MinMaxAvgStats asyncDurationStats = taskStatisticsSummary.getAsyncCheckpointDurationStats(); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration checkpointDuration = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration( new MinMaxAvgStatistics(syncDurationStats.getMinimum(), syncDurationStats.getMaximum(), syncDurationStats.getAverage()), new MinMaxAvgStatistics(asyncDurationStats.getMinimum(), asyncDurationStats.getMaximum(), asyncDurationStats.getAverage())); final MinMaxAvgStats alignmentBufferedStats = taskStatisticsSummary.getAlignmentBufferedStats(); final MinMaxAvgStats alignmentDurationStats = taskStatisticsSummary.getAlignmentDurationStats(); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment checkpointAlignment = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment( new MinMaxAvgStatistics(alignmentBufferedStats.getMinimum(), alignmentBufferedStats.getMaximum(), alignmentBufferedStats.getAverage()), new MinMaxAvgStatistics(alignmentDurationStats.getMinimum(), alignmentDurationStats.getMaximum(), alignmentDurationStats.getAverage())); return new TaskCheckpointStatisticsWithSubtaskDetails.Summary( new MinMaxAvgStatistics(stateSizeStats.getMinimum(), stateSizeStats.getMaximum(), stateSizeStats.getAverage()), new MinMaxAvgStatistics( Math.max(0L, ackTSStats.getMinimum() - triggerTimestamp), Math.max(0L, ackTSStats.getMaximum() - triggerTimestamp), Math.max(0L, ackTSStats.getAverage() - triggerTimestamp)), checkpointDuration, checkpointAlignment); }
Example #4
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 #5
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails createCheckpointDetails(AbstractCheckpointStats checkpointStats, TaskStateStats taskStatistics) { final TaskCheckpointStatisticsWithSubtaskDetails.Summary summary = createSummary( taskStatistics.getSummaryStats(), checkpointStats.getTriggerTimestamp()); final List<SubtaskCheckpointStatistics> subtaskCheckpointStatistics = createSubtaskCheckpointStatistics( taskStatistics.getSubtaskStats(), checkpointStats.getTriggerTimestamp()); return new TaskCheckpointStatisticsWithSubtaskDetails( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStatistics.getLatestAckTimestamp(), taskStatistics.getStateSize(), taskStatistics.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), taskStatistics.getAlignmentBuffered(), taskStatistics.getNumberOfSubtasks(), taskStatistics.getNumberOfAcknowledgedSubtasks(), summary, subtaskCheckpointStatistics); }
Example #6
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails.Summary createSummary(TaskStateStats.TaskStateStatsSummary taskStatisticsSummary, long triggerTimestamp) { final MinMaxAvgStats stateSizeStats = taskStatisticsSummary.getStateSizeStats(); final MinMaxAvgStats ackTSStats = taskStatisticsSummary.getAckTimestampStats(); final MinMaxAvgStats syncDurationStats = taskStatisticsSummary.getSyncCheckpointDurationStats(); final MinMaxAvgStats asyncDurationStats = taskStatisticsSummary.getAsyncCheckpointDurationStats(); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration checkpointDuration = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration( new MinMaxAvgStatistics(syncDurationStats.getMinimum(), syncDurationStats.getMaximum(), syncDurationStats.getAverage()), new MinMaxAvgStatistics(asyncDurationStats.getMinimum(), asyncDurationStats.getMaximum(), asyncDurationStats.getAverage())); final MinMaxAvgStats alignmentBufferedStats = taskStatisticsSummary.getAlignmentBufferedStats(); final MinMaxAvgStats alignmentDurationStats = taskStatisticsSummary.getAlignmentDurationStats(); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment checkpointAlignment = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment( new MinMaxAvgStatistics(alignmentBufferedStats.getMinimum(), alignmentBufferedStats.getMaximum(), alignmentBufferedStats.getAverage()), new MinMaxAvgStatistics(alignmentDurationStats.getMinimum(), alignmentDurationStats.getMaximum(), alignmentDurationStats.getAverage())); return new TaskCheckpointStatisticsWithSubtaskDetails.Summary( new MinMaxAvgStatistics(stateSizeStats.getMinimum(), stateSizeStats.getMaximum(), stateSizeStats.getAverage()), new MinMaxAvgStatistics( Math.max(0L, ackTSStats.getMinimum() - triggerTimestamp), Math.max(0L, ackTSStats.getMaximum() - triggerTimestamp), Math.max(0L, ackTSStats.getAverage() - triggerTimestamp)), checkpointDuration, checkpointAlignment); }
Example #7
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 #8
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails createCheckpointDetails(AbstractCheckpointStats checkpointStats, TaskStateStats taskStatistics) { final TaskCheckpointStatisticsWithSubtaskDetails.Summary summary = createSummary( taskStatistics.getSummaryStats(), checkpointStats.getTriggerTimestamp()); final List<SubtaskCheckpointStatistics> subtaskCheckpointStatistics = createSubtaskCheckpointStatistics( taskStatistics.getSubtaskStats(), checkpointStats.getTriggerTimestamp()); return new TaskCheckpointStatisticsWithSubtaskDetails( checkpointStats.getCheckpointId(), checkpointStats.getStatus(), taskStatistics.getLatestAckTimestamp(), taskStatistics.getStateSize(), taskStatistics.getEndToEndDuration(checkpointStats.getTriggerTimestamp()), 0, taskStatistics.getNumberOfSubtasks(), taskStatistics.getNumberOfAcknowledgedSubtasks(), summary, subtaskCheckpointStatistics); }
Example #9
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
private static TaskCheckpointStatisticsWithSubtaskDetails.Summary createSummary(TaskStateStats.TaskStateStatsSummary taskStatisticsSummary, long triggerTimestamp) { final MinMaxAvgStats ackTSStats = taskStatisticsSummary.getAckTimestampStats(); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration checkpointDuration = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration( MinMaxAvgStatistics.valueOf(taskStatisticsSummary.getSyncCheckpointDurationStats()), MinMaxAvgStatistics.valueOf(taskStatisticsSummary.getAsyncCheckpointDurationStats())); final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment checkpointAlignment = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment( new MinMaxAvgStatistics(0, 0, 0), MinMaxAvgStatistics.valueOf(taskStatisticsSummary.getAlignmentDurationStats())); return new TaskCheckpointStatisticsWithSubtaskDetails.Summary( MinMaxAvgStatistics.valueOf(taskStatisticsSummary.getStateSizeStats()), new MinMaxAvgStatistics( Math.max(0L, ackTSStats.getMinimum() - triggerTimestamp), Math.max(0L, ackTSStats.getMaximum() - triggerTimestamp), Math.max(0L, ackTSStats.getAverage() - triggerTimestamp)), checkpointDuration, checkpointAlignment, MinMaxAvgStatistics.valueOf(taskStatisticsSummary.getCheckpointStartDelayStats())); }
Example #10
Source File: TaskCheckpointStatisticDetailsHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest( HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request, AbstractCheckpointStats checkpointStats) throws RestHandlerException { final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class); final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId); if (taskStatistics == null) { throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.'); } return createCheckpointDetails(checkpointStats, taskStatistics); }
Example #11
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest( HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request, AbstractCheckpointStats checkpointStats) throws RestHandlerException { final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class); final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId); if (taskStatistics == null) { throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.'); } return createCheckpointDetails(checkpointStats, taskStatistics); }
Example #12
Source File: TaskCheckpointStatisticDetailsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected TaskCheckpointStatisticsWithSubtaskDetails handleCheckpointRequest( HandlerRequest<EmptyRequestBody, TaskCheckpointMessageParameters> request, AbstractCheckpointStats checkpointStats) throws RestHandlerException { final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class); final TaskStateStats taskStatistics = checkpointStats.getTaskStateStats(jobVertexId); if (taskStatistics == null) { throw new NotFoundException("There is no checkpoint statistics for task " + jobVertexId + '.'); } return createCheckpointDetails(checkpointStats, taskStatistics); }
Example #13
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 #14
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 #15
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."); } }