use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class Job method init.
public void init() {
status = new AtomicInteger();
jobListeners = new ArrayList<JobListener>();
jobEntryListeners = new ArrayList<JobEntryListener>();
delegationListeners = new ArrayList<DelegationListener>();
// these 2 maps are being modified concurrently and must be thread-safe
activeJobEntryTransformations = new ConcurrentHashMap<JobEntryCopy, JobEntryTrans>();
activeJobEntryJobs = new ConcurrentHashMap<JobEntryCopy, JobEntryJob>();
extensionDataMap = new HashMap<String, Object>();
jobTracker = new JobTracker(jobMeta);
synchronized (jobEntryResults) {
jobEntryResults.clear();
}
errors = new AtomicInteger(0);
batchId = -1;
passedBatchId = -1;
maxJobEntriesLogged = Const.toInt(EnvUtil.getSystemProperty(Const.KETTLE_MAX_JOB_ENTRIES_LOGGED), 1000);
result = null;
startJobEntryCopy = null;
startJobEntryResult = null;
this.setDefaultLogCommitSize();
}
use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class JobExecutionConfiguration method getUsedArguments.
public void getUsedArguments(JobMeta jobMeta, String[] commandLineArguments, IMetaStore metaStore) {
for (JobEntryCopy jobEntryCopy : jobMeta.jobcopies) {
if (jobEntryCopy.isTransformation()) {
JobEntryTrans jobEntryTrans = (JobEntryTrans) jobEntryCopy.getEntry();
try {
TransMeta transMeta = jobEntryTrans.getTransMeta(repository, metaStore, jobMeta);
Map<String, String> map = transMeta.getUsedArguments(commandLineArguments);
for (Map.Entry<String, String> entry : map.entrySet()) {
arguments.putIfAbsent(entry.getKey(), entry.getValue());
}
} catch (KettleException ke) {
// suppress exceptions at this time - we will let the runtime report on any errors
}
}
}
}
use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class MetaFileLoaderImplTest method setupJobEntryTrans.
private void setupJobEntryTrans() throws Exception {
JobEntryTrans jobEntryTrans = new JobEntryTrans();
jobEntryBase = jobEntryTrans;
JobMeta parentJobMeta = spy(new JobMeta());
LogChannelInterface logger = mock(LogChannelInterface.class);
metaFileCache = new MetaFileCacheImpl(logger);
parentJobMeta.setMetaFileCache(metaFileCache);
when(parentJobMeta.getNamedClusterEmbedManager()).thenReturn(namedClusterEmbedManager);
jobEntryTrans.setParentJobMeta(parentJobMeta);
keyPath = getClass().getResource(TRANS_FILE).getPath();
jobEntryTrans.setFileName(keyPath);
Job job = new Job();
space = job;
jobEntryTrans.setParentJob(job);
targetMetaName = TRANS_FILE;
jobEntryTrans.setTransname(targetMetaName);
jobEntryTrans.setTransObjectId(null);
// repo stuff
keyPath = convertToRepoKeyPath(keyPath);
jobEntryTrans.setDirectory(keyPath.substring(0, keyPath.lastIndexOf("/")));
jobEntryTrans.setTransObjectId(null);
RepositoryDirectoryInterface rdi = mock(RepositoryDirectoryInterface.class);
when(rdi.findDirectory(jobEntryTrans.getDirectory())).thenReturn(rdi);
when(repository.loadRepositoryDirectoryTree()).thenReturn(rdi);
TransMeta transMeta = new TransMeta();
transMeta.setName(stripExtension(TRANS_FILE));
when(repository.loadTransformation(TRANS_FILE, rdi, null, true, null)).thenReturn(transMeta);
}
use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPoint method createSlaveServerRunConfigurations.
private List<RunConfiguration> createSlaveServerRunConfigurations(List<String> existingConfigurationNames, AbstractMeta abstractMeta) {
List<RunConfiguration> runConfigurations = new ArrayList<>();
if (abstractMeta instanceof JobMeta) {
JobMeta jobMeta = (JobMeta) abstractMeta;
Map<String, List<JobEntryTrans>> slaveServerGroups = jobMeta.getJobCopies().stream().map(JobEntryCopy::getEntry).filter(entry -> entry instanceof JobEntryTrans).map(entry -> (JobEntryTrans) entry).filter(entry -> Utils.isEmpty(entry.getRunConfiguration())).filter(entry -> !Utils.isEmpty(entry.getRemoteSlaveServerName())).collect(Collectors.groupingBy(JobEntryTrans::getRemoteSlaveServerName));
slaveServerGroups.forEach((remoteServerName, entries) -> {
String runConfigurationName = createRunConfigurationName(existingConfigurationNames, remoteServerName);
DefaultRunConfiguration runConfiguration = createRunConfiguration(runConfigurationName, remoteServerName);
runConfigurations.add(runConfiguration);
entries.forEach(e -> e.setRunConfiguration(runConfiguration.getName()));
});
}
return runConfigurations;
}
use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPointTest method shouldCreateRunConfigurationsForSlaveServer.
@Test
public void shouldCreateRunConfigurationsForSlaveServer() throws Exception {
JobMeta jobMeta = mock(JobMeta.class);
JobEntryCopy jobEntryCopy1 = mock(JobEntryCopy.class);
JobEntryCopy jobEntryCopy2 = mock(JobEntryCopy.class);
JobEntryCopy jobEntryCopy3 = mock(JobEntryCopy.class);
JobEntryTrans trans1 = mock(JobEntryTrans.class);
JobEntryTrans trans2 = mock(JobEntryTrans.class);
JobEntryTrans trans3 = mock(JobEntryTrans.class);
ArgumentCaptor<DefaultRunConfiguration> rcCaptor = ArgumentCaptor.forClass(DefaultRunConfiguration.class);
when(jobMeta.getEmbeddedMetaStore()).thenReturn(embeddedMetaStore);
when(jobMeta.getSlaveServers()).thenReturn(Arrays.asList(new SlaveServer("carte1", "host1", "1234", "user", "passw"), new SlaveServer("carte2", "host2", "1234", "user", "passw")));
when(jobMeta.getJobCopies()).thenReturn(Arrays.asList(jobEntryCopy1, jobEntryCopy2, jobEntryCopy3));
when(jobEntryCopy1.getEntry()).thenReturn(trans1);
when(jobEntryCopy2.getEntry()).thenReturn(trans2);
when(jobEntryCopy3.getEntry()).thenReturn(trans3);
when(trans1.getRemoteSlaveServerName()).thenReturn("carte1");
when(trans2.getRemoteSlaveServerName()).thenReturn("carte1");
when(trans3.getRemoteSlaveServerName()).thenReturn("carte2");
when(trans1.getRunConfiguration()).thenReturn(null);
when(trans2.getRunConfiguration()).thenReturn(null);
when(trans3.getRunConfiguration()).thenReturn(null);
when(runConfigurationManager.getNames()).thenReturn(Collections.singletonList("pentaho_auto_carte1_config"));
runConfigurationImportExtensionPoint.callExtensionPoint(log, jobMeta);
verify(runConfigurationManager, times(2)).save(rcCaptor.capture());
verify(trans1).setRunConfiguration("pentaho_auto_carte1_config_1");
verify(trans2).setRunConfiguration("pentaho_auto_carte1_config_1");
verify(trans3).setRunConfiguration("pentaho_auto_carte2_config");
List<DefaultRunConfiguration> allValues = rcCaptor.getAllValues();
DefaultRunConfiguration runConfiguration1 = allValues.get(0);
assertEquals("pentaho_auto_carte1_config_1", runConfiguration1.getName());
assertEquals("carte1", runConfiguration1.getServer());
DefaultRunConfiguration runConfiguration2 = allValues.get(1);
assertEquals("pentaho_auto_carte2_config", runConfiguration2.getName());
assertEquals("carte2", runConfiguration2.getServer());
}
Aggregations