Java Code Examples for org.apache.flink.runtime.checkpoint.MinMaxAvgStats#getMinimum()

The following examples show how to use org.apache.flink.runtime.checkpoint.MinMaxAvgStats#getMinimum() . 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 vote down vote up
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 2
Source File: TaskCheckpointStatisticDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
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 3
Source File: CheckpointingStatisticsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static CheckpointingStatistics createCheckpointingStatistics(AccessExecutionGraph executionGraph) throws RestHandlerException {
	final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();

	if (checkpointStatsSnapshot == null) {
		throw new RestHandlerException("Checkpointing has not been enabled.", HttpResponseStatus.NOT_FOUND);
	} else {
		final CheckpointStatsCounts checkpointStatsCounts = checkpointStatsSnapshot.getCounts();

		final CheckpointingStatistics.Counts counts = new CheckpointingStatistics.Counts(
			checkpointStatsCounts.getNumberOfRestoredCheckpoints(),
			checkpointStatsCounts.getTotalNumberOfCheckpoints(),
			checkpointStatsCounts.getNumberOfInProgressCheckpoints(),
			checkpointStatsCounts.getNumberOfCompletedCheckpoints(),
			checkpointStatsCounts.getNumberOfFailedCheckpoints());

		final CompletedCheckpointStatsSummary checkpointStatsSummary = checkpointStatsSnapshot.getSummaryStats();
		final MinMaxAvgStats stateSize = checkpointStatsSummary.getStateSizeStats();
		final MinMaxAvgStats duration = checkpointStatsSummary.getEndToEndDurationStats();
		final MinMaxAvgStats alignment = checkpointStatsSummary.getAlignmentBufferedStats();

		final CheckpointingStatistics.Summary summary = new CheckpointingStatistics.Summary(
			new MinMaxAvgStatistics(
				stateSize.getMinimum(),
				stateSize.getMaximum(),
				stateSize.getAverage()),
			new MinMaxAvgStatistics(
				duration.getMinimum(),
				duration.getMaximum(),
				duration.getAverage()),
			new MinMaxAvgStatistics(
				alignment.getMinimum(),
				alignment.getMaximum(),
				alignment.getAverage()));

		final CheckpointStatsHistory checkpointStatsHistory = checkpointStatsSnapshot.getHistory();

		final CheckpointStatistics.CompletedCheckpointStatistics completed = checkpointStatsHistory.getLatestCompletedCheckpoint() != null ?
			(CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestCompletedCheckpoint(),
				false) :
			null;

		final CheckpointStatistics.CompletedCheckpointStatistics savepoint = checkpointStatsHistory.getLatestSavepoint() != null ?
			(CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestSavepoint(),
				false) :
			null;

		final CheckpointStatistics.FailedCheckpointStatistics failed = checkpointStatsHistory.getLatestFailedCheckpoint() != null ?
			(CheckpointStatistics.FailedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestFailedCheckpoint(),
				false) :
			null;

		final RestoredCheckpointStats restoredCheckpointStats = checkpointStatsSnapshot.getLatestRestoredCheckpoint();

		final CheckpointingStatistics.RestoredCheckpointStatistics restored;

		if (restoredCheckpointStats == null) {
			restored = null;
		} else {
			restored = new CheckpointingStatistics.RestoredCheckpointStatistics(
				restoredCheckpointStats.getCheckpointId(),
				restoredCheckpointStats.getRestoreTimestamp(),
				restoredCheckpointStats.getProperties().isSavepoint(),
				restoredCheckpointStats.getExternalPath());
		}

		final CheckpointingStatistics.LatestCheckpoints latestCheckpoints = new CheckpointingStatistics.LatestCheckpoints(
			completed,
			savepoint,
			failed,
			restored);

		final List<CheckpointStatistics> history = new ArrayList<>(16);

		for (AbstractCheckpointStats abstractCheckpointStats : checkpointStatsSnapshot.getHistory().getCheckpoints()) {
			history.add(CheckpointStatistics.generateCheckpointStatistics(abstractCheckpointStats, false));
		}

		return new CheckpointingStatistics(
			counts,
			summary,
			latestCheckpoints,
			history);
	}
}
 
