org.apache.flink.runtime.util.ManualTicker Java Examples

The following examples show how to use org.apache.flink.runtime.util.ManualTicker. 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: CompletedOperationCacheTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
	manualTicker = new ManualTicker();
	completedOperationCache = new CompletedOperationCache<>(manualTicker);
}
 
Example #2
Source File: CompletedOperationCacheTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
	manualTicker = new ManualTicker();
	completedOperationCache = new CompletedOperationCache<>(manualTicker);
}
 
Example #3
Source File: FileArchivedExecutionGraphStoreTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Tests that an expired execution graph is removed from the execution graph store.
 */
@Test
public void testExecutionGraphExpiration() throws Exception {
	final File rootDir = temporaryFolder.newFolder();

	final Time expirationTime = Time.milliseconds(1L);

	final ManuallyTriggeredScheduledExecutor scheduledExecutor = new ManuallyTriggeredScheduledExecutor();

	final ManualTicker manualTicker = new ManualTicker();

	try (final FileArchivedExecutionGraphStore executionGraphStore = new FileArchivedExecutionGraphStore(
		rootDir,
		expirationTime,
		Integer.MAX_VALUE,
		10000L,
		scheduledExecutor,
		manualTicker)) {

		final ArchivedExecutionGraph executionGraph = new ArchivedExecutionGraphBuilder().setState(JobStatus.FINISHED).build();

		executionGraphStore.put(executionGraph);

		// there should one execution graph
		assertThat(executionGraphStore.size(), Matchers.equalTo(1));

		manualTicker.advanceTime(expirationTime.toMilliseconds(), TimeUnit.MILLISECONDS);

		// this should trigger the cleanup after expiration
		scheduledExecutor.triggerScheduledTasks();

		assertThat(executionGraphStore.size(), Matchers.equalTo(0));

		assertThat(executionGraphStore.get(executionGraph.getJobID()), Matchers.nullValue());

		final File storageDirectory = executionGraphStore.getStorageDir();

		// check that the persisted file has been deleted
		assertThat(storageDirectory.listFiles().length, Matchers.equalTo(0));
	}
}
 
Example #4
Source File: CompletedOperationCacheTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
	manualTicker = new ManualTicker();
	completedOperationCache = new CompletedOperationCache<>(manualTicker);
}
 
Example #5
Source File: FileArchivedExecutionGraphStoreTest.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Tests that an expired execution graph is removed from the execution graph store.
 */
@Test
public void testExecutionGraphExpiration() throws Exception {
	final File rootDir = temporaryFolder.newFolder();

	final Time expirationTime = Time.milliseconds(1L);

	final ManuallyTriggeredScheduledExecutor scheduledExecutor = new ManuallyTriggeredScheduledExecutor();

	final ManualTicker manualTicker = new ManualTicker();

	try (final FileArchivedExecutionGraphStore executionGraphStore = new FileArchivedExecutionGraphStore(
		rootDir,
		expirationTime,
		10000L,
		scheduledExecutor,
		manualTicker)) {

		final ArchivedExecutionGraph executionGraph = new ArchivedExecutionGraphBuilder().setState(JobStatus.FINISHED).build();

		executionGraphStore.put(executionGraph);

		// there should one execution graph
		assertThat(executionGraphStore.size(), Matchers.equalTo(1));

		manualTicker.advanceTime(expirationTime.toMilliseconds(), TimeUnit.MILLISECONDS);

		// this should trigger the cleanup after expiration
		scheduledExecutor.triggerScheduledTasks();

		assertThat(executionGraphStore.size(), Matchers.equalTo(0));

		assertThat(executionGraphStore.get(executionGraph.getJobID()), Matchers.nullValue());

		final File storageDirectory = executionGraphStore.getStorageDir();

		// check that the persisted file has been deleted
		assertThat(storageDirectory.listFiles().length, Matchers.equalTo(0));
	}
}
 
Example #6
Source File: FileArchivedExecutionGraphStoreTest.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Tests that an expired execution graph is removed from the execution graph store.
 */
@Test
public void testExecutionGraphExpiration() throws Exception {
	final File rootDir = temporaryFolder.newFolder();

	final Time expirationTime = Time.milliseconds(1L);

	final ManuallyTriggeredScheduledExecutor scheduledExecutor = new ManuallyTriggeredScheduledExecutor();

	final ManualTicker manualTicker = new ManualTicker();

	try (final FileArchivedExecutionGraphStore executionGraphStore = new FileArchivedExecutionGraphStore(
		rootDir,
		expirationTime,
		10000L,
		scheduledExecutor,
		manualTicker)) {

		final ArchivedExecutionGraph executionGraph = new ArchivedExecutionGraphBuilder().setState(JobStatus.FINISHED).build();

		executionGraphStore.put(executionGraph);

		// there should one execution graph
		assertThat(executionGraphStore.size(), Matchers.equalTo(1));

		manualTicker.advanceTime(expirationTime.toMilliseconds(), TimeUnit.MILLISECONDS);

		// this should trigger the cleanup after expiration
		scheduledExecutor.triggerScheduledTasks();

		assertThat(executionGraphStore.size(), Matchers.equalTo(0));

		assertThat(executionGraphStore.get(executionGraph.getJobID()), Matchers.nullValue());

		final File storageDirectory = executionGraphStore.getStorageDir();

		// check that the persisted file has been deleted
		assertThat(storageDirectory.listFiles().length, Matchers.equalTo(0));
	}
}