org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot Java Examples

The following examples show how to use org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot. 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 Project: Flink-CEPplus   Author: ljygz   File: AbstractCheckpointHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionGraph executionGraph) throws RestHandlerException {
	final long checkpointId = request.getPathParameter(CheckpointIdPathParameter.class);

	final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();

	if (checkpointStatsSnapshot != null) {
		AbstractCheckpointStats checkpointStats = checkpointStatsSnapshot.getHistory().getCheckpointById(checkpointId);

		if (checkpointStats != null) {
			checkpointStatsCache.tryAdd(checkpointStats);
		} else {
			checkpointStats = checkpointStatsCache.tryGet(checkpointId);
		}

		if (checkpointStats != null) {
			return handleCheckpointRequest(request, checkpointStats);
		} else {
			throw new RestHandlerException("Could not find checkpointing statistics for checkpoint " + checkpointId + '.', HttpResponseStatus.NOT_FOUND);
		}
	} else {
		throw new RestHandlerException("Checkpointing was not enabled for job " + executionGraph.getJobID() + '.', HttpResponseStatus.NOT_FOUND);
	}
}
 
Example #2
Source Project: Flink-CEPplus   Author: ljygz   File: TaskCheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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 Project: Flink-CEPplus   Author: ljygz   File: CheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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()) {
		ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #4
Source Project: flink   Author: flink-tpc-ds   File: AbstractCheckpointHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionGraph executionGraph) throws RestHandlerException {
	final long checkpointId = request.getPathParameter(CheckpointIdPathParameter.class);

	final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();

	if (checkpointStatsSnapshot != null) {
		AbstractCheckpointStats checkpointStats = checkpointStatsSnapshot.getHistory().getCheckpointById(checkpointId);

		if (checkpointStats != null) {
			checkpointStatsCache.tryAdd(checkpointStats);
		} else {
			checkpointStats = checkpointStatsCache.tryGet(checkpointId);
		}

		if (checkpointStats != null) {
			return handleCheckpointRequest(request, checkpointStats);
		} else {
			throw new RestHandlerException("Could not find checkpointing statistics for checkpoint " + checkpointId + '.', HttpResponseStatus.NOT_FOUND);
		}
	} else {
		throw new RestHandlerException("Checkpointing was not enabled for job " + executionGraph.getJobID() + '.', HttpResponseStatus.NOT_FOUND);
	}
}
 
Example #5
Source Project: flink   Author: flink-tpc-ds   File: TaskCheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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 #6
Source Project: flink   Author: flink-tpc-ds   File: CheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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()) {
		ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #7
Source Project: flink   Author: apache   File: AbstractCheckpointHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionGraph executionGraph) throws RestHandlerException {
	final long checkpointId = request.getPathParameter(CheckpointIdPathParameter.class);

	final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();

	if (checkpointStatsSnapshot != null) {
		AbstractCheckpointStats checkpointStats = checkpointStatsSnapshot.getHistory().getCheckpointById(checkpointId);

		if (checkpointStats != null) {
			checkpointStatsCache.tryAdd(checkpointStats);
		} else {
			checkpointStats = checkpointStatsCache.tryGet(checkpointId);
		}

		if (checkpointStats != null) {
			return handleCheckpointRequest(request, checkpointStats);
		} else {
			throw new RestHandlerException("Could not find checkpointing statistics for checkpoint " + checkpointId + '.', HttpResponseStatus.NOT_FOUND);
		}
	} else {
		throw new RestHandlerException("Checkpointing was not enabled for job " + executionGraph.getJobID() + '.', HttpResponseStatus.NOT_FOUND);
	}
}
 
Example #8
Source Project: flink   Author: apache   File: TaskCheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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 #9
Source Project: flink   Author: apache   File: CheckpointStatisticDetailsHandler.java    License: Apache License 2.0 6 votes vote down vote up
@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()) {
		ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #10
Source Project: Flink-CEPplus   Author: ljygz   File: ExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	if (checkpointStatsTracker != null) {
		return checkpointStatsTracker.createSnapshot();
	} else {
		return null;
	}
}
 