Example 4
Source File: CheckpointingStatisticsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static CheckpointingStatistics createCheckpointingStatistics(AccessExecutionGraph executionGraph) throws RestHandlerException {
	final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();

	if (checkpointStatsSnapshot == null) {
		throw new RestHandlerException("Checkpointing has not been enabled.", HttpResponseStatus.NOT_FOUND);
	} else {
		final CheckpointStatsCounts checkpointStatsCounts = checkpointStatsSnapshot.getCounts();

		final CheckpointingStatistics.Counts counts = new CheckpointingStatistics.Counts(
			checkpointStatsCounts.getNumberOfRestoredCheckpoints(),
			checkpointStatsCounts.getTotalNumberOfCheckpoints(),
			checkpointStatsCounts.getNumberOfInProgressCheckpoints(),
			checkpointStatsCounts.getNumberOfCompletedCheckpoints(),
			checkpointStatsCounts.getNumberOfFailedCheckpoints());

		final CompletedCheckpointStatsSummary checkpointStatsSummary = checkpointStatsSnapshot.getSummaryStats();
		final MinMaxAvgStats stateSize = checkpointStatsSummary.getStateSizeStats();
		final MinMaxAvgStats duration = checkpointStatsSummary.getEndToEndDurationStats();
		final MinMaxAvgStats alignment = checkpointStatsSummary.getAlignmentBufferedStats();

		final CheckpointingStatistics.Summary summary = new CheckpointingStatistics.Summary(
			new MinMaxAvgStatistics(
				stateSize.getMinimum(),
				stateSize.getMaximum(),
				stateSize.getAverage()),
			new MinMaxAvgStatistics(
				duration.getMinimum(),
				duration.getMaximum(),
				duration.getAverage()),
			new MinMaxAvgStatistics(
				alignment.getMinimum(),
				alignment.getMaximum(),
				alignment.getAverage()));

		final CheckpointStatsHistory checkpointStatsHistory = checkpointStatsSnapshot.getHistory();

		final CheckpointStatistics.CompletedCheckpointStatistics completed = checkpointStatsHistory.getLatestCompletedCheckpoint() != null ?
			(CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestCompletedCheckpoint(),
				false) :
			null;

		final CheckpointStatistics.CompletedCheckpointStatistics savepoint = checkpointStatsHistory.getLatestSavepoint() != null ?
			(CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestSavepoint(),
				false) :
			null;

		final CheckpointStatistics.FailedCheckpointStatistics failed = checkpointStatsHistory.getLatestFailedCheckpoint() != null ?
			(CheckpointStatistics.FailedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(
				checkpointStatsHistory.getLatestFailedCheckpoint(),
				false) :
			null;

		final RestoredCheckpointStats restoredCheckpointStats = checkpointStatsSnapshot.getLatestRestoredCheckpoint();

		final CheckpointingStatistics.RestoredCheckpointStatistics restored;

		if (restoredCheckpointStats == null) {
			restored = null;
		} else {
			restored = new CheckpointingStatistics.RestoredCheckpointStatistics(
				restoredCheckpointStats.getCheckpointId(),
				restoredCheckpointStats.getRestoreTimestamp(),
				restoredCheckpointStats.getProperties().isSavepoint(),
				restoredCheckpointStats.getExternalPath());
		}

		final CheckpointingStatistics.LatestCheckpoints latestCheckpoints = new CheckpointingStatistics.LatestCheckpoints(
			completed,
			savepoint,
			failed,
			restored);

		final List<CheckpointStatistics> history = new ArrayList<>(16);

		for (AbstractCheckpointStats abstractCheckpointStats : checkpointStatsSnapshot.getHistory().getCheckpoints()) {
			history.add(CheckpointStatistics.generateCheckpointStatistics(abstractCheckpointStats, false));
		}

		return new CheckpointingStatistics(
			counts,
			summary,
			latestCheckpoints,
			history);
	}
}
 
Example 5
Source File: MinMaxAvgStatistics.java    From flink with Apache License 2.0 4 votes vote down vote up
public static MinMaxAvgStatistics valueOf(MinMaxAvgStats stats) {
	return new MinMaxAvgStatistics(
		stats.getMinimum(),
		stats.getMaximum(),
		stats.getAverage());
}