当前位置: 首页>>代码示例>>Java>>正文


Java LocalFlinkMiniCluster.stop方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:28,代码来源:CollectITCase.java

示例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();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:40,代码来源:LocalStreamEnvironment.java


注:本文中的org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。