Example #11
Source Project: Flink-CEPplus   Author: ljygz   File: ArchivedExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
public ArchivedExecutionGraph(
		JobID jobID,
		String jobName,
		Map<JobVertexID, ArchivedExecutionJobVertex> tasks,
		List<ArchivedExecutionJobVertex> verticesInCreationOrder,
		long[] stateTimestamps,
		JobStatus state,
		@Nullable ErrorInfo failureCause,
		String jsonPlan,
		StringifiedAccumulatorResult[] archivedUserAccumulators,
		Map<String, SerializedValue<OptionalFailure<Object>>> serializedUserAccumulators,
		ArchivedExecutionConfig executionConfig,
		boolean isStoppable,
		@Nullable CheckpointCoordinatorConfiguration jobCheckpointingConfiguration,
		@Nullable CheckpointStatsSnapshot checkpointStatsSnapshot) {

	this.jobID = Preconditions.checkNotNull(jobID);
	this.jobName = Preconditions.checkNotNull(jobName);
	this.tasks = Preconditions.checkNotNull(tasks);
	this.verticesInCreationOrder = Preconditions.checkNotNull(verticesInCreationOrder);
	this.stateTimestamps = Preconditions.checkNotNull(stateTimestamps);
	this.state = Preconditions.checkNotNull(state);
	this.failureCause = failureCause;
	this.jsonPlan = Preconditions.checkNotNull(jsonPlan);
	this.archivedUserAccumulators = Preconditions.checkNotNull(archivedUserAccumulators);
	this.serializedUserAccumulators = Preconditions.checkNotNull(serializedUserAccumulators);
	this.archivedExecutionConfig = Preconditions.checkNotNull(executionConfig);
	this.isStoppable = isStoppable;
	this.jobCheckpointingConfiguration = jobCheckpointingConfiguration;
	this.checkpointStatsSnapshot = checkpointStatsSnapshot;
}
 
Example #12
Source Project: flink   Author: flink-tpc-ds   File: ExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	if (checkpointStatsTracker != null) {
		return checkpointStatsTracker.createSnapshot();
	} else {
		return null;
	}
}
 
Example #13
Source Project: flink   Author: flink-tpc-ds   File: ArchivedExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
public ArchivedExecutionGraph(
		JobID jobID,
		String jobName,
		Map<JobVertexID, ArchivedExecutionJobVertex> tasks,
		List<ArchivedExecutionJobVertex> verticesInCreationOrder,
		long[] stateTimestamps,
		JobStatus state,
		@Nullable ErrorInfo failureCause,
		String jsonPlan,
		StringifiedAccumulatorResult[] archivedUserAccumulators,
		Map<String, SerializedValue<OptionalFailure<Object>>> serializedUserAccumulators,
		ArchivedExecutionConfig executionConfig,
		boolean isStoppable,
		@Nullable CheckpointCoordinatorConfiguration jobCheckpointingConfiguration,
		@Nullable CheckpointStatsSnapshot checkpointStatsSnapshot) {

	this.jobID = Preconditions.checkNotNull(jobID);
	this.jobName = Preconditions.checkNotNull(jobName);
	this.tasks = Preconditions.checkNotNull(tasks);
	this.verticesInCreationOrder = Preconditions.checkNotNull(verticesInCreationOrder);
	this.stateTimestamps = Preconditions.checkNotNull(stateTimestamps);
	this.state = Preconditions.checkNotNull(state);
	this.failureCause = failureCause;
	this.jsonPlan = Preconditions.checkNotNull(jsonPlan);
	this.archivedUserAccumulators = Preconditions.checkNotNull(archivedUserAccumulators);
	this.serializedUserAccumulators = Preconditions.checkNotNull(serializedUserAccumulators);
	this.archivedExecutionConfig = Preconditions.checkNotNull(executionConfig);
	this.isStoppable = isStoppable;
	this.jobCheckpointingConfiguration = jobCheckpointingConfiguration;
	this.checkpointStatsSnapshot = checkpointStatsSnapshot;
}
 
