org.apache.flink.runtime.rest.handler.job.checkpoints.CheckpointStatsCache Java Examples

The following examples show how to use org.apache.flink.runtime.rest.handler.job.checkpoints.CheckpointStatsCache. 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: CheckpointStatsCacheTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testCacheAddAndGet() throws Exception {
	AbstractCheckpointStats chk0 = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk1 = createCheckpoint(1, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk2 = createCheckpoint(2, CheckpointStatsStatus.IN_PROGRESS);

	CheckpointStatsCache cache = new CheckpointStatsCache(1);
	cache.tryAdd(chk0);
	assertEquals(chk0, cache.tryGet(0));

	cache.tryAdd(chk1);
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));

	cache.tryAdd(chk2);
	assertNull(cache.tryGet(2));
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));
}
 
Example #2
Source File: CheckpointStatsCacheTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCacheAddAndGet() throws Exception {
	AbstractCheckpointStats chk0 = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk1 = createCheckpoint(1, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk2 = createCheckpoint(2, CheckpointStatsStatus.IN_PROGRESS);

	CheckpointStatsCache cache = new CheckpointStatsCache(1);
	cache.tryAdd(chk0);
	assertEquals(chk0, cache.tryGet(0));

	cache.tryAdd(chk1);
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));

	cache.tryAdd(chk2);
	assertNull(cache.tryGet(2));
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));
}
 
Example #3
Source File: CheckpointStatsCacheTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCacheAddAndGet() throws Exception {
	AbstractCheckpointStats chk0 = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk1 = createCheckpoint(1, CheckpointStatsStatus.COMPLETED);
	AbstractCheckpointStats chk2 = createCheckpoint(2, CheckpointStatsStatus.IN_PROGRESS);

	CheckpointStatsCache cache = new CheckpointStatsCache(1);
	cache.tryAdd(chk0);
	assertEquals(chk0, cache.tryGet(0));

	cache.tryAdd(chk1);
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));

	cache.tryAdd(chk2);
	assertNull(cache.tryGet(2));
	assertNull(cache.tryGet(0));
	assertEquals(chk1, cache.tryGet(1));
}
 
Example #4
Source File: WebMonitorEndpoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public WebMonitorEndpoint(
		RestServerEndpointConfiguration endpointConfiguration,
		GatewayRetriever<? extends T> leaderRetriever,
		Configuration clusterConfiguration,
		RestHandlerConfiguration restConfiguration,
		GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever,
		TransientBlobService transientBlobService,
		ExecutorService executor,
		MetricFetcher metricFetcher,
		LeaderElectionService leaderElectionService,
		FatalErrorHandler fatalErrorHandler) throws IOException {
	super(endpointConfiguration);
	this.leaderRetriever = Preconditions.checkNotNull(leaderRetriever);
	this.clusterConfiguration = Preconditions.checkNotNull(clusterConfiguration);
	this.restConfiguration = Preconditions.checkNotNull(restConfiguration);
	this.resourceManagerRetriever = Preconditions.checkNotNull(resourceManagerRetriever);
	this.transientBlobService = Preconditions.checkNotNull(transientBlobService);
	this.executor = Preconditions.checkNotNull(executor);

	this.executionGraphCache = new ExecutionGraphCache(
		restConfiguration.getTimeout(),
		Time.milliseconds(restConfiguration.getRefreshInterval()));

	this.checkpointStatsCache = new CheckpointStatsCache(
		restConfiguration.getMaxCheckpointStatisticCacheEntries());

	this.metricFetcher = metricFetcher;

	this.leaderElectionService = Preconditions.checkNotNull(leaderElectionService);
	this.fatalErrorHandler = Preconditions.checkNotNull(fatalErrorHandler);
}
 
Example #5
Source File: CheckpointStatsCacheTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testZeroSizeCache() throws Exception {
	AbstractCheckpointStats checkpoint = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);

	CheckpointStatsCache cache = new CheckpointStatsCache(0);
	cache.tryAdd(checkpoint);
	assertNull(cache.tryGet(0L));
}
 
