cz.seznam.euphoria.core.executor.Executor.submit()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(255)

本文整理了Java中cz.seznam.euphoria.core.executor.Executor.submit()方法的一些代码示例,展示了Executor.submit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.submit()方法的具体详情如下:
包路径:cz.seznam.euphoria.core.executor.Executor
类名称:Executor
方法名:submit

Executor.submit介绍

[英]Submits flow as a job. The returned object is an instance of CompletableFuturewhich holds the asynchronous execution of the job. Client can wait for the result synchronously, or different executions can be chained/composed with methods provided by the CompletableFuture.

Example:

CompletableFuture preparation = exec.submit(flow1);); 
}

[中]将流作为作业提交。返回的对象是CompletableFuture的实例,它保存作业的异步执行。客户端可以同步等待结果,也可以使用CompletableFuture提供的方法链接/组合不同的执行。
例子:

CompletableFuture preparation = exec.submit(flow1);); 
}

代码示例

代码示例来源:origin: seznam/euphoria

public void execute(Executor exec) throws Exception {
  exec.submit(this.wrap.getFlow()).get();
 }
}

代码示例来源:origin: seznam/euphoria

public void execute(Executor executor) {
  final Flow flow = Flow.create("test");
  final ListDataSink<OUT> sink = ListDataSink.get();
  buildFlow(flow).persist(sink);
  executor.submit(flow).join();
  DatasetAssert.unorderedEquals(getOutput(), sink.getOutputs());
 }
}

代码示例来源:origin: seznam/euphoria

public void execute(Executor executor) {
  final Flow flow = Flow.create("test");
  final ListDataSink<OUT> sink = ListDataSink.get();
  buildFlow(flow).persist(sink);
  executor.submit(flow).join();
  DatasetAssert.unorderedEquals(getOutput(), sink.getOutputs());
 }
}

代码示例来源:origin: seznam/euphoria

executor.submit(flow).get();
} catch (InterruptedException ex) {
 LOG.warn("Interrupted while waiting for the flow to finish.", ex);

代码示例来源:origin: seznam/euphoria

executor.submit(flow).get();

代码示例来源:origin: seznam/euphoria

private void run() {
 Flow flow = Flow.create();
 Dataset<Pair<ImmutableBytesWritable, Result>> ds = flow.createInput(
   Utils.getHBaseSource(input, conf.get()));
 FlatMap.of(ds)
   .using((Pair<ImmutableBytesWritable, Result> p, Collector<byte[]> c) -> {
    writeCellsAsBytes(p.getSecond(), c);
   })
   .output()
   .persist(Utils.getSink(output, conf.get()));
 LOG.info("Starting flow reading from {} and persisting to {}", input, output);
 executor.submit(flow).join();
}

代码示例来源:origin: seznam/euphoria

@Test
public void test() {
 final Configuration conf = new Configuration();
 final String outputDir =
   Paths.get(tmp.getRoot().getAbsolutePath(), testName).toAbsolutePath().toString();
 final Flow flow = Flow.create();
 final S source = dataSinkTester.prepareDataSource();
 final T sink = dataSinkTester.buildSink(outputDir, conf, useLazyOutputFormat);
 MapElements.of(flow.createInput(source)).using(p -> p).output().persist(sink);
 final Executor executor = new LocalExecutor().setDefaultParallelism(4);
 executor.submit(flow).join();
 String[] files = new File(outputDir).list();
 assertNotNull(files);
 List<String> reduceOutputFileNames =
   Arrays.stream(files)
     .filter(file -> file.startsWith("part-r-"))
     .collect(Collectors.toList());
 assertEquals(expectedNumberOfReduceOutputs, reduceOutputFileNames.size());
 final List<O> output =
   reduceOutputFileNames
     .stream()
     .flatMap(dataSinkTester.extractOutputFunction(outputDir, conf))
     .collect(Collectors.toList());
 DatasetAssert.unorderedEquals(dataSinkTester.expectedOutput(), output);
}

代码示例来源:origin: seznam/euphoria

executor.submit(flow).get();
} catch (InterruptedException | ExecutionException e) {
 throw new RuntimeException("Test failure at run #" + i, e);

代码示例来源:origin: seznam/euphoria

executor.submit(flow).get();
} catch (InterruptedException | ExecutionException e) {
 throw new RuntimeException("Test failure at run #" + i, e);

代码示例来源:origin: seznam/euphoria

/**
 * Collects Avro record as JSON string
 *
 * @param outSink
 * @param inSource
 * @throws Exception
 */
public static void runFlow(
  DataSink<String> outSink,
  DataSource<Pair<AvroKey<GenericData.Record>, NullWritable>> inSource)
  throws Exception {
 Flow flow = Flow.create("simple read avro");
 Dataset<Pair<AvroKey<GenericData.Record>, NullWritable>> input = flow.createInput(inSource);
 final Dataset<String> output =
   FlatMap.named("avro2csv").of(input).using(AvroSourceTest::apply).output();
 output.persist(outSink);
 Executor executor = new LocalExecutor();
 executor.submit(flow).get();
}

代码示例来源:origin: seznam/euphoria

.persist(Util.getStringSink(params));
executorFactory.newExecutor(this.config, dataClasses()).submit(flow).get();

代码示例来源:origin: seznam/euphoria

.build());
executor.submit(flow).join();

代码示例来源:origin: seznam/euphoria

.output().persist(out);
executor.submit(flow).get();

相关文章