Example #14
Source Project: flink   Author: apache   File: ExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	if (checkpointStatsTracker != null) {
		return checkpointStatsTracker.createSnapshot();
	} else {
		return null;
	}
}
 
Example #15
Source Project: flink   Author: apache   File: ArchivedExecutionGraph.java    License: Apache License 2.0 5 votes vote down vote up
public ArchivedExecutionGraph(
		JobID jobID,
		String jobName,
		Map<JobVertexID, ArchivedExecutionJobVertex> tasks,
		List<ArchivedExecutionJobVertex> verticesInCreationOrder,
		long[] stateTimestamps,
		JobStatus state,
		@Nullable ErrorInfo failureCause,
		String jsonPlan,
		StringifiedAccumulatorResult[] archivedUserAccumulators,
		Map<String, SerializedValue<OptionalFailure<Object>>> serializedUserAccumulators,
		ArchivedExecutionConfig executionConfig,
		boolean isStoppable,
		@Nullable CheckpointCoordinatorConfiguration jobCheckpointingConfiguration,
		@Nullable CheckpointStatsSnapshot checkpointStatsSnapshot,
		@Nullable String stateBackendName) {

	this.jobID = Preconditions.checkNotNull(jobID);
	this.jobName = Preconditions.checkNotNull(jobName);
	this.tasks = Preconditions.checkNotNull(tasks);
	this.verticesInCreationOrder = Preconditions.checkNotNull(verticesInCreationOrder);
	this.stateTimestamps = Preconditions.checkNotNull(stateTimestamps);
	this.state = Preconditions.checkNotNull(state);
	this.failureCause = failureCause;
	this.jsonPlan = Preconditions.checkNotNull(jsonPlan);
	this.archivedUserAccumulators = Preconditions.checkNotNull(archivedUserAccumulators);
	this.serializedUserAccumulators = Preconditions.checkNotNull(serializedUserAccumulators);
	this.archivedExecutionConfig = Preconditions.checkNotNull(executionConfig);
	this.isStoppable = isStoppable;
	this.jobCheckpointingConfiguration = jobCheckpointingConfiguration;
	this.checkpointStatsSnapshot = checkpointStatsSnapshot;
	this.stateBackendName = stateBackendName;
}
 
Example #16
Source Project: Flink-CEPplus   Author: ljygz   File: CheckpointingStatisticsHandler.java    License: 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 #17
Source Project: Flink-CEPplus   Author: ljygz   File: ArchivedExecutionGraph.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	return checkpointStatsSnapshot;
}
 
