@Before public void setupTestCluster() throws Exception { miniClusterResource = getMiniClusterResource(); miniClusterResource.before(); }
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); } }
@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(); }
.setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); cluster.before();
@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(); } }
.setNumberSlotsPerTaskManager(slotsPerTaskManager) .build()); cluster.before();
cluster.before(); ClusterClient<?> client = cluster.getClusterClient();
@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(); } }
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; } } }
@BeforeClass public static void setup() throws Exception { zkServer = new TestingServer(); Configuration config = new Configuration(); config.setInteger(ConfigConstants.LOCAL_NUMBER_JOB_MANAGER, NUM_JMS); config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, NUM_TMS); config.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, NUM_SLOTS_PER_TM); haStorageDir = TEMPORARY_FOLDER.newFolder(); config.setString(HighAvailabilityOptions.HA_STORAGE_PATH, haStorageDir.toString()); config.setString(HighAvailabilityOptions.HA_CLUSTER_ID, UUID.randomUUID().toString()); config.setString(HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM, zkServer.getConnectString()); config.setString(HighAvailabilityOptions.HA_MODE, "zookeeper"); config.setString( ConfigConstants.METRICS_REPORTER_PREFIX + "restarts." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, RestartReporter.class.getName()); // we have to manage this manually because we have to create the ZooKeeper server // ahead of this miniClusterResource = new MiniClusterWithClientResource( new MiniClusterResourceConfiguration.Builder() .setConfiguration(config) .setNumberTaskManagers(NUM_TMS) .setNumberSlotsPerTaskManager(NUM_SLOTS_PER_TM) .build()); miniClusterResource.before(); }
.setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); cluster.before(); ClusterClient<?> client = cluster.getClusterClient();
.build()); cluster.before();
.setNumberSlotsPerTaskManager(numSlotsPerTaskManager) .build()); cluster.before(); final ClusterClient<?> client = cluster.getClusterClient();
@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(); }
@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(); }
.setNumberSlotsPerTaskManager(2 * jobGraph.getMaximumParallelism()) .build()); cluster.before(); ClusterClient<?> client = cluster.getClusterClient();