本文整理了Java中cz.seznam.euphoria.core.executor.Executor
类的一些代码示例,展示了Executor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor
类的具体详情如下:
包路径:cz.seznam.euphoria.core.executor.Executor
类名称:Executor
[英]The client side, public, technology independent interface to an executor.
[中]客户端,公共的,独立于技术的执行者接口。
代码示例来源:origin: seznam/euphoria
public void execute(Executor exec) throws Exception {
exec.submit(this.wrap.getFlow()).get();
}
}
代码示例来源:origin: seznam/euphoria
private Executor.Result execute(Flow flow) {
DAG<Operator<?, ?>> dag = FlowUnfolder.unfold(flow, Executor.getBasicOps());
代码示例来源:origin: seznam/euphoria
@Override
public void shutdown() throws Exception {
executor.shutdown();
}
};
代码示例来源:origin: seznam/euphoria
executor.setAccumulatorProvider(accs);
executor.submit(flow).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Test failure at run #" + i, e);
代码示例来源:origin: seznam/euphoria
executor.setAccumulatorProvider(accs);
executor.submit(flow).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Test failure at run #" + i, e);
代码示例来源: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
private Executor.Result execute(Flow flow) {
DAG<Operator<?, ?>> dag = FlowUnfolder.unfold(flow, Executor.getBasicOps());
代码示例来源: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
@Test
@SuppressWarnings("unchecked")
public void testUnfoldBasic() {
DAG<Operator<?, ?>> unfolded = FlowUnfolder.unfold(flow, Executor.getBasicOps());
代码示例来源:origin: seznam/euphoria
executor.submit(flow).get();
} catch (InterruptedException ex) {
LOG.warn("Interrupted while waiting for the flow to finish.", ex);
代码示例来源:origin: seznam/euphoria
@Test(expected = IllegalArgumentException.class)
public void testMultipleOutputsToSameSink() throws Exception {
flow = Flow.create(getClass().getSimpleName());
input = flow.createInput(new MockStreamDataSource<>());
Dataset<Object> mapped = MapElements.of(input).using(e -> e).output();
Dataset<Pair<Object, Long>> reduced = ReduceByKey
.of(mapped)
.keyBy(e -> e).reduceBy(values -> 1L)
.windowBy(Time.of(Duration.ofSeconds(1)))
.output();
Dataset<Pair<Object, Long>> output = Join.of(mapped, reduced)
.by(e -> e, Pair::getFirst)
.using((Object l, Pair<Object, Long> r, Collector<Long> c) -> {
c.collect(r.getSecond());
})
.windowBy(Time.of(Duration.ofSeconds(1)))
.output();
ListDataSink<Pair<Object, Long>> sink = ListDataSink.get();
output.persist(sink);
reduced.persist(sink);
FlowUnfolder.unfold(flow, Executor.getBasicOps());
}
代码示例来源:origin: seznam/euphoria
executor.submit(flow).get();
代码示例来源:origin: seznam/euphoria
DAG<Operator<?, ?>> unfolded = FlowUnfolder.unfold(flow, Executor.getBasicOps());
代码示例来源: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
/**
* 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();
内容来源于网络,如有侵权,请联系作者删除!