Example #18
Source Project: Flink-CEPplus   Author: ljygz   File: ArchivedExecutionGraphTest.java    License: Apache License 2.0 4 votes vote down vote up
private static void compareExecutionGraph(AccessExecutionGraph runtimeGraph, AccessExecutionGraph archivedGraph) throws IOException, ClassNotFoundException {
	assertTrue(archivedGraph.isArchived());
	// -------------------------------------------------------------------------------------------------------------
	// ExecutionGraph
	// -------------------------------------------------------------------------------------------------------------
	assertEquals(runtimeGraph.getJsonPlan(), archivedGraph.getJsonPlan());
	assertEquals(runtimeGraph.getJobID(), archivedGraph.getJobID());
	assertEquals(runtimeGraph.getJobName(), archivedGraph.getJobName());
	assertEquals(runtimeGraph.getState(), archivedGraph.getState());
	assertEquals(runtimeGraph.getFailureInfo().getExceptionAsString(), archivedGraph.getFailureInfo().getExceptionAsString());
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CREATED), archivedGraph.getStatusTimestamp(JobStatus.CREATED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RUNNING), archivedGraph.getStatusTimestamp(JobStatus.RUNNING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILING), archivedGraph.getStatusTimestamp(JobStatus.FAILING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILED), archivedGraph.getStatusTimestamp(JobStatus.FAILED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELLING), archivedGraph.getStatusTimestamp(JobStatus.CANCELLING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELED), archivedGraph.getStatusTimestamp(JobStatus.CANCELED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FINISHED), archivedGraph.getStatusTimestamp(JobStatus.FINISHED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RESTARTING), archivedGraph.getStatusTimestamp(JobStatus.RESTARTING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.SUSPENDED), archivedGraph.getStatusTimestamp(JobStatus.SUSPENDED));
	assertEquals(runtimeGraph.isStoppable(), archivedGraph.isStoppable());

	// -------------------------------------------------------------------------------------------------------------
	// CheckpointStats
	// -------------------------------------------------------------------------------------------------------------
	CheckpointStatsSnapshot runtimeSnapshot = runtimeGraph.getCheckpointStatsSnapshot();
	CheckpointStatsSnapshot archivedSnapshot = archivedGraph.getCheckpointStatsSnapshot();

	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum());

	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getAverage(), archivedSnapshot.getSummaryStats().getStateSizeStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMinimum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMaximum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMaximum());

	assertEquals(runtimeSnapshot.getCounts().getTotalNumberOfCheckpoints(), archivedSnapshot.getCounts().getTotalNumberOfCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfCompletedCheckpoints(), archivedSnapshot.getCounts().getNumberOfCompletedCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfInProgressCheckpoints(), archivedSnapshot.getCounts().getNumberOfInProgressCheckpoints());

	// -------------------------------------------------------------------------------------------------------------
	// ArchivedExecutionConfig
	// -------------------------------------------------------------------------------------------------------------
	ArchivedExecutionConfig runtimeConfig = runtimeGraph.getArchivedExecutionConfig();
	ArchivedExecutionConfig archivedConfig = archivedGraph.getArchivedExecutionConfig();

	assertEquals(runtimeConfig.getExecutionMode(), archivedConfig.getExecutionMode());
	assertEquals(runtimeConfig.getParallelism(), archivedConfig.getParallelism());
	assertEquals(runtimeConfig.getObjectReuseEnabled(), archivedConfig.getObjectReuseEnabled());
	assertEquals(runtimeConfig.getRestartStrategyDescription(), archivedConfig.getRestartStrategyDescription());
	assertNotNull(archivedConfig.getGlobalJobParameters().get("hello"));
	assertEquals(runtimeConfig.getGlobalJobParameters().get("hello"), archivedConfig.getGlobalJobParameters().get("hello"));

	// -------------------------------------------------------------------------------------------------------------
	// StringifiedAccumulators
	// -------------------------------------------------------------------------------------------------------------
	compareStringifiedAccumulators(runtimeGraph.getAccumulatorResultsStringified(), archivedGraph.getAccumulatorResultsStringified());
	compareSerializedAccumulators(runtimeGraph.getAccumulatorsSerialized(), archivedGraph.getAccumulatorsSerialized());

	// -------------------------------------------------------------------------------------------------------------
	// JobVertices
	// -------------------------------------------------------------------------------------------------------------
	Map<JobVertexID, ? extends AccessExecutionJobVertex> runtimeVertices = runtimeGraph.getAllVertices();
	Map<JobVertexID, ? extends AccessExecutionJobVertex> archivedVertices = archivedGraph.getAllVertices();

	for (Map.Entry<JobVertexID, ? extends AccessExecutionJobVertex> vertex : runtimeVertices.entrySet()) {
		compareExecutionJobVertex(vertex.getValue(), archivedVertices.get(vertex.getKey()));
	}

	Iterator<? extends AccessExecutionJobVertex> runtimeTopologicalVertices = runtimeGraph.getVerticesTopologically().iterator();
	Iterator<? extends AccessExecutionJobVertex> archiveTopologicaldVertices = archivedGraph.getVerticesTopologically().iterator();

	while (runtimeTopologicalVertices.hasNext()) {
		assertTrue(archiveTopologicaldVertices.hasNext());
		compareExecutionJobVertex(runtimeTopologicalVertices.next(), archiveTopologicaldVertices.next());
	}

	// -------------------------------------------------------------------------------------------------------------
	// ExecutionVertices
	// -------------------------------------------------------------------------------------------------------------
	Iterator<? extends AccessExecutionVertex> runtimeExecutionVertices = runtimeGraph.getAllExecutionVertices().iterator();
	Iterator<? extends AccessExecutionVertex> archivedExecutionVertices = archivedGraph.getAllExecutionVertices().iterator();

	while (runtimeExecutionVertices.hasNext()) {
		assertTrue(archivedExecutionVertices.hasNext());
		compareExecutionVertex(runtimeExecutionVertices.next(), archivedExecutionVertices.next());
	}
}
 
