Search in sources :

Example 31 with TransExecutionConfiguration

use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.

the class TransExecutor method executeTransformation.

private void executeTransformation() throws KettleException {
    TransExecutorData transExecutorData = getData();
    // If we got 0 rows on input we don't really want to execute the transformation
    if (transExecutorData.groupBuffer.isEmpty()) {
        return;
    }
    transExecutorData.groupTimeStart = System.currentTimeMillis();
    if (first) {
        discardLogLines(transExecutorData);
    }
    Trans executorTrans = createInternalTrans();
    transExecutorData.setExecutorTrans(executorTrans);
    // Pass parameter values
    passParametersToTrans();
    // keep track for drill down in Spoon...
    getTrans().addActiveSubTransformation(getStepname(), executorTrans);
    Result result = new Result();
    result.setRows(transExecutorData.groupBuffer);
    executorTrans.setPreviousResult(result);
    try {
        executorTrans.prepareExecution(getTrans().getArguments());
        // run transformation
        executorTrans.startThreads();
        // Inform the parent transformation we started something here...
        for (DelegationListener delegationListener : getTrans().getDelegationListeners()) {
            // TODO: copy some settings in the transformation execution configuration, not strictly needed
            // but the execution configuration information is useful in case of a transformation re-start on Carte
            delegationListener.transformationDelegationStarted(executorTrans, new TransExecutionConfiguration());
        }
        // Wait a while until we're done with the transformation
        executorTrans.waitUntilFinished();
        result = executorTrans.getResult();
    } catch (KettleException e) {
        log.logError("An error occurred executing the transformation: ", e);
        result.setResult(false);
        result.setNrErrors(1);
    }
    if (result.isSafeStop()) {
        getTrans().safeStop();
    } else if (result.getNrErrors() > 0) {
        getTrans().stopAll();
    }
    collectTransResults(result);
    collectExecutionResults(result);
    collectExecutionResultFiles(result);
    transExecutorData.groupBuffer.clear();
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) KettleException(org.pentaho.di.core.exception.KettleException) Trans(org.pentaho.di.trans.Trans) Result(org.pentaho.di.core.Result) DelegationListener(org.pentaho.di.job.DelegationListener)

Example 32 with TransExecutionConfiguration

use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationExecutorTest method testExecuteLocalTrans.

@Test
public void testExecuteLocalTrans() throws Exception {
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setName("Default Configuration");
    defaultRunConfiguration.setLocal(true);
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    defaultRunConfigurationExecutor.execute(defaultRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
    assertTrue(transExecutionConfiguration.isExecutingLocally());
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) Test(org.junit.Test)

Example 33 with TransExecutionConfiguration

use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationExecutorTest method testSendResources.

@Test
public void testSendResources() throws Exception {
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setSendResources(true);
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    defaultRunConfigurationExecutor.execute(defaultRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
    assertTrue(transExecutionConfiguration.isPassingExport());
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) Test(org.junit.Test)

Example 34 with TransExecutionConfiguration

use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationExecutorTest method testExecutePentahoTrans.

@Test
public void testExecutePentahoTrans() throws Exception {
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setName("Default Configuration");
    defaultRunConfiguration.setLocal(false);
    defaultRunConfiguration.setPentaho(true);
    defaultRunConfiguration.setRemote(false);
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    defaultRunConfigurationExecutor.execute(defaultRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
    assertFalse(transExecutionConfiguration.isExecutingLocally());
    assertFalse(transExecutionConfiguration.isExecutingRemotely());
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) Test(org.junit.Test)

Example 35 with TransExecutionConfiguration

use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationExecutorTest method testExecuteRemoteTrans.

@Test
public void testExecuteRemoteTrans() throws Exception {
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setName("Default Configuration");
    defaultRunConfiguration.setLocal(false);
    defaultRunConfiguration.setRemote(true);
    defaultRunConfiguration.setServer("Test Server");
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    doReturn(slaveServer).when(abstractMeta).findSlaveServer("Test Server");
    defaultRunConfigurationExecutor.execute(defaultRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
    assertFalse(transExecutionConfiguration.isExecutingLocally());
    assertTrue(transExecutionConfiguration.isExecutingRemotely());
    assertEquals(transExecutionConfiguration.getRemoteServer(), slaveServer);
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) Test(org.junit.Test)

Aggregations

TransExecutionConfiguration (org.pentaho.di.trans.TransExecutionConfiguration)47 TransMeta (org.pentaho.di.trans.TransMeta)24 Test (org.junit.Test)16 Trans (org.pentaho.di.trans.Trans)14 TransSplitter (org.pentaho.di.trans.cluster.TransSplitter)14 KettleException (org.pentaho.di.core.exception.KettleException)13 LogChannel (org.pentaho.di.core.logging.LogChannel)13 TransConfiguration (org.pentaho.di.trans.TransConfiguration)12 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)7 IOException (java.io.IOException)6 PrintWriter (java.io.PrintWriter)6 ServletException (javax.servlet.ServletException)5 FileObject (org.apache.commons.vfs2.FileObject)5 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4 Repository (org.pentaho.di.repository.Repository)4 Result (org.pentaho.di.core.Result)3 LogChannelFileWriter (org.pentaho.di.core.logging.LogChannelFileWriter)3 Job (org.pentaho.di.job.Job)3 TransAdapter (org.pentaho.di.trans.TransAdapter)3 OutputStream (java.io.OutputStream)2