Java Code Examples for org.pentaho.di.trans.step.StepInterface#getErrors()

The following examples show how to use org.pentaho.di.trans.step.StepInterface#getErrors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the execution statistics for the transformation for the specified time interval. If the total length of
 * execution is supplied as the interval, then the statistics represent the average throughput (lines
 * read/written/updated/rejected/etc. per second) for the entire execution.
 *
 * @param seconds the time interval (in seconds)
 */
public void printStats( int seconds ) {
  log.logBasic( " " );
  if ( steps == null ) {
    return;
  }

  for ( int i = 0; i < steps.size(); i++ ) {
    StepMetaDataCombi sid = steps.get( i );
    StepInterface step = sid.step;
    long proc = step.getProcessed();
    if ( seconds != 0 ) {
      if ( step.getErrors() == 0 ) {
        log.logBasic( BaseMessages.getString( PKG, "Trans.Log.ProcessSuccessfullyInfo", step.getStepname(), "." + step
          .getCopy(), String.valueOf( proc ), String.valueOf( ( proc / seconds ) ) ) );
      } else {
        log.logError( BaseMessages.getString( PKG, "Trans.Log.ProcessErrorInfo", step.getStepname(), "." + step
          .getCopy(), String.valueOf( step.getErrors() ), String.valueOf( proc ), String.valueOf( proc
          / seconds ) ) );
      }
    } else {
      if ( step.getErrors() == 0 ) {
        log.logBasic( BaseMessages.getString( PKG, "Trans.Log.ProcessSuccessfullyInfo", step.getStepname(), "." + step
          .getCopy(), String.valueOf( proc ), seconds != 0 ? String.valueOf( ( proc / seconds ) ) : "-" ) );
      } else {
        log.logError( BaseMessages.getString( PKG, "Trans.Log.ProcessErrorInfo2", step.getStepname(), "." + step
          .getCopy(), String.valueOf( step.getErrors() ), String.valueOf( proc ), String.valueOf( seconds ) ) );
      }
    }
  }
}
 
Example 2
Source File: TransGridDelegate.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void updateRowFromBaseStep( StepInterface baseStep, TableItem row ) {
  StepStatus stepStatus = new StepStatus( baseStep );

  String[] fields = stepStatus.getTransLogFields();

  updateCellsIfChanged( fields, row );

  // Error lines should appear in red:
  if ( baseStep.getErrors() > 0 ) {
    row.setBackground( GUIResource.getInstance().getColorRed() );
  } else {
    row.setBackground( GUIResource.getInstance().getColorWhite() );
  }
}
 
Example 3
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Adds a step performance snapshot.
 */
protected void addStepPerformanceSnapShot() {

  if ( stepPerformanceSnapShots == null ) {
    return; // Race condition somewhere?
  }

  boolean pausedAndNotEmpty = isPaused() && !stepPerformanceSnapShots.isEmpty();
  boolean stoppedAndNotEmpty = isStopped() && !stepPerformanceSnapShots.isEmpty();

  if ( transMeta.isCapturingStepPerformanceSnapShots() && !pausedAndNotEmpty && !stoppedAndNotEmpty ) {
    // get the statistics from the steps and keep them...
    //
    int seqNr = stepPerformanceSnapshotSeqNr.incrementAndGet();
    for ( int i = 0; i < steps.size(); i++ ) {
      StepMeta stepMeta = steps.get( i ).stepMeta;
      StepInterface step = steps.get( i ).step;

      StepPerformanceSnapShot snapShot =
        new StepPerformanceSnapShot( seqNr, getBatchId(), new Date(), getName(), stepMeta.getName(), step.getCopy(),
          step.getLinesRead(), step.getLinesWritten(), step.getLinesInput(), step.getLinesOutput(), step
          .getLinesUpdated(), step.getLinesRejected(), step.getErrors() );

      synchronized ( stepPerformanceSnapShots ) {
        List<StepPerformanceSnapShot> snapShotList = stepPerformanceSnapShots.get( step.toString() );
        StepPerformanceSnapShot previous;
        if ( snapShotList == null ) {
          snapShotList = new ArrayList<>();
          stepPerformanceSnapShots.put( step.toString(), snapShotList );
          previous = null;
        } else {
          previous = snapShotList.get( snapShotList.size() - 1 ); // the last one...
        }
        // Make the difference...
        //
        snapShot.diff( previous, step.rowsetInputSize(), step.rowsetOutputSize() );
        snapShotList.add( snapShot );

        if ( stepPerformanceSnapshotSizeLimit > 0 && snapShotList.size() > stepPerformanceSnapshotSizeLimit ) {
          snapShotList.remove( 0 );
        }
      }
    }

    lastStepPerformanceSnapshotSeqNrAdded = stepPerformanceSnapshotSeqNr.get();
  }
}