Example #19
Source Project: flink   Author: flink-tpc-ds   File: CheckpointingStatisticsHandler.java    License: 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 #20
Source Project: flink   Author: flink-tpc-ds   File: ArchivedExecutionGraph.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	return checkpointStatsSnapshot;
}
 
Example #21
Source Project: flink   Author: flink-tpc-ds   File: ArchivedExecutionGraphTest.java    License: Apache License 2.0 4 votes vote down vote up
private static void compareExecutionGraph(AccessExecutionGraph runtimeGraph, AccessExecutionGraph archivedGraph) throws IOException, ClassNotFoundException {
	assertTrue(archivedGraph.isArchived());
	// -------------------------------------------------------------------------------------------------------------
	// ExecutionGraph
	// -------------------------------------------------------------------------------------------------------------
	assertEquals(runtimeGraph.getJsonPlan(), archivedGraph.getJsonPlan());
	assertEquals(runtimeGraph.getJobID(), archivedGraph.getJobID());
	assertEquals(runtimeGraph.getJobName(), archivedGraph.getJobName());
	assertEquals(runtimeGraph.getState(), archivedGraph.getState());
	assertEquals(runtimeGraph.getFailureInfo().getExceptionAsString(), archivedGraph.getFailureInfo().getExceptionAsString());
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CREATED), archivedGraph.getStatusTimestamp(JobStatus.CREATED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RUNNING), archivedGraph.getStatusTimestamp(JobStatus.RUNNING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILING), archivedGraph.getStatusTimestamp(JobStatus.FAILING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILED), archivedGraph.getStatusTimestamp(JobStatus.FAILED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELLING), archivedGraph.getStatusTimestamp(JobStatus.CANCELLING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELED), archivedGraph.getStatusTimestamp(JobStatus.CANCELED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FINISHED), archivedGraph.getStatusTimestamp(JobStatus.FINISHED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RESTARTING), archivedGraph.getStatusTimestamp(JobStatus.RESTARTING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.SUSPENDED), archivedGraph.getStatusTimestamp(JobStatus.SUSPENDED));
	assertEquals(runtimeGraph.isStoppable(), archivedGraph.isStoppable());

	// -------------------------------------------------------------------------------------------------------------
	// CheckpointStats
	// -------------------------------------------------------------------------------------------------------------
	CheckpointStatsSnapshot runtimeSnapshot = runtimeGraph.getCheckpointStatsSnapshot();
	CheckpointStatsSnapshot archivedSnapshot = archivedGraph.getCheckpointStatsSnapshot();

	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum());

	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getAverage(), archivedSnapshot.getSummaryStats().getStateSizeStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMinimum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMaximum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMaximum());

	assertEquals(runtimeSnapshot.getCounts().getTotalNumberOfCheckpoints(), archivedSnapshot.getCounts().getTotalNumberOfCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfCompletedCheckpoints(), archivedSnapshot.getCounts().getNumberOfCompletedCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfInProgressCheckpoints(), archivedSnapshot.getCounts().getNumberOfInProgressCheckpoints());

	// -------------------------------------------------------------------------------------------------------------
	// ArchivedExecutionConfig
	// -------------------------------------------------------------------------------------------------------------
	ArchivedExecutionConfig runtimeConfig = runtimeGraph.getArchivedExecutionConfig();
	ArchivedExecutionConfig archivedConfig = archivedGraph.getArchivedExecutionConfig();

	assertEquals(runtimeConfig.getExecutionMode(), archivedConfig.getExecutionMode());
	assertEquals(runtimeConfig.getParallelism(), archivedConfig.getParallelism());
	assertEquals(runtimeConfig.getObjectReuseEnabled(), archivedConfig.getObjectReuseEnabled());
	assertEquals(runtimeConfig.getRestartStrategyDescription(), archivedConfig.getRestartStrategyDescription());
	assertNotNull(archivedConfig.getGlobalJobParameters().get("hello"));
	assertEquals(runtimeConfig.getGlobalJobParameters().get("hello"), archivedConfig.getGlobalJobParameters().get("hello"));

	// -------------------------------------------------------------------------------------------------------------
	// StringifiedAccumulators
	// -------------------------------------------------------------------------------------------------------------
	compareStringifiedAccumulators(runtimeGraph.getAccumulatorResultsStringified(), archivedGraph.getAccumulatorResultsStringified());
	compareSerializedAccumulators(runtimeGraph.getAccumulatorsSerialized(), archivedGraph.getAccumulatorsSerialized());

	// -------------------------------------------------------------------------------------------------------------
	// JobVertices
	// -------------------------------------------------------------------------------------------------------------
	Map<JobVertexID, ? extends AccessExecutionJobVertex> runtimeVertices = runtimeGraph.getAllVertices();
	Map<JobVertexID, ? extends AccessExecutionJobVertex> archivedVertices = archivedGraph.getAllVertices();

	for (Map.Entry<JobVertexID, ? extends AccessExecutionJobVertex> vertex : runtimeVertices.entrySet()) {
		compareExecutionJobVertex(vertex.getValue(), archivedVertices.get(vertex.getKey()));
	}

	Iterator<? extends AccessExecutionJobVertex> runtimeTopologicalVertices = runtimeGraph.getVerticesTopologically().iterator();
	Iterator<? extends AccessExecutionJobVertex> archiveTopologicaldVertices = archivedGraph.getVerticesTopologically().iterator();

	while (runtimeTopologicalVertices.hasNext()) {
		assertTrue(archiveTopologicaldVertices.hasNext());
		compareExecutionJobVertex(runtimeTopologicalVertices.next(), archiveTopologicaldVertices.next());
	}

	// -------------------------------------------------------------------------------------------------------------
	// ExecutionVertices
	// -------------------------------------------------------------------------------------------------------------
	Iterator<? extends AccessExecutionVertex> runtimeExecutionVertices = runtimeGraph.getAllExecutionVertices().iterator();
	Iterator<? extends AccessExecutionVertex> archivedExecutionVertices = archivedGraph.getAllExecutionVertices().iterator();

	while (runtimeExecutionVertices.hasNext()) {
		assertTrue(archivedExecutionVertices.hasNext());
		compareExecutionVertex(runtimeExecutionVertices.next(), archivedExecutionVertices.next());
	}
}
 
