本文整理汇总了Java中org.apache.beam.sdk.Pipeline.PipelineExecutionException方法的典型用法代码示例。如果您正苦于以下问题:Java Pipeline.PipelineExecutionException方法的具体用法?Java Pipeline.PipelineExecutionException怎么用?Java Pipeline.PipelineExecutionException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.beam.sdk.Pipeline
的用法示例。
在下文中一共展示了Pipeline.PipelineExecutionException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beamExceptionFrom
import org.apache.beam.sdk.Pipeline; //导入方法依赖的package包/类
private static RuntimeException beamExceptionFrom(final Throwable e) {
// Scala doesn't declare checked exceptions in the bytecode, and the Java compiler
// won't let you catch something that is not declared, so we can't catch
// SparkException directly, instead we do an instanceof check.
if (e instanceof SparkException) {
if (e.getCause() != null && e.getCause() instanceof UserCodeException) {
UserCodeException userException = (UserCodeException) e.getCause();
return new Pipeline.PipelineExecutionException(userException.getCause());
} else if (e.getCause() != null) {
return new Pipeline.PipelineExecutionException(e.getCause());
}
}
return runtimeExceptionFrom(e);
}
示例2: waitUntilFinish
import org.apache.beam.sdk.Pipeline; //导入方法依赖的package包/类
/**
* {@inheritDoc}.
*
* <p>If the pipeline terminates abnormally by throwing an {@link Exception}, this will rethrow
* the original {@link Exception}. Future calls to {@link #getState()} will return {@link
* org.apache.beam.sdk.PipelineResult.State#FAILED}.
*/
@Override
public State waitUntilFinish(Duration duration) {
State startState = this.state;
if (!startState.isTerminal()) {
try {
state = executor.waitUntilFinish(duration);
} catch (UserCodeException uce) {
// Emulates the behavior of Pipeline#run(), where a stack trace caused by a
// UserCodeException is truncated and replaced with the stack starting at the call to
// waitToFinish
throw new Pipeline.PipelineExecutionException(uce.getCause());
} catch (Exception e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new RuntimeException(e);
}
}
return this.state;
}
示例3: failParsingInvalidJsons
import org.apache.beam.sdk.Pipeline; //导入方法依赖的package包/类
@Test(expected = Pipeline.PipelineExecutionException.class)
public void failParsingInvalidJsons() {
PCollection<MyPojo> output =
pipeline
.apply(Create.of(Iterables.concat(VALID_JSONS, INVALID_JSONS)))
.apply(ParseJsons.of(MyPojo.class)).setCoder(SerializableCoder.of(MyPojo.class));
PAssert.that(output).containsInAnyOrder(POJOS);
pipeline.run();
}
示例4: failParsingWithoutCustomMapper
import org.apache.beam.sdk.Pipeline; //导入方法依赖的package包/类
@Test(expected = Pipeline.PipelineExecutionException.class)
public void failParsingWithoutCustomMapper() {
PCollection<MyPojo> output =
pipeline
.apply(Create.of(EXTRA_PROPERTIES_JSONS))
.apply(ParseJsons.of(MyPojo.class)).setCoder(SerializableCoder.of(MyPojo.class));
PAssert.that(output).empty();
pipeline.run();
}
示例5: failWritingWithoutCustomMapper
import org.apache.beam.sdk.Pipeline; //导入方法依赖的package包/类
@Test(expected = Pipeline.PipelineExecutionException.class)
public void failWritingWithoutCustomMapper() {
PCollection<String> output =
pipeline
.apply(Create.of(EMPTY_BEANS))
.apply(AsJsons.of(MyEmptyBean.class)).setCoder(StringUtf8Coder.of());
pipeline.run();
}