本文整理汇总了Java中org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster.submitJobAndWait方法的典型用法代码示例。如果您正苦于以下问题:Java LocalFlinkMiniCluster.submitJobAndWait方法的具体用法?Java LocalFlinkMiniCluster.submitJobAndWait怎么用?Java LocalFlinkMiniCluster.submitJobAndWait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
的用法示例。
在下文中一共展示了LocalFlinkMiniCluster.submitJobAndWait方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testProgram
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster; //导入方法依赖的package包/类
private void testProgram(
LocalFlinkMiniCluster localFlinkMiniCluster,
final int dataVolumeGb,
final boolean useForwarder,
final boolean isSlowSender,
final boolean isSlowReceiver,
final int parallelism) throws Exception {
JobExecutionResult jer = localFlinkMiniCluster.submitJobAndWait(
createJobGraph(
dataVolumeGb,
useForwarder,
isSlowSender,
isSlowReceiver,
parallelism),
false);
long dataVolumeMbit = dataVolumeGb * 8192;
long runtimeSecs = jer.getNetRuntime(TimeUnit.SECONDS);
int mbitPerSecond = (int) (((double) dataVolumeMbit) / runtimeSecs);
LOG.info(String.format("Test finished with throughput of %d MBit/s (runtime [secs]: %d, " +
"data volume [gb/mbits]: %d/%d)", mbitPerSecond, runtimeSecs, dataVolumeGb, dataVolumeMbit));
}
示例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();
}
}