Example #22
Source Project: flink   Author: apache   File: CheckpointingStatisticsHandler.java    License: 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 CheckpointingStatistics.Summary summary = new CheckpointingStatistics.Summary(
			MinMaxAvgStatistics.valueOf(checkpointStatsSummary.getStateSizeStats()),
			MinMaxAvgStatistics.valueOf(checkpointStatsSummary.getEndToEndDurationStats()),
			new MinMaxAvgStatistics(0, 0, 0));

		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 #23
Source Project: flink   Author: apache   File: ArchivedExecutionGraph.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public CheckpointStatsSnapshot getCheckpointStatsSnapshot() {
	return checkpointStatsSnapshot;
}
 
Example #24
Source Project: flink   Author: apache   File: ArchivedExecutionGraphTest.java    License: Apache License 2.0 4 votes vote down vote up
private static void compareExecutionGraph(AccessExecutionGraph runtimeGraph, AccessExecutionGraph archivedGraph) throws IOException, ClassNotFoundException {
	assertTrue(archivedGraph.isArchived());
	// -------------------------------------------------------------------------------------------------------------
	// ExecutionGraph
	// -------------------------------------------------------------------------------------------------------------
	assertEquals(runtimeGraph.getJsonPlan(), archivedGraph.getJsonPlan());
	assertEquals(runtimeGraph.getJobID(), archivedGraph.getJobID());
	assertEquals(runtimeGraph.getJobName(), archivedGraph.getJobName());
	assertEquals(runtimeGraph.getState(), archivedGraph.getState());
	assertEquals(runtimeGraph.getFailureInfo().getExceptionAsString(), archivedGraph.getFailureInfo().getExceptionAsString());
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CREATED), archivedGraph.getStatusTimestamp(JobStatus.CREATED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RUNNING), archivedGraph.getStatusTimestamp(JobStatus.RUNNING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILING), archivedGraph.getStatusTimestamp(JobStatus.FAILING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FAILED), archivedGraph.getStatusTimestamp(JobStatus.FAILED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELLING), archivedGraph.getStatusTimestamp(JobStatus.CANCELLING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.CANCELED), archivedGraph.getStatusTimestamp(JobStatus.CANCELED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.FINISHED), archivedGraph.getStatusTimestamp(JobStatus.FINISHED));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.RESTARTING), archivedGraph.getStatusTimestamp(JobStatus.RESTARTING));
	assertEquals(runtimeGraph.getStatusTimestamp(JobStatus.SUSPENDED), archivedGraph.getStatusTimestamp(JobStatus.SUSPENDED));
	assertEquals(runtimeGraph.isStoppable(), archivedGraph.isStoppable());

	// -------------------------------------------------------------------------------------------------------------
	// CheckpointStats
	// -------------------------------------------------------------------------------------------------------------
	CheckpointStatsSnapshot runtimeSnapshot = runtimeGraph.getCheckpointStatsSnapshot();
	CheckpointStatsSnapshot archivedSnapshot = archivedGraph.getCheckpointStatsSnapshot();

	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum(), archivedSnapshot.getSummaryStats().getEndToEndDurationStats().getMaximum());

	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getAverage(), archivedSnapshot.getSummaryStats().getStateSizeStats().getAverage());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMinimum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMinimum());
	assertEquals(runtimeSnapshot.getSummaryStats().getStateSizeStats().getMaximum(), archivedSnapshot.getSummaryStats().getStateSizeStats().getMaximum());

	assertEquals(runtimeSnapshot.getCounts().getTotalNumberOfCheckpoints(), archivedSnapshot.getCounts().getTotalNumberOfCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfCompletedCheckpoints(), archivedSnapshot.getCounts().getNumberOfCompletedCheckpoints());
	assertEquals(runtimeSnapshot.getCounts().getNumberOfInProgressCheckpoints(), archivedSnapshot.getCounts().getNumberOfInProgressCheckpoints());

	// -------------------------------------------------------------------------------------------------------------
	// ArchivedExecutionConfig
	// -------------------------------------------------------------------------------------------------------------
	ArchivedExecutionConfig runtimeConfig = runtimeGraph.getArchivedExecutionConfig();
	ArchivedExecutionConfig archivedConfig = archivedGraph.getArchivedExecutionConfig();

	assertEquals(runtimeConfig.getExecutionMode(), archivedConfig.getExecutionMode());
	assertEquals(runtimeConfig.getParallelism(), archivedConfig.getParallelism());
	assertEquals(runtimeConfig.getObjectReuseEnabled(), archivedConfig.getObjectReuseEnabled());
	assertEquals(runtimeConfig.getRestartStrategyDescription(), archivedConfig.getRestartStrategyDescription());
	assertNotNull(archivedConfig.getGlobalJobParameters().get("hello"));
	assertEquals(runtimeConfig.getGlobalJobParameters().get("hello"), archivedConfig.getGlobalJobParameters().get("hello"));

	// -------------------------------------------------------------------------------------------------------------
	// StringifiedAccumulators
	// -------------------------------------------------------------------------------------------------------------
	compareStringifiedAccumulators(runtimeGraph.getAccumulatorResultsStringified(), archivedGraph.getAccumulatorResultsStringified());
	compareSerializedAccumulators(runtimeGraph.getAccumulatorsSerialized(), archivedGraph.getAccumulatorsSerialized());

	// -------------------------------------------------------------------------------------------------------------
	// JobVertices
	// -------------------------------------------------------------------------------------------------------------
	Map<JobVertexID, ? extends AccessExecutionJobVertex> runtimeVertices = runtimeGraph.getAllVertices();
	Map<JobVertexID, ? extends AccessExecutionJobVertex> archivedVertices = archivedGraph.getAllVertices();

	for (Map.Entry<JobVertexID, ? extends AccessExecutionJobVertex> vertex : runtimeVertices.entrySet()) {
		compareExecutionJobVertex(vertex.getValue(), archivedVertices.get(vertex.getKey()));
	}

	Iterator<? extends AccessExecutionJobVertex> runtimeTopologicalVertices = runtimeGraph.getVerticesTopologically().iterator();
	Iterator<? extends AccessExecutionJobVertex> archiveTopologicaldVertices = archivedGraph.getVerticesTopologically().iterator();

	while (runtimeTopologicalVertices.hasNext()) {
		assertTrue(archiveTopologicaldVertices.hasNext());
		compareExecutionJobVertex(runtimeTopologicalVertices.next(), archiveTopologicaldVertices.next());
	}

	// -------------------------------------------------------------------------------------------------------------
	// ExecutionVertices
	// -------------------------------------------------------------------------------------------------------------
	Iterator<? extends AccessExecutionVertex> runtimeExecutionVertices = runtimeGraph.getAllExecutionVertices().iterator();
	Iterator<? extends AccessExecutionVertex> archivedExecutionVertices = archivedGraph.getAllExecutionVertices().iterator();

	while (runtimeExecutionVertices.hasNext()) {
		assertTrue(archivedExecutionVertices.hasNext());
		compareExecutionVertex(runtimeExecutionVertices.next(), archivedExecutionVertices.next());
	}
}
 
Example #25
Source Project: Flink-CEPplus   Author: ljygz   File: AccessExecutionGraph.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns a snapshot of the checkpoint statistics or <code>null</code> if
 * checkpointing is disabled.
 *
 * @return Snapshot of the checkpoint statistics for this execution graph
 */
@Nullable
CheckpointStatsSnapshot getCheckpointStatsSnapshot();
 
Example #26
Source Project: flink   Author: flink-tpc-ds   File: AccessExecutionGraph.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns a snapshot of the checkpoint statistics or <code>null</code> if
 * checkpointing is disabled.
 *
 * @return Snapshot of the checkpoint statistics for this execution graph
 */
@Nullable
CheckpointStatsSnapshot getCheckpointStatsSnapshot();
 
Example #27
Source Project: flink   Author: apache   File: AccessExecutionGraph.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns a snapshot of the checkpoint statistics or <code>null</code> if
 * checkpointing is disabled.
 *
 * @return Snapshot of the checkpoint statistics for this execution graph
 */
@Nullable
CheckpointStatsSnapshot getCheckpointStatsSnapshot();