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

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

本文整理了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:

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

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

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

代码示例

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

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

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

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

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

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

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

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

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

  1. executor.submit(flow).get();

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

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

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

  1. @Test
  2. public void test() {
  3. final Configuration conf = new Configuration();
  4. final String outputDir =
  5. Paths.get(tmp.getRoot().getAbsolutePath(), testName).toAbsolutePath().toString();
  6. final Flow flow = Flow.create();
  7. final S source = dataSinkTester.prepareDataSource();
  8. final T sink = dataSinkTester.buildSink(outputDir, conf, useLazyOutputFormat);
  9. MapElements.of(flow.createInput(source)).using(p -> p).output().persist(sink);
  10. final Executor executor = new LocalExecutor().setDefaultParallelism(4);
  11. executor.submit(flow).join();
  12. String[] files = new File(outputDir).list();
  13. assertNotNull(files);
  14. List<String> reduceOutputFileNames =
  15. Arrays.stream(files)
  16. .filter(file -> file.startsWith("part-r-"))
  17. .collect(Collectors.toList());
  18. assertEquals(expectedNumberOfReduceOutputs, reduceOutputFileNames.size());
  19. final List<O> output =
  20. reduceOutputFileNames
  21. .stream()
  22. .flatMap(dataSinkTester.extractOutputFunction(outputDir, conf))
  23. .collect(Collectors.toList());
  24. DatasetAssert.unorderedEquals(dataSinkTester.expectedOutput(), output);
  25. }

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

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

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

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

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

  1. /**
  2. * Collects Avro record as JSON string
  3. *
  4. * @param outSink
  5. * @param inSource
  6. * @throws Exception
  7. */
  8. public static void runFlow(
  9. DataSink<String> outSink,
  10. DataSource<Pair<AvroKey<GenericData.Record>, NullWritable>> inSource)
  11. throws Exception {
  12. Flow flow = Flow.create("simple read avro");
  13. Dataset<Pair<AvroKey<GenericData.Record>, NullWritable>> input = flow.createInput(inSource);
  14. final Dataset<String> output =
  15. FlatMap.named("avro2csv").of(input).using(AvroSourceTest::apply).output();
  16. output.persist(outSink);
  17. Executor executor = new LocalExecutor();
  18. executor.submit(flow).get();
  19. }

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

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

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

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

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

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

相关文章