当前位置: 首页>>代码示例>>Java>>正文


Java Pipeline.PipelineExecutionException方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:beam,代码行数:17,代码来源:SparkPipelineResult.java

示例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;
}
 
开发者ID:apache,项目名称:beam,代码行数:31,代码来源:DirectRunner.java

示例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();
}
 
开发者ID:apache,项目名称:beam,代码行数:12,代码来源:JacksonTransformsTest.java

示例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();
}
 
开发者ID:apache,项目名称:beam,代码行数:12,代码来源:JacksonTransformsTest.java

示例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();
}
 
开发者ID:apache,项目名称:beam,代码行数:10,代码来源:JacksonTransformsTest.java


注:本文中的org.apache.beam.sdk.Pipeline.PipelineExecutionException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。