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();
}
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());
}
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());
}
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());
}
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);
}
Aggregations