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


Java SingleThreadedTransExecutor类代码示例

本文整理汇总了Java中org.pentaho.di.trans.SingleThreadedTransExecutor的典型用法代码示例。如果您正苦于以下问题:Java SingleThreadedTransExecutor类的具体用法?Java SingleThreadedTransExecutor怎么用?Java SingleThreadedTransExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SingleThreadedTransExecutor类属于org.pentaho.di.trans包,在下文中一共展示了SingleThreadedTransExecutor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: failsWhenGivenNonSingleThreadSteps

import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入依赖的package包/类
@Test( expected = KettleException.class )
public void failsWhenGivenNonSingleThreadSteps() throws Exception {
  Meta metaInterface = createMeta();

  PluginRegistry plugReg = PluginRegistry.getInstance();
  String id = plugReg.getPluginId( StepPluginType.class, metaInterface );
  assertNotNull( "pluginId", id );

  StepMeta stepMeta = new StepMeta( id, "stepMetrics", metaInterface );
  stepMeta.setDraw( true );

  TransMeta transMeta = new TransMeta();
  transMeta.setName( "failsWhenGivenNonSingleThreadSteps" );
  transMeta.addStep( stepMeta );

  Trans trans = new Trans( transMeta );
  trans.prepareExecution( null );

  SingleThreadedTransExecutor executor = new SingleThreadedTransExecutor( trans );
  executor.init();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:SingleThreadedExecutionGuarder.java

示例2: start

import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入依赖的package包/类
@Override
public void start() {
    try {
        // Initialize the sink transformation
        TransMeta transMeta = new TransMeta(this.sinkTransPath, (Repository) null);

        // If running in blocking mode, make sure the transformation type is single threaded
        if (sinkExecutionType == TransExecutionType.BLOCKING) {
            transMeta.setTransformationType(TransMeta.TransformationType.SingleThreaded);
            transMeta.setUsingThreadPriorityManagment(false);
        }

        sinkTrans = new Trans(transMeta);
        sinkTrans.prepareExecution(null);
        sinkTrans.setLogLevel(LogLevel.valueOf(this.sinkLogLevel));

        // Find the injector step and set it to consume rows from the row producer
        StepInterface injector = sinkTrans.findRunThread(this.sinkInjectorName);

        Preconditions.checkNotNull(injector, "Couldn't find Injector step with name: " + this.sinkInjectorName);

        injectorRowMeta = transMeta.getStepFields(injector.getStepMeta());
        sinkRowProducer = sinkTrans.addRowProducer(injector.getStepname(), 0);

        // Initialize the transformation and wait for rows to be injected
        sinkTrans.startThreads();

        if (sinkExecutionType == TransExecutionType.BLOCKING) {
            singleThreadedTransExecutor = new SingleThreadedTransExecutor(sinkTrans);
            singleThreadedTransExecutor.init();
        }
        
        super.start();
        logger.debug("Loaded sink transformation from: " + this.sinkTransPath);
    } catch (KettleException e) {
        e.printStackTrace();
    }
}
 
开发者ID:xpandit,项目名称:kettle-flume-driver,代码行数:39,代码来源:PentahoKettleSink.java

示例3: testDispose

import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入依赖的package包/类
@Test
public void testDispose( ) throws Exception {

  MappingMeta meta = Mockito.mock( MappingMeta.class );
  MappingData data = Mockito.mock( MappingData.class );

  Mockito.when( data.getMappingTrans() ).thenReturn( mockHelper.trans );

  MappingInput[] mappingInputs = { Mockito.mock( MappingInput.class ) };
  MappingOutput[] mappingOutputs = { Mockito.mock( MappingOutput.class ) };
  Mockito.when( mockHelper.trans.findMappingInput() ).thenReturn( mappingInputs );
  Mockito.when( mockHelper.trans.findMappingOutput() ).thenReturn( mappingOutputs );

  data.mappingTransMeta = mockHelper.transMeta;
  Mockito.when( data.mappingTransMeta.getTransformationType() ).thenReturn( TransMeta.TransformationType.SingleThreaded );

  data.singleThreadedTransExcecutor = Mockito.mock( SingleThreadedTransExecutor.class );
  Mockito.when( data.singleThreadedTransExcecutor.oneIteration() ).thenReturn( true );

  data.mappingTrans = mockHelper.trans;
  Mockito.when( mockHelper.trans.isFinished() ).thenReturn( false );
  Mapping mapping = Mockito.spy( new Mapping( mockHelper.stepMeta, data, 0, mockHelper.transMeta, mockHelper.trans ) );
  String stepName = "StepName";
  mapping.setStepname( stepName );


  mapping.processRow( meta, data );
  mapping.dispose( meta, data );
  Mockito.verify( mockHelper.trans, Mockito.times( 1 ) ).removeActiveSubTransformation( stepName );

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:MappingUnitTest.java

示例4: reduce

import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入依赖的package包/类
public void reduce( final K key, final Iterator<V> values, final OutputCollector<K2, V2> output, final Reporter reporter ) throws IOException {
  try {
    if ( debug ) {
      reporter.setStatus( "Begin processing record" );
    }

    // Just to make sure the configuration is not broken...
    if ( trans == null ) {
      throw new RuntimeException( "Error initializing transformation. See error log." ); //$NON-NLS-1$
    }

    // The transformation needs to be prepared and started...
    // Only ever initialize once!
    if ( !trans.isRunning() ) {
      shareVariableSpaceWithTrans( reporter );
      setTransLogLevel( reporter );
      prepareExecution( reporter );
      addInjectorAndProducerToTrans( key, values, output, reporter, getInputStepName(), getOutputStepName() );

      // If we're using the single threading engine we're going to keep pushing rows into our construct.
      // If not, we're going to re-create the Trans engine every time.
      if ( isSingleThreaded() ) {
        executor = new SingleThreadedTransExecutor( trans );

        // This validates whether or not a step is capable of running in Single Threaded mode.
        boolean ok = executor.init();
        if ( !ok ) {
          throw new KettleException( "Unable to initialize the single threaded transformation, check the log for details." );
        }

        // The transformation is considered in a "running" state now.
      }
    }

    // The following 2 statements are the only things left to do for one set of data coming from Hadoop...

    // Inject the values, including the one we probed...
    injectValues( key, values, output, reporter );

    if ( isSingleThreaded() ) {
      // Signal to the executor that we have enough data in the pipeline to do one iteration.
      // All steps are executed in a loop once in sequence, one after the other.
      executor.oneIteration();
    }

  } catch ( Exception e ) {
    printException( reporter, e );
    setDebugStatus( reporter, "An exception was raised" );
    throw new IOException( e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-hadoop-shims,代码行数:52,代码来源:GenericTransReduce.java


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