Search in sources :

Example 76 with Result

use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.

the class MasterSlaveIT method runSubtransformationClustered.

/**
 * This test check passing rows to sub-transformation executed on cluster
 * See PDI-10704 for details
 * @throws Exception
 */
public void runSubtransformationClustered() throws Exception {
    TransMeta transMeta = loadTransMetaReplaceSlavesInCluster(clusterGenerator, "test/org/pentaho/di/cluster/test-subtrans-clustered.ktr");
    TransExecutionConfiguration config = createClusteredTransExecutionConfiguration();
    Result prevResult = new Result();
    prevResult.setRows(getSampleRows());
    config.setPreviousResult(prevResult);
    TransSplitter transSplitter = Trans.executeClustered(transMeta, config);
    LogChannel logChannel = createLogChannel("cluster unit test <runSubtransformationClustered>");
    long nrErrors = Trans.monitorClusteredTransformation(logChannel, transSplitter, null, 1);
    assertEquals(0L, nrErrors);
    String result = loadFileContent(transMeta, "${java.io.tmpdir}/test-subtrans-clustered.txt");
    assertEqualsIgnoreWhitespacesAndCase("10", result);
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) TransMeta(org.pentaho.di.trans.TransMeta) LogChannel(org.pentaho.di.core.logging.LogChannel) TransSplitter(org.pentaho.di.trans.cluster.TransSplitter) Result(org.pentaho.di.core.Result)

Example 77 with Result

use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.

the class RunMappingIT method test_MAPPING_INPUT_ONLY.

public void test_MAPPING_INPUT_ONLY() throws Exception {
    KettleEnvironment.init();
    TimedTransRunner timedTransRunner = new TimedTransRunner("test/org/pentaho/di/trans/steps/mapping/filereader/use filereader.ktr", LogLevel.ERROR, getTargetDatabase(), 1000);
    assertTrue(timedTransRunner.runEngine(true));
    Result newResult = timedTransRunner.getNewResult();
    assertTrue(newResult.getNrErrors() == 0);
}
Also used : TimedTransRunner(org.pentaho.di.run.TimedTransRunner) Result(org.pentaho.di.core.Result)

Example 78 with Result

use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.

the class SlaveServerTransStatus method getResult.

public Result getResult(TransMeta transMeta) {
    Result result = new Result();
    for (StepStatus stepStatus : stepStatusList) {
        // If the
        result.setNrErrors(result.getNrErrors() + stepStatus.getErrors() + (result.isStopped() ? 1 : 0));
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRead())) {
            result.increaseLinesRead(stepStatus.getLinesRead());
        }
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameInput())) {
            result.increaseLinesInput(stepStatus.getLinesInput());
        }
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameWritten())) {
            result.increaseLinesWritten(stepStatus.getLinesWritten());
        }
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameOutput())) {
            result.increaseLinesOutput(stepStatus.getLinesOutput());
        }
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameUpdated())) {
            result.increaseLinesUpdated(stepStatus.getLinesUpdated());
        }
        if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRejected())) {
            result.increaseLinesRejected(stepStatus.getLinesRejected());
        }
        if (stepStatus.isStopped()) {
            result.setStopped(true);
            result.setResult(false);
        }
    }
    return result;
}
Also used : StepStatus(org.pentaho.di.trans.step.StepStatus) Result(org.pentaho.di.core.Result)

Example 79 with Result

use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.

the class ExecSQLMeta method getFields.

public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
    RowMetaAndData add = ExecSQL.getResultRow(new Result(), getUpdateField(), getInsertField(), getDeleteField(), getReadField());
    r.mergeRowMeta(add.getRowMeta());
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) Result(org.pentaho.di.core.Result) CheckResult(org.pentaho.di.core.CheckResult)

Example 80 with Result

use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.

the class BaseStreamStep method init.

public boolean init(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface) {
    Preconditions.checkNotNull(stepMetaInterface);
    stepMeta = (BaseStreamStepMeta) stepMetaInterface;
    stepMeta.setParentStepMeta(getStepMeta());
    stepMeta.setFileName(stepMeta.getTransformationPath());
    boolean superInit = super.init(stepMetaInterface, stepDataInterface);
    try {
        TransMeta transMeta = TransExecutorMeta.loadMappingMeta(stepMeta, getTransMeta().getRepository(), getTransMeta().getMetaStore(), getParentVariableSpace());
        subtransExecutor = new SubtransExecutor(getStepname(), getTrans(), transMeta, true, new TransExecutorParameters(), environmentSubstitute(stepMeta.getSubStep()));
    } catch (KettleException e) {
        log.logError(e.getLocalizedMessage(), e);
        return false;
    }
    List<CheckResultInterface> remarks = new ArrayList<>();
    stepMeta.check(remarks, getTransMeta(), stepMeta.getParentStepMeta(), // these parameters are not used inside the method
    null, // these parameters are not used inside the method
    null, // these parameters are not used inside the method
    null, // these parameters are not used inside the method
    null, variables, getRepository(), getMetaStore());
    boolean errorsPresent = remarks.stream().filter(result -> result.getType() == CheckResultInterface.TYPE_RESULT_ERROR).peek(result -> logError(result.getText())).count() > 0;
    if (errorsPresent) {
        return false;
    }
    return superInit;
}
Also used : Result(org.pentaho.di.core.Result) Trans(org.pentaho.di.trans.Trans) StepDataInterface(org.pentaho.di.trans.step.StepDataInterface) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) StreamWindow(org.pentaho.di.trans.streaming.api.StreamWindow) KettleException(org.pentaho.di.core.exception.KettleException) TransExecutorMeta(org.pentaho.di.trans.steps.transexecutor.TransExecutorMeta) ArrayList(java.util.ArrayList) TransMeta(org.pentaho.di.trans.TransMeta) StepStatus(org.pentaho.di.trans.step.StepStatus) BaseMessages(org.pentaho.di.i18n.BaseMessages) StepMeta(org.pentaho.di.trans.step.StepMeta) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) Collection(java.util.Collection) Throwables(com.google.common.base.Throwables) StreamSource(org.pentaho.di.trans.streaming.api.StreamSource) BaseStep(org.pentaho.di.trans.step.BaseStep) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) List(java.util.List) SubtransExecutor(org.pentaho.di.trans.SubtransExecutor) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) TransExecutorParameters(org.pentaho.di.trans.steps.transexecutor.TransExecutorParameters) Collections(java.util.Collections) KettleException(org.pentaho.di.core.exception.KettleException) SubtransExecutor(org.pentaho.di.trans.SubtransExecutor) TransMeta(org.pentaho.di.trans.TransMeta) ArrayList(java.util.ArrayList) TransExecutorParameters(org.pentaho.di.trans.steps.transexecutor.TransExecutorParameters) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Aggregations

Result (org.pentaho.di.core.Result)192 Test (org.junit.Test)75 KettleException (org.pentaho.di.core.exception.KettleException)75 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)64 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)57 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)40 FileObject (org.apache.commons.vfs2.FileObject)34 Job (org.pentaho.di.job.Job)32 IOException (java.io.IOException)24 ResultFile (org.pentaho.di.core.ResultFile)20 File (java.io.File)17 ArrayList (java.util.ArrayList)16 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)15 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)12 Pattern (java.util.regex.Pattern)10 KettleFileException (org.pentaho.di.core.exception.KettleFileException)10 Database (org.pentaho.di.core.database.Database)9 Date (java.util.Date)8 Trans (org.pentaho.di.trans.Trans)8 Matcher (java.util.regex.Matcher)7