/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as join, map, reduce) to run with * x parallel instances. * * <p>This method overrides the default parallelism for this environment. * The {@link LocalEnvironment} uses by default a value equal to the number of hardware * contexts (CPU cores / threads). When executing the program via the command line client * from a JAR file, the default parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public void setParallelism(int parallelism) { config.setParallelism(parallelism); }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as map, * batchReduce) to run with x parallel instances. This method overrides the * default parallelism for this environment. The * {@link LocalStreamEnvironment} uses by default a value equal to the * number of hardware contexts (CPU cores / threads). When executing the * program via the command line client from a JAR file, the default degree * of parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public StreamExecutionEnvironment setParallelism(int parallelism) { config.setParallelism(parallelism); return this; }
@Test public void testConfigurationOfParallelism() { ExecutionConfig config = new ExecutionConfig(); // verify explicit change in parallelism int parallelism = 36; config.setParallelism(parallelism); assertEquals(parallelism, config.getParallelism()); // verify that parallelism is reset to default flag value parallelism = ExecutionConfig.PARALLELISM_DEFAULT; config.setParallelism(parallelism); assertEquals(parallelism, config.getParallelism()); }
execConf.setParallelism(42);
execConf.setParallelism(42);
execConf.setParallelism(42);
@SuppressWarnings("unchecked") @Test public void testInternalSingleValueWindowFunction() throws Exception { WindowFunctionMock mock = mock(WindowFunctionMock.class); InternalSingleValueWindowFunction<Long, String, Long, TimeWindow> windowFunction = new InternalSingleValueWindowFunction<>(mock); // check setOutputType TypeInformation<String> stringType = BasicTypeInfo.STRING_TYPE_INFO; ExecutionConfig execConf = new ExecutionConfig(); execConf.setParallelism(42); StreamingFunctionUtils.setOutputType(windowFunction, stringType, execConf); verify(mock).setOutputType(stringType, execConf); // check open Configuration config = new Configuration(); windowFunction.open(config); verify(mock).open(config); // check setRuntimeContext RuntimeContext rCtx = mock(RuntimeContext.class); windowFunction.setRuntimeContext(rCtx); verify(mock).setRuntimeContext(rCtx); // check apply TimeWindow w = mock(TimeWindow.class); Collector<String> c = (Collector<String>) mock(Collector.class); InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class); windowFunction.process(42L, w, ctx, 23L, c); verify(mock).apply(eq(42L), eq(w), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c)); // check close windowFunction.close(); verify(mock).close(); }
@SuppressWarnings("unchecked") @Test public void testInternalSingleValueProcessAllWindowFunction() throws Exception { ProcessAllWindowFunctionMock mock = mock(ProcessAllWindowFunctionMock.class); InternalSingleValueProcessAllWindowFunction<Long, String, TimeWindow> windowFunction = new InternalSingleValueProcessAllWindowFunction<>(mock); // check setOutputType TypeInformation<String> stringType = BasicTypeInfo.STRING_TYPE_INFO; ExecutionConfig execConf = new ExecutionConfig(); execConf.setParallelism(42); StreamingFunctionUtils.setOutputType(windowFunction, stringType, execConf); verify(mock).setOutputType(stringType, execConf); // check open Configuration config = new Configuration(); windowFunction.open(config); verify(mock).open(config); // check setRuntimeContext RuntimeContext rCtx = mock(RuntimeContext.class); windowFunction.setRuntimeContext(rCtx); verify(mock).setRuntimeContext(rCtx); // check apply TimeWindow w = mock(TimeWindow.class); Collector<String> c = (Collector<String>) mock(Collector.class); InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class); windowFunction.process(((byte) 0), w, ctx, 23L, c); verify(mock).process((ProcessAllWindowFunctionMock.Context) anyObject(), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c)); // check close windowFunction.close(); verify(mock).close(); }
@SuppressWarnings("unchecked") @Test public void testInternalSingleValueAllWindowFunction() throws Exception { AllWindowFunctionMock mock = mock(AllWindowFunctionMock.class); InternalSingleValueAllWindowFunction<Long, String, TimeWindow> windowFunction = new InternalSingleValueAllWindowFunction<>(mock); // check setOutputType TypeInformation<String> stringType = BasicTypeInfo.STRING_TYPE_INFO; ExecutionConfig execConf = new ExecutionConfig(); execConf.setParallelism(42); StreamingFunctionUtils.setOutputType(windowFunction, stringType, execConf); verify(mock).setOutputType(stringType, execConf); // check open Configuration config = new Configuration(); windowFunction.open(config); verify(mock).open(config); // check setRuntimeContext RuntimeContext rCtx = mock(RuntimeContext.class); windowFunction.setRuntimeContext(rCtx); verify(mock).setRuntimeContext(rCtx); // check apply TimeWindow w = mock(TimeWindow.class); Collector<String> c = (Collector<String>) mock(Collector.class); InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class); windowFunction.process(((byte) 0), w, ctx, 23L, c); verify(mock).apply(eq(w), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c)); // check close windowFunction.close(); verify(mock).close(); }
execConf.setParallelism(42);
execConf.setParallelism(42);
execConf.setParallelism(42);
execConf.setParallelism(42);
config.disableSysoutLogging(); config.setParallelism(parallelism);
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as join, map, reduce) to run with * x parallel instances. * * <p>This method overrides the default parallelism for this environment. * The {@link LocalEnvironment} uses by default a value equal to the number of hardware * contexts (CPU cores / threads). When executing the program via the command line client * from a JAR file, the default parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public void setParallelism(int parallelism) { config.setParallelism(parallelism); }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as map, * batchReduce) to run with x parallel instances. This method overrides the * default parallelism for this environment. The * {@link LocalStreamEnvironment} uses by default a value equal to the * number of hardware contexts (CPU cores / threads). When executing the * program via the command line client from a JAR file, the default degree * of parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public StreamExecutionEnvironment setParallelism(int parallelism) { config.setParallelism(parallelism); return this; }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as join, map, reduce) to run with * x parallel instances. * * <p>This method overrides the default parallelism for this environment. * The {@link LocalEnvironment} uses by default a value equal to the number of hardware * contexts (CPU cores / threads). When executing the program via the command line client * from a JAR file, the default parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public void setParallelism(int parallelism) { config.setParallelism(parallelism); }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as join, map, reduce) to run with * x parallel instances. * * <p>This method overrides the default parallelism for this environment. * The {@link LocalEnvironment} uses by default a value equal to the number of hardware * contexts (CPU cores / threads). When executing the program via the command line client * from a JAR file, the default parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public void setParallelism(int parallelism) { config.setParallelism(parallelism); }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as map, * batchReduce) to run with x parallel instances. This method overrides the * default parallelism for this environment. The * {@link LocalStreamEnvironment} uses by default a value equal to the * number of hardware contexts (CPU cores / threads). When executing the * program via the command line client from a JAR file, the default degree * of parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public StreamExecutionEnvironment setParallelism(int parallelism) { config.setParallelism(parallelism); return this; }
/** * Sets the parallelism for operations executed through this environment. * Setting a parallelism of x here will cause all operators (such as map, * batchReduce) to run with x parallel instances. This method overrides the * default parallelism for this environment. The * {@link LocalStreamEnvironment} uses by default a value equal to the * number of hardware contexts (CPU cores / threads). When executing the * program via the command line client from a JAR file, the default degree * of parallelism is the one configured for that setup. * * @param parallelism The parallelism */ public StreamExecutionEnvironment setParallelism(int parallelism) { config.setParallelism(parallelism); return this; }