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


Java JobExecutionResult.getNetRuntime方法代码示例

本文整理汇总了Java中org.apache.flink.api.common.JobExecutionResult.getNetRuntime方法的典型用法代码示例。如果您正苦于以下问题:Java JobExecutionResult.getNetRuntime方法的具体用法?Java JobExecutionResult.getNetRuntime怎么用?Java JobExecutionResult.getNetRuntime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.common.JobExecutionResult的用法示例。


在下文中一共展示了JobExecutionResult.getNetRuntime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testProgram

import org.apache.flink.api.common.JobExecutionResult; //导入方法依赖的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));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:NetworkStackThroughputITCase.java

示例2: write

import org.apache.flink.api.common.JobExecutionResult; //导入方法依赖的package包/类
public static void write(final JobExecutionResult res, final String path) {
	double elapsed = res.getNetRuntime(TimeUnit.NANOSECONDS);		
	long tuples = res.getAccumulatorResult("tuples");
	double latency = elapsed / tuples;
	
	PerformanceWriter.write(path, elapsed, latency);
}
 
开发者ID:3Cores,项目名称:sostream,代码行数:8,代码来源:PerformanceWriter.java

示例3: run

import org.apache.flink.api.common.JobExecutionResult; //导入方法依赖的package包/类
@Override
public PipelineResult run(Pipeline pipeline) {
  logWarningIfPCollectionViewHasNonDeterministicKeyCoder(pipeline);

  MetricsEnvironment.setMetricsSupported(true);

  LOG.info("Executing pipeline using FlinkRunner.");

  FlinkPipelineExecutionEnvironment env = new FlinkPipelineExecutionEnvironment(options);

  LOG.info("Translating pipeline to Flink program.");
  env.translate(this, pipeline);

  JobExecutionResult result;
  try {
    LOG.info("Starting execution of Flink program.");
    result = env.executePipeline();
  } catch (Exception e) {
    LOG.error("Pipeline execution failed", e);
    throw new RuntimeException("Pipeline execution failed", e);
  }

  if (result instanceof DetachedEnvironment.DetachedJobExecutionResult) {
    LOG.info("Pipeline submitted in Detached mode");
    return new FlinkDetachedRunnerResult();
  } else {
    LOG.info("Execution finished in {} msecs", result.getNetRuntime());
    Map<String, Object> accumulators = result.getAllAccumulatorResults();
    if (accumulators != null && !accumulators.isEmpty()) {
      LOG.info("Final accumulator values:");
      for (Map.Entry<String, Object> entry : result.getAllAccumulatorResults().entrySet()) {
        LOG.info("{} : {}", entry.getKey(), entry.getValue());
      }
    }

    return new FlinkRunnerResult(accumulators, result.getNetRuntime());
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:39,代码来源:FlinkRunner.java

示例4: run

import org.apache.flink.api.common.JobExecutionResult; //导入方法依赖的package包/类
public FlinkRunnerResult run(Pipeline pipeline, int parallelism) {
	if (parallelism <= 0 && parallelism != -1) {
		throw new IllegalArgumentException("Parallelism must be positive or -1 for default");
	}
	
	LOG.info("Executing pipeline using the FlinkLocalPipelineRunner.");
	
	ExecutionEnvironment env = parallelism == -1 ?
			ExecutionEnvironment.createLocalEnvironment() :
			ExecutionEnvironment.createLocalEnvironment(parallelism);
	
	LOG.info("Translating pipeline to Flink program.");
	
	FlinkTranslator translator = new FlinkTranslator(env);
	translator.translate(pipeline);
	
	LOG.info("Starting execution of Flink program.");
	
	JobExecutionResult result;
	try {
		result = env.execute();
	}
	catch (Exception e) {
		LOG.error("Pipeline execution failed", e);
		throw new RuntimeException("Pipeline execution failed", e);
	}
	
	LOG.info("Execution finished in {} msecs", result.getNetRuntime());
	
	Map<String, Object> accumulators = result.getAllAccumulatorResults();
	if (accumulators != null && !accumulators.isEmpty()) {
		LOG.info("Final aggregator values:");
		
		for (Map.Entry<String, Object> entry : result.getAllAccumulatorResults().entrySet()) {
			LOG.info("{} : {}", entry.getKey(), entry.getValue());
		}
	}

	return new ExecutionRunnerResult(accumulators, result.getNetRuntime());
}
 
开发者ID:StephanEwen,项目名称:flink-dataflow,代码行数:41,代码来源:FlinkLocalPipelineRunner.java

示例5: CentralizedWeightedMatching

import org.apache.flink.api.common.JobExecutionResult; //导入方法依赖的package包/类
public CentralizedWeightedMatching() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();

	// Source: http://grouplens.org/datasets/movielens/
	@SuppressWarnings("serial")
	DataStream<Edge<Long, Long>> edges = env
			.readTextFile("movielens_10k_sorted.txt")
			.map(new MapFunction<String, Edge<Long, Long>>() {
				@Override
				public Edge<Long, Long> map(String s) throws Exception {
					String[] args = s.split("\t");
					long src = Long.parseLong(args[0]);
					long trg = Long.parseLong(args[1]) + 1000000;
					long val = Long.parseLong(args[2]) * 10;
					return new Edge<>(src, trg, val);
				}
			});

	GraphStream<Long, NullValue, Long> graph = new SimpleEdgeStream<>(edges, env);

	graph.getEdges()
			.flatMap(new WeightedMatchingFlatMapper()).setParallelism(1)
			.print().setParallelism(1);

	JobExecutionResult res = env.execute("Distributed Merge Tree Sandbox");
	long runtime = res.getNetRuntime();
	System.out.println("Runtime: " + runtime);
}
 
开发者ID:vasia,项目名称:gelly-streaming,代码行数:29,代码来源:CentralizedWeightedMatching.java


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