org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration Java Examples

The following examples show how to use org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration. 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: StreamFaultToleranceTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	Configuration configuration = new Configuration();
	switch (failoverStrategy) {
		case RestartPipelinedRegionStrategy:
			configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "region");
			break;
		case RestartAllStrategy:
			configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "full");
	}

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(configuration)
			.setNumberTaskManagers(NUM_TASK_MANAGERS)
			.setNumberSlotsPerTaskManager(NUM_TASK_SLOTS)
			.build());
	cluster.before();
}
 
Example #2
Source File: NettyEpollITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(NettyShuffleEnvironmentOptions.TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #3
Source File: HistoryServerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	jmDirectory = tmpFolder.newFolder("jm_" + versionLessThan14);
	hsDirectory = tmpFolder.newFolder("hs_" + versionLessThan14);

	Configuration clusterConfig = new Configuration();
	clusterConfig.setString(JobManagerOptions.ARCHIVE_DIR, jmDirectory.toURI().toString());

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(clusterConfig)
			.setNumberTaskManagers(1)
			.setNumberSlotsPerTaskManager(1)
			.build());
	cluster.before();
}
 
Example #4
Source File: StreamFaultToleranceTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	Configuration configuration = new Configuration();
	switch (failoverStrategy) {
		case RestartPipelinedRegionFailoverStrategy:
			configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "region");
			break;
		case RestartAllFailoverStrategy:
			configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "full");
	}

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(configuration)
			.setNumberTaskManagers(NUM_TASK_MANAGERS)
			.setNumberSlotsPerTaskManager(NUM_TASK_SLOTS)
			.build());
	cluster.before();
}
 
Example #5
Source File: BlobsCleanupITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	blobBaseDir = TEMPORARY_FOLDER.newFolder();

	Configuration cfg = new Configuration();
	cfg.setString(BlobServerOptions.STORAGE_DIRECTORY, blobBaseDir.getAbsolutePath());
	cfg.setString(RestartStrategyOptions.RESTART_STRATEGY, "fixeddelay");
	cfg.setInteger(RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1);
	// BLOBs are deleted from BlobCache between 1s and 2s after last reference
	// -> the BlobCache may still have the BLOB or not (let's test both cases randomly)
	cfg.setLong(BlobServerOptions.CLEANUP_INTERVAL, 1L);

	configuration = new UnmodifiableConfiguration(cfg);

	miniClusterResource = new MiniClusterResource(new MiniClusterResourceConfiguration.Builder()
		.setNumberSlotsPerTaskManager(2)
		.setNumberTaskManagers(1)
		.setConfiguration(configuration)
		.build());

	miniClusterResource.before();
}
 
Example #6
Source File: RescalingITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	// detect parameter change
	if (currentBackend != backend) {
		shutDownExistingCluster();

		currentBackend = backend;

		Configuration config = new Configuration();

		final File checkpointDir = temporaryFolder.newFolder();
		final File savepointDir = temporaryFolder.newFolder();

		config.setString(CheckpointingOptions.STATE_BACKEND, currentBackend);
		config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir.toURI().toString());
		config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir.toURI().toString());

		cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(numTaskManagers)
				.setNumberSlotsPerTaskManager(numSlots)
				.build());
		cluster.before();
	}
}
 
Example #7
Source File: ClassLoaderITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {

	Configuration config = new Configuration();

	// we need to use the "filesystem" state backend to ensure FLINK-2543 is not happening again.
	config.setString(CheckpointingOptions.STATE_BACKEND, "filesystem");
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// Savepoint path
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// required as we otherwise run out of memory
	config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "80m");

	miniClusterResource = new MiniClusterResource(
		new MiniClusterResourceConfiguration.Builder()
			.setNumberTaskManagers(2)
			.setNumberSlotsPerTaskManager(2)
			.setConfiguration(config)
			.build());

	miniClusterResource.before();
}
 
Example #8
Source File: HAQueryableStateRocksDBBackendITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #9
Source File: RollingSinkITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {

	LOG.info("In RollingSinkITCase: Starting MiniDFSCluster ");

	dataDir = tempFolder.newFolder();

	conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, dataDir.getAbsolutePath());
	MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf);
	hdfsCluster = builder.build();

	dfs = hdfsCluster.getFileSystem();

	hdfsURI = "hdfs://"
			+ NetUtils.hostAndPortToUrlString(hdfsCluster.getURI().getHost(), hdfsCluster.getNameNodePort())
			+ "/";

	miniClusterResource = new MiniClusterResource(
		new MiniClusterResourceConfiguration.Builder()
			.setNumberTaskManagers(1)
			.setNumberSlotsPerTaskManager(4)
			.build());

	miniClusterResource.before();
}
 
