/** * Ensure that the program parallelism can be set even if the configuration is supplied. */ @Test public void testUserSpecificParallelism() throws Exception { Configuration config = new Configuration(); config.setString(AkkaOptions.STARTUP_TIMEOUT, VALID_STARTUP_TIMEOUT); final URI restAddress = MINI_CLUSTER_RESOURCE.getMiniCluster().getRestAddress(); final String hostname = restAddress.getHost(); final int port = restAddress.getPort(); final ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment( hostname, port, config ); env.setParallelism(USER_DOP); env.getConfig().disableSysoutLogging(); DataSet<Integer> result = env.createInput(new ParallelismDependentInputFormat()) .rebalance() .mapPartition(new RichMapPartitionFunction<Integer, Integer>() { @Override public void mapPartition(Iterable<Integer> values, Collector<Integer> out) throws Exception { out.collect(getRuntimeContext().getIndexOfThisSubtask()); } }); List<Integer> resultCollection = result.collect(); assertEquals(USER_DOP, resultCollection.size()); }
config.setString(HighAvailabilityOptions.HA_STORAGE_PATH, zookeeperStoragePath.getAbsolutePath()); ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment( "leader", 1, config); env.setParallelism(PARALLELISM);
@Override public void run() { try { ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("localhost", 1337, config); env.setParallelism(2); env.setRestartStrategy(RestartStrategies.noRestart()); env.getConfig().disableSysoutLogging(); env.generateSequence(0, Long.MAX_VALUE) .map(new MapFunction<Long, Long>() { @Override public Long map(Long value) throws Exception { synchronized (this) { wait(); } return 0L; } }) .output(new DiscardingOutputFormat<Long>()); env.execute(); } catch (Throwable t) { errorRef[0] = t; } } };
@Override public void testTaskManagerFailure(Configuration configuration, final File coordinateDir) throws Exception { ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("localhost", 1337, configuration); env.setParallelism(PARALLELISM); env.setRestartStrategy(RestartStrategies.fixedDelayRestart(1, 0L));
String[] parts = masterUrl.split(":"); List<String> stagingFiles = options.getFilesToStage(); this.flinkBatchEnv = ExecutionEnvironment.createRemoteEnvironment(parts[0], Integer.parseInt(parts[1]), stagingFiles.toArray(new String[stagingFiles.size()]));
String[] parts = masterUrl.split(":"); List<String> stagingFiles = options.getFilesToStage(); flinkBatchEnv = ExecutionEnvironment.createRemoteEnvironment(parts[0], Integer.parseInt(parts[1]), stagingFiles.toArray(new String[stagingFiles.size()]));
List<String> parts = Splitter.on(':').splitToList(masterUrl); flinkBatchEnv = ExecutionEnvironment.createRemoteEnvironment( parts.get(0), Integer.parseInt(parts.get(1)),
flinkConfiguration.setInteger(RestOptions.PORT, hostAndPort.getPort()); flinkBatchEnv = ExecutionEnvironment.createRemoteEnvironment( hostAndPort.getHost(), hostAndPort.getPort(),