Example #6
Source File: WebMonitorEndpoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public WebMonitorEndpoint(
		RestServerEndpointConfiguration endpointConfiguration,
		GatewayRetriever<? extends T> leaderRetriever,
		Configuration clusterConfiguration,
		RestHandlerConfiguration restConfiguration,
		GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever,
		TransientBlobService transientBlobService,
		ExecutorService executor,
		MetricFetcher metricFetcher,
		LeaderElectionService leaderElectionService,
		FatalErrorHandler fatalErrorHandler) throws IOException {
	super(endpointConfiguration);
	this.leaderRetriever = Preconditions.checkNotNull(leaderRetriever);
	this.clusterConfiguration = Preconditions.checkNotNull(clusterConfiguration);
	this.restConfiguration = Preconditions.checkNotNull(restConfiguration);
	this.resourceManagerRetriever = Preconditions.checkNotNull(resourceManagerRetriever);
	this.transientBlobService = Preconditions.checkNotNull(transientBlobService);
	this.executor = Preconditions.checkNotNull(executor);

	this.executionGraphCache = new ExecutionGraphCache(
		restConfiguration.getTimeout(),
		Time.milliseconds(restConfiguration.getRefreshInterval()));

	this.checkpointStatsCache = new CheckpointStatsCache(
		restConfiguration.getMaxCheckpointStatisticCacheEntries());

	this.metricFetcher = metricFetcher;

	this.leaderElectionService = Preconditions.checkNotNull(leaderElectionService);
	this.fatalErrorHandler = Preconditions.checkNotNull(fatalErrorHandler);
}
 
Example #7
Source File: CheckpointStatsCacheTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testZeroSizeCache() throws Exception {
	AbstractCheckpointStats checkpoint = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);

	CheckpointStatsCache cache = new CheckpointStatsCache(0);
	cache.tryAdd(checkpoint);
	assertNull(cache.tryGet(0L));
}
 
Example #8
Source File: WebMonitorEndpoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public WebMonitorEndpoint(
		RestServerEndpointConfiguration endpointConfiguration,
		GatewayRetriever<? extends T> leaderRetriever,
		Configuration clusterConfiguration,
		RestHandlerConfiguration restConfiguration,
		GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever,
		TransientBlobService transientBlobService,
		ScheduledExecutorService executor,
		MetricFetcher metricFetcher,
		LeaderElectionService leaderElectionService,
		ExecutionGraphCache executionGraphCache,
		FatalErrorHandler fatalErrorHandler) throws IOException {
	super(endpointConfiguration);
	this.leaderRetriever = Preconditions.checkNotNull(leaderRetriever);
	this.clusterConfiguration = Preconditions.checkNotNull(clusterConfiguration);
	this.restConfiguration = Preconditions.checkNotNull(restConfiguration);
	this.resourceManagerRetriever = Preconditions.checkNotNull(resourceManagerRetriever);
	this.transientBlobService = Preconditions.checkNotNull(transientBlobService);
	this.executor = Preconditions.checkNotNull(executor);

	this.executionGraphCache = executionGraphCache;

	this.checkpointStatsCache = new CheckpointStatsCache(
		restConfiguration.getMaxCheckpointStatisticCacheEntries());

	this.metricFetcher = metricFetcher;

	this.leaderElectionService = Preconditions.checkNotNull(leaderElectionService);
	this.fatalErrorHandler = Preconditions.checkNotNull(fatalErrorHandler);
}
 
Example #9
Source File: CheckpointStatsCacheTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testZeroSizeCache() throws Exception {
	AbstractCheckpointStats checkpoint = createCheckpoint(0, CheckpointStatsStatus.COMPLETED);

	CheckpointStatsCache cache = new CheckpointStatsCache(0);
	cache.tryAdd(checkpoint);
	assertNull(cache.tryGet(0L));
}