Example #10
Source File: NettyEpollITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #11
Source File: HAQueryableStateFsBackendITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #12
Source File: BlobsCleanupITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	blobBaseDir = TEMPORARY_FOLDER.newFolder();

	Configuration cfg = new Configuration();
	cfg.setString(BlobServerOptions.STORAGE_DIRECTORY, blobBaseDir.getAbsolutePath());
	cfg.setString(ConfigConstants.RESTART_STRATEGY, "fixeddelay");
	cfg.setInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1);
	// BLOBs are deleted from BlobCache between 1s and 2s after last reference
	// -> the BlobCache may still have the BLOB or not (let's test both cases randomly)
	cfg.setLong(BlobServerOptions.CLEANUP_INTERVAL, 1L);

	configuration = new UnmodifiableConfiguration(cfg);

	miniClusterResource = new MiniClusterResource(new MiniClusterResourceConfiguration.Builder()
		.setNumberSlotsPerTaskManager(2)
		.setNumberTaskManagers(1)
		.setConfiguration(configuration)
		.build());

	miniClusterResource.before();
}
 
Example #13
Source File: HAQueryableStateRocksDBBackendITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #14
Source File: NotifyCheckpointAbortedITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	Configuration configuration = new Configuration();
	configuration.setBoolean(CheckpointingOptions.LOCAL_RECOVERY, true);
	configuration.setString(HighAvailabilityOptions.HA_MODE, TestingHAFactory.class.getName());

	checkpointPath = new Path(TEMPORARY_FOLDER.newFolder().toURI());
	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(configuration)
			.setNumberTaskManagers(1)
			.setNumberSlotsPerTaskManager(1).build());
	cluster.before();

	NormalMap.reset();
	DeclineSink.reset();
	TestingCompletedCheckpointStore.reset();
}
 
Example #15
Source File: HistoryServerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	jmDirectory = TMP.newFolder("jm_" + versionLessThan14);
	hsDirectory = TMP.newFolder("hs_" + versionLessThan14);

	Configuration clusterConfig = new Configuration();
	clusterConfig.setString(JobManagerOptions.ARCHIVE_DIR, jmDirectory.toURI().toString());

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(clusterConfig)
			.setNumberTaskManagers(1)
			.setNumberSlotsPerTaskManager(1)
			.build());
	cluster.before();
}
 
Example #16
Source File: RegionFailoverITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	Configuration configuration = new Configuration();
	configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "region");
	// global failover times: 3, region failover times: NUM_OF_RESTARTS
	configuration.setInteger(FailingRestartStrategy.NUM_FAILURES_CONFIG_OPTION, 3);
	configuration.setString(ConfigConstants.RESTART_STRATEGY, FailingRestartStrategy.class.getName());

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(configuration)
			.setNumberTaskManagers(2)
			.setNumberSlotsPerTaskManager(2).build());
	cluster.before();
	jobFailedCnt.set(0);
	numCompletedCheckpoints.set(0);
}
 
Example #17
Source File: NettyEpollITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(NettyShuffleEnvironmentOptions.TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #18
Source File: HistoryServerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	jmDirectory = TMP.newFolder("jm_" + versionLessThan14);
	hsDirectory = TMP.newFolder("hs_" + versionLessThan14);

	Configuration clusterConfig = new Configuration();
	clusterConfig.setString(JobManagerOptions.ARCHIVE_DIR, jmDirectory.toURI().toString());

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(clusterConfig)
			.setNumberTaskManagers(1)
			.setNumberSlotsPerTaskManager(1)
			.build());
	cluster.before();
}
 
Example #19
Source File: BlobsCleanupITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	blobBaseDir = TEMPORARY_FOLDER.newFolder();

	Configuration cfg = new Configuration();
	cfg.setString(BlobServerOptions.STORAGE_DIRECTORY, blobBaseDir.getAbsolutePath());
	cfg.setString(ConfigConstants.RESTART_STRATEGY, "fixeddelay");
	cfg.setInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1);
	// BLOBs are deleted from BlobCache between 1s and 2s after last reference
	// -> the BlobCache may still have the BLOB or not (let's test both cases randomly)
	cfg.setLong(BlobServerOptions.CLEANUP_INTERVAL, 1L);

	configuration = new UnmodifiableConfiguration(cfg);

	miniClusterResource = new MiniClusterResource(new MiniClusterResourceConfiguration.Builder()
		.setNumberSlotsPerTaskManager(2)
		.setNumberTaskManagers(1)
		.setConfiguration(configuration)
		.build());

	miniClusterResource.before();
}
 
Example #20
Source File: HAQueryableStateRocksDBBackendITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #21
Source File: HAQueryableStateFsBackendITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #22
Source File: ClassLoaderITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {

	Configuration config = new Configuration();

	// we need to use the "filesystem" state backend to ensure FLINK-2543 is not happening again.
	config.setString(CheckpointingOptions.STATE_BACKEND, "filesystem");
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// Savepoint path
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// required as we otherwise run out of memory
	config.set(TaskManagerOptions.MANAGED_MEMORY_SIZE, MemorySize.parse("80m"));

	miniClusterResource = new MiniClusterResource(
		new MiniClusterResourceConfiguration.Builder()
			.setNumberTaskManagers(2)
			.setNumberSlotsPerTaskManager(2)
			.setConfiguration(config)
			.build());

	miniClusterResource.before();
}
 
Example #23
Source File: RescalingITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	// detect parameter change
	if (currentBackend != backend) {
		shutDownExistingCluster();

		currentBackend = backend;

		Configuration config = new Configuration();

		final File checkpointDir = temporaryFolder.newFolder();
		final File savepointDir = temporaryFolder.newFolder();

		config.setString(CheckpointingOptions.STATE_BACKEND, currentBackend);
		config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir.toURI().toString());
		config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir.toURI().toString());

		cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(numTaskManagers)
				.setNumberSlotsPerTaskManager(numSlots)
				.build());
		cluster.before();
	}
}
 
Example #24
Source File: RescalingITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	// detect parameter change
	if (currentBackend != backend) {
		shutDownExistingCluster();

		currentBackend = backend;

		Configuration config = new Configuration();

		final File checkpointDir = temporaryFolder.newFolder();
		final File savepointDir = temporaryFolder.newFolder();

		config.setString(CheckpointingOptions.STATE_BACKEND, currentBackend);
		config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir.toURI().toString());
		config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir.toURI().toString());

		cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(numTaskManagers)
				.setNumberSlotsPerTaskManager(numSlots)
				.build());
		cluster.before();
	}
}
 
Example #25
Source File: ClassLoaderITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {

	Configuration config = new Configuration();

	// we need to use the "filesystem" state backend to ensure FLINK-2543 is not happening again.
	config.setString(CheckpointingOptions.STATE_BACKEND, "filesystem");
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// Savepoint path
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY,
			FOLDER.newFolder().getAbsoluteFile().toURI().toString());

	// required as we otherwise run out of memory
	config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "80m");

	miniClusterResource = new MiniClusterResource(
		new MiniClusterResourceConfiguration.Builder()
			.setNumberTaskManagers(2)
			.setNumberSlotsPerTaskManager(2)
			.setConfiguration(config)
			.build());

	miniClusterResource.before();
}
 
Example #26
Source File: HAQueryableStateFsBackendITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
	zkServer = new TestingServer();

	// we have to manage this manually because we have to create the ZooKeeper server
	// ahead of this
	miniClusterResource = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(getConfig())
			.setNumberTaskManagers(NUM_TMS)
			.setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM)
			.build());

	miniClusterResource.before();

	client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START);

	clusterClient = miniClusterResource.getClusterClient();
}
 
Example #27
Source File: RegionFailoverITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	Configuration configuration = new Configuration();
	configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "region");
	configuration.setString(HighAvailabilityOptions.HA_MODE, TestingHAFactory.class.getName());

	cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(configuration)
			.setNumberTaskManagers(2)
			.setNumberSlotsPerTaskManager(2).build());
	cluster.before();
	jobFailedCnt.set(0);
	numCompletedCheckpoints.set(0);
}
 
Example #28
Source File: SavepointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testTriggerSavepointForNonExistingJob() throws Exception {
	// Config
	final int numTaskManagers = 1;
	final int numSlotsPerTaskManager = 1;

	final Configuration config = new Configuration();
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir.toURI().toString());

	final MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(config)
			.setNumberTaskManagers(numTaskManagers)
			.setNumberSlotsPerTaskManager(numSlotsPerTaskManager)
			.build());
	cluster.before();
	final ClusterClient<?> client = cluster.getClusterClient();

	final JobID jobID = new JobID();

	try {
		client.triggerSavepoint(jobID, null).get();

		fail();
	} catch (ExecutionException e) {
		assertTrue(ExceptionUtils.findThrowable(e, FlinkJobNotFoundException.class).isPresent());
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, jobID.toString()).isPresent());
	} finally {
		cluster.after();
	}
}
 
Example #29
Source File: SavepointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testTriggerSavepointWithCheckpointingDisabled() throws Exception {
	// Config
	final int numTaskManagers = 1;
	final int numSlotsPerTaskManager = 1;

	final Configuration config = new Configuration();

	final MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(config)
			.setNumberTaskManagers(numTaskManagers)
			.setNumberSlotsPerTaskManager(numSlotsPerTaskManager)
			.build());
	cluster.before();
	final ClusterClient<?> client = cluster.getClusterClient();

	final JobVertex vertex = new JobVertex("Blocking vertex");
	vertex.setInvokableClass(BlockingNoOpInvokable.class);
	vertex.setParallelism(1);

	final JobGraph graph = new JobGraph(vertex);

	try {
		ClientUtils.submitJob(client, graph);

		client.triggerSavepoint(graph.getJobID(), null).get();

		fail();
	} catch (ExecutionException e) {
		assertTrue(ExceptionUtils.findThrowable(e, IllegalStateException.class).isPresent());
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, graph.getJobID().toString()).isPresent());
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, "is not a streaming job").isPresent());
	} finally {
		cluster.after();
	}
}
 
Example #30
Source File: SavepointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
MiniClusterWithClientResource get() {
	return new MiniClusterWithClientResource(
		new MiniClusterResourceConfiguration.Builder()
			.setConfiguration(config)
			.setNumberTaskManagers(numTaskManagers)
			.setNumberSlotsPerTaskManager(numSlotsPerTaskManager)
			.build());
}