@BeforeClass public static void setup() throws Exception { client = new QueryableStateClient("localhost", QS_PROXY_PORT_RANGE_START); clusterClient = MINI_CLUSTER_RESOURCE.getClusterClient(); }
final MiniClusterWithClientResource cluster = new MiniClusterWithClientResource( new MiniClusterResourceConfiguration.Builder() .setNumberTaskManagers(numTaskManagers) .setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); cluster.before(); parallelism); } finally { cluster.after();
@Override public void before() throws Exception { super.before(); clusterClient = createMiniClusterClient(); executionEnvironment = new TestEnvironment(getMiniCluster(), getNumberSlots(), false); executionEnvironment.setAsContext(); TestStreamEnvironment.setAsContext(getMiniCluster(), getNumberSlots()); }
private MiniClusterClient createMiniClusterClient() { return new MiniClusterClient(getClientConfiguration(), getMiniCluster()); } }
private String submitJobAndTakeSavepoint(MiniClusterResourceFactory clusterFactory, int parallelism) throws Exception { final JobGraph jobGraph = createJobGraph(parallelism, 0, 1000); final JobID jobId = jobGraph.getJobID(); StatefulCounter.resetForTest(parallelism); MiniClusterWithClientResource cluster = clusterFactory.get(); cluster.before(); ClusterClient<?> client = cluster.getClusterClient(); try { client.setDetached(true); client.submitJob(jobGraph, SavepointITCase.class.getClassLoader()); StatefulCounter.getProgressLatch().await(); return client.triggerSavepoint(jobId, null).get(); } finally { cluster.after(); StatefulCounter.resetForTest(parallelism); } }
@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(); } }
@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(); }
@Before public void setUp() throws Exception { jmDirectory = TMP.newFolder("jm"); hsDirectory = TMP.newFolder("hs"); 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(); }
@After public void tearDown() { if (cluster != null) { cluster.after(); } }
ExecutionEnvironment env = miniClusterResource.getTestEnvironment(); env.getConfig().disableObjectReuse();
MiniClusterWithClientResource get() { return new MiniClusterWithClientResource( new MiniClusterResourceConfiguration.Builder() .setConfiguration(config) .setNumberTaskManagers(numTaskManagers) .setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); } }
@Before public void setupTestCluster() throws Exception { miniClusterResource = getMiniClusterResource(); miniClusterResource.before(); }
public int getParallelism() { return isCollectionExecution ? 1 : miniClusterResource.getNumberSlots(); }
config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir.toURI().toString()); MiniClusterWithClientResource cluster = new MiniClusterWithClientResource( new MiniClusterResourceConfiguration.Builder() .setConfiguration(config) .setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); cluster.before(); ClusterClient<?> client = cluster.getClusterClient(); cluster.after();
@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(); }
cluster.before(); ClusterClient<?> client = cluster.getClusterClient(); cluster.after(); StatefulCounter.resetForTest(parallelism);
@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(); } }
@AfterClass public static void shutDownExistingCluster() { if (cluster != null) { cluster.after(); cluster = null; } }
private MiniClusterClient createMiniClusterClient() { return new MiniClusterClient(getClientConfiguration(), getMiniCluster()); } }
TestEnvironment env = miniClusterResource.getTestEnvironment(); env.getConfig().enableObjectReuse();