Java Code Examples for org.apache.flink.api.common.JobExecutionResult#getNetRuntime()
The following examples show how to use
org.apache.flink.api.common.JobExecutionResult#getNetRuntime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetworkStackThroughputITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void testProgram( final MiniClusterWithClientResource cluster, final int dataVolumeGb, final boolean useForwarder, final boolean isSlowSender, final boolean isSlowReceiver, final int parallelism) throws Exception { ClusterClient<?> client = cluster.getClusterClient(); client.setDetached(false); client.setPrintStatusDuringExecution(false); JobExecutionResult jer = (JobExecutionResult) client.submitJob( createJobGraph( dataVolumeGb, useForwarder, isSlowSender, isSlowReceiver, parallelism), getClass().getClassLoader()); 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)); }
Example 2
Source File: NetworkStackThroughputITCase.java From flink with Apache License 2.0 | 5 votes |
private void testProgram( final MiniClusterWithClientResource cluster, final int dataVolumeGb, final boolean useForwarder, final boolean isSlowSender, final boolean isSlowReceiver, final int parallelism) throws Exception { ClusterClient<?> client = cluster.getClusterClient(); client.setDetached(false); client.setPrintStatusDuringExecution(false); JobExecutionResult jer = (JobExecutionResult) client.submitJob( createJobGraph( dataVolumeGb, useForwarder, isSlowSender, isSlowReceiver, parallelism), getClass().getClassLoader()); 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)); }
Example 3
Source File: FlinkPipelineRunner.java From beam with Apache License 2.0 | 5 votes |
private PortablePipelineResult createPortablePipelineResult( JobExecutionResult result, PipelineOptions options) { // The package of DetachedJobExecutionResult has been changed in 1.10. // Refer to https://github.com/apache/flink/commit/c36b35e6876ecdc717dade653e8554f9d8b543c9 for // details. String resultClassName = result.getClass().getCanonicalName(); if (resultClassName.equals( "org.apache.flink.client.program.DetachedEnvironment.DetachedJobExecutionResult") || resultClassName.equals("org.apache.flink.core.execution.DetachedJobExecutionResult")) { LOG.info("Pipeline submitted in Detached mode"); // no metricsPusher because metrics are not supported in detached mode return new FlinkPortableRunnerResult.Detached(); } 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()); } } FlinkPortableRunnerResult flinkRunnerResult = new FlinkPortableRunnerResult(accumulators, result.getNetRuntime()); MetricsPusher metricsPusher = new MetricsPusher( flinkRunnerResult.getMetricsContainerStepMap(), options.as(MetricsOptions.class), flinkRunnerResult); metricsPusher.start(); return flinkRunnerResult; } }
Example 4
Source File: FlinkRunner.java From beam with Apache License 2.0 | 5 votes |
static PipelineResult createPipelineResult(JobExecutionResult result, PipelineOptions options) { // The package of DetachedJobExecutionResult has been changed in 1.10. // Refer to https://github.com/apache/flink/commit/c36b35e6876ecdc717dade653e8554f9d8b543c9 for // more details. String resultClassName = result.getClass().getCanonicalName(); if (resultClassName.equals( "org.apache.flink.client.program.DetachedEnvironment.DetachedJobExecutionResult") || resultClassName.equals("org.apache.flink.core.execution.DetachedJobExecutionResult")) { LOG.info("Pipeline submitted in Detached mode"); // no metricsPusher because metrics are not supported 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()); } } FlinkRunnerResult flinkRunnerResult = new FlinkRunnerResult(accumulators, result.getNetRuntime()); MetricsPusher metricsPusher = new MetricsPusher( flinkRunnerResult.getMetricsContainerStepMap(), options.as(MetricsOptions.class), flinkRunnerResult); metricsPusher.start(); return flinkRunnerResult; } }
Example 5
Source File: CentralizedWeightedMatching.java From gelly-streaming with Apache License 2.0 | 5 votes |
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); }
Example 6
Source File: FlinkPipelineRunner.java From flink-dataflow with Apache License 2.0 | 5 votes |
@Override public FlinkRunnerResult run(Pipeline pipeline) { LOG.info("Executing pipeline using FlinkPipelineRunner."); LOG.info("Translating pipeline to Flink program."); this.flinkJobEnv.translate(pipeline); LOG.info("Starting execution of Flink program."); JobExecutionResult result; try { result = this.flinkJobEnv.executePipeline(); } 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 FlinkRunnerResult(accumulators, result.getNetRuntime()); }
Example 7
Source File: NetworkStackThroughputITCase.java From flink with Apache License 2.0 | 5 votes |
private void testProgram( final MiniClusterWithClientResource cluster, final int dataVolumeGb, final boolean useForwarder, final boolean isSlowSender, final boolean isSlowReceiver, final int parallelism) throws Exception { ClusterClient<?> client = cluster.getClusterClient(); JobExecutionResult jer = ClientUtils.submitJobAndWaitForResult( client, createJobGraph( dataVolumeGb, useForwarder, isSlowSender, isSlowReceiver, parallelism), getClass().getClassLoader()); 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)); }