本文整理汇总了Java中org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster.stop方法的典型用法代码示例。如果您正苦于以下问题:Java LocalFlinkMiniCluster.stop方法的具体用法?Java LocalFlinkMiniCluster.stop怎么用?Java LocalFlinkMiniCluster.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
的用法示例。
在下文中一共展示了LocalFlinkMiniCluster.stop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCollect
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster; //导入方法依赖的package包/类
@Test
public void testCollect() throws Exception {
final LocalFlinkMiniCluster cluster = new LocalFlinkMiniCluster(new Configuration(), false);
try {
cluster.start();
TestStreamEnvironment.setAsContext(cluster, 1);
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
final long n = 10;
DataStream<Long> stream = env.generateSequence(1, n);
long i = 1;
for (Iterator<Long> it = DataStreamUtils.collect(stream); it.hasNext(); ) {
long x = it.next();
assertEquals("received wrong element", i, x);
i++;
}
assertEquals("received wrong number of elements", n + 1, i);
}
finally {
TestStreamEnvironment.unsetAsContext();
cluster.stop();
}
}
示例2: execute
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster; //导入方法依赖的package包/类
/**
* Executes the JobGraph of the on a mini cluster of CLusterUtil with a user
* specified name.
*
* @param jobName
* name of the job
* @return The result of the job execution, containing elapsed time and accumulators.
*/
@Override
public JobExecutionResult execute(String jobName) throws Exception {
// transform the streaming program into a JobGraph
StreamGraph streamGraph = getStreamGraph();
streamGraph.setJobName(jobName);
JobGraph jobGraph = streamGraph.getJobGraph();
Configuration configuration = new Configuration();
configuration.addAll(jobGraph.getJobConfiguration());
configuration.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, -1L);
configuration.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, jobGraph.getMaximumParallelism());
// add (and override) the settings with what the user defined
configuration.addAll(this.conf);
if (LOG.isInfoEnabled()) {
LOG.info("Running job on local embedded Flink mini cluster");
}
LocalFlinkMiniCluster exec = new LocalFlinkMiniCluster(configuration, true);
try {
exec.start();
return exec.submitJobAndWait(jobGraph, getConfig().isSysoutLoggingEnabled());
}
finally {
transformations.clear();
exec.stop();
}
}