use of org.pentaho.di.core.logging.JobEntryLogTable in project pentaho-kettle by pentaho.
the class Job method writeJobEntryLogInformation.
/**
* Write job entry log information.
*
* @throws KettleException
* the kettle exception
*/
protected void writeJobEntryLogInformation() throws KettleException {
Database db = null;
JobEntryLogTable jobEntryLogTable = getJobMeta().getJobEntryLogTable();
try {
db = createDataBase(jobEntryLogTable.getDatabaseMeta());
db.shareVariablesWith(this);
db.connect();
db.setCommit(logCommitSize);
for (JobEntryCopy copy : getJobMeta().getJobCopies()) {
db.writeLogRecord(jobEntryLogTable, LogStatus.START, copy, this);
}
db.cleanupLogRecords(jobEntryLogTable);
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(PKG, "Job.Exception.UnableToJobEntryInformationToLogTable"), e);
} finally {
if (!db.isAutoCommit()) {
db.commitLog(true, jobEntryLogTable);
}
db.disconnect();
}
}
use of org.pentaho.di.core.logging.JobEntryLogTable in project pentaho-kettle by pentaho.
the class RepositoryTestBase method createJobMeta.
protected JobMeta createJobMeta(String jobName) throws Exception {
RepositoryDirectoryInterface rootDir = loadStartDirectory();
JobMeta jobMeta = new JobMeta();
jobMeta.setName(jobName);
jobMeta.setDescription(EXP_JOB_DESC);
jobMeta.setExtendedDescription(EXP_JOB_EXTENDED_DESC);
jobMeta.setRepositoryDirectory(rootDir.findDirectory(DIR_JOBS));
jobMeta.setJobversion(EXP_JOB_VERSION);
jobMeta.setJobstatus(EXP_JOB_STATUS);
jobMeta.setCreatedUser(EXP_JOB_CREATED_USER);
jobMeta.setCreatedDate(EXP_JOB_CREATED_DATE);
jobMeta.setModifiedUser(EXP_JOB_MOD_USER);
jobMeta.setModifiedDate(EXP_JOB_MOD_DATE);
jobMeta.addParameterDefinition(EXP_JOB_PARAM_1_NAME, EXP_JOB_PARAM_1_DEF, EXP_JOB_PARAM_1_DESC);
// TODO mlowery other jobLogTable fields could be set for testing here
JobLogTable jobLogTable = JobLogTable.getDefault(jobMeta, jobMeta);
jobLogTable.setConnectionName(EXP_JOB_LOG_TABLE_CONN_NAME);
jobLogTable.setLogInterval(EXP_JOB_LOG_TABLE_INTERVAL);
jobLogTable.setSchemaName(EXP_JOB_LOG_TABLE_SCHEMA_NAME);
jobLogTable.setLogSizeLimit(EXP_JOB_LOG_TABLE_SIZE_LIMIT);
jobLogTable.setTableName(EXP_JOB_LOG_TABLE_TABLE_NAME);
jobLogTable.setTimeoutInDays(EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS);
jobMeta.setJobLogTable(jobLogTable);
// TODO mlowery other jobEntryLogTable fields could be set for testing here
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault(jobMeta, jobMeta);
jobEntryLogTable.setConnectionName(EXP_JOB_LOG_TABLE_CONN_NAME);
jobEntryLogTable.setSchemaName(EXP_JOB_LOG_TABLE_SCHEMA_NAME);
jobEntryLogTable.setTableName(EXP_JOB_LOG_TABLE_TABLE_NAME);
jobEntryLogTable.setTimeoutInDays(EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS);
jobMeta.setJobEntryLogTable(jobEntryLogTable);
// TODO mlowery other channelLogTable fields could be set for testing here
ChannelLogTable channelLogTable = ChannelLogTable.getDefault(jobMeta, jobMeta);
channelLogTable.setConnectionName(EXP_JOB_LOG_TABLE_CONN_NAME);
channelLogTable.setSchemaName(EXP_JOB_LOG_TABLE_SCHEMA_NAME);
channelLogTable.setTableName(EXP_JOB_LOG_TABLE_TABLE_NAME);
channelLogTable.setTimeoutInDays(EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS);
jobMeta.setChannelLogTable(channelLogTable);
jobMeta.setBatchIdPassed(EXP_JOB_BATCH_ID_PASSED);
jobMeta.setSharedObjectsFile(EXP_JOB_SHARED_OBJECTS_FILE);
DatabaseMeta entryDbMeta = createDatabaseMeta(EXP_DBMETA_NAME_JOB.concat(jobName));
repository.save(entryDbMeta, VERSION_COMMENT_V1, null);
deleteStack.push(entryDbMeta);
JobEntryCopy jobEntryCopy1 = createJobEntry1Copy(entryDbMeta);
jobMeta.addJobEntry(jobEntryCopy1);
JobEntryCopy jobEntryCopy2 = createJobEntry2Copy(entryDbMeta);
jobMeta.addJobEntry(jobEntryCopy2);
jobMeta.addJobHop(createJobHopMeta(jobEntryCopy1, jobEntryCopy2));
jobMeta.addNote(createNotePadMeta(jobName));
return jobMeta;
}
use of org.pentaho.di.core.logging.JobEntryLogTable in project pentaho-kettle by pentaho.
the class PurRepositoryUnitTest method onlyGlobalVariablesOfLogTablesSetToNull.
@Test
public void onlyGlobalVariablesOfLogTablesSetToNull() {
try {
System.setProperty(Const.KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT, "true");
PurRepositoryExporter purRepoExporter = new PurRepositoryExporter(mock(PurRepository.class));
String hardcodedString = "hardcoded";
String globalParam = "${" + Const.KETTLE_TRANS_LOG_TABLE + "}";
StepLogTable stepLogTable = StepLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
stepLogTable.setConnectionName(hardcodedString);
stepLogTable.setSchemaName(hardcodedString);
stepLogTable.setTimeoutInDays(hardcodedString);
stepLogTable.setTableName(globalParam);
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
jobEntryLogTable.setConnectionName(hardcodedString);
jobEntryLogTable.setSchemaName(hardcodedString);
jobEntryLogTable.setTimeoutInDays(hardcodedString);
jobEntryLogTable.setTableName(globalParam);
List<LogTableInterface> logTables = new ArrayList<>();
logTables.add(jobEntryLogTable);
logTables.add(stepLogTable);
purRepoExporter.setGlobalVariablesOfLogTablesNull(logTables);
for (LogTableInterface logTable : logTables) {
assertEquals(logTable.getConnectionName(), hardcodedString);
assertEquals(logTable.getSchemaName(), hardcodedString);
assertEquals(logTable.getTimeoutInDays(), hardcodedString);
assertEquals(logTable.getTableName(), null);
}
} finally {
System.setProperty(Const.KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT, "false");
}
}
use of org.pentaho.di.core.logging.JobEntryLogTable in project pentaho-kettle by pentaho.
the class PurRepositoryUnitTest method globalVariablesOfLogTablesNotSetToNull.
@Test
public void globalVariablesOfLogTablesNotSetToNull() {
PurRepositoryExporter purRepoExporter = new PurRepositoryExporter(mock(PurRepository.class));
String globalParam = "${" + Const.KETTLE_TRANS_LOG_TABLE + "}";
StepLogTable stepLogTable = StepLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
stepLogTable.setConnectionName(globalParam);
stepLogTable.setSchemaName(globalParam);
stepLogTable.setTimeoutInDays(globalParam);
stepLogTable.setTableName(globalParam);
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
jobEntryLogTable.setConnectionName(globalParam);
jobEntryLogTable.setSchemaName(globalParam);
jobEntryLogTable.setTimeoutInDays(globalParam);
jobEntryLogTable.setTableName(globalParam);
List<LogTableInterface> logTables = new ArrayList<>();
logTables.add(jobEntryLogTable);
logTables.add(stepLogTable);
purRepoExporter.setGlobalVariablesOfLogTablesNull(logTables);
for (LogTableInterface logTable : logTables) {
assertEquals(logTable.getConnectionName(), globalParam);
assertEquals(logTable.getSchemaName(), globalParam);
assertEquals(logTable.getTimeoutInDays(), globalParam);
assertEquals(logTable.getTableName(), globalParam);
}
}
use of org.pentaho.di.core.logging.JobEntryLogTable in project pentaho-kettle by pentaho.
the class JobDialog method getLogInfo.
private void getLogInfo(int previousLogTableIndex) {
if (previousLogTableIndex < 0) {
return;
}
// Remember the that was entered data...
//
LogTableInterface modifiedLogTable = logTables.get(previousLogTableIndex);
LogTableUserInterface logTableUserInterface = logTableUserInterfaces.get(previousLogTableIndex);
if (logTableUserInterface != null) {
logTableUserInterface.retrieveLogTableOptions(modifiedLogTable);
} else {
if (modifiedLogTable instanceof JobLogTable) {
getJobLogTableOptions((JobLogTable) modifiedLogTable);
} else if (modifiedLogTable instanceof ChannelLogTable) {
getChannelLogTableOptions((ChannelLogTable) modifiedLogTable);
} else if (modifiedLogTable instanceof JobEntryLogTable) {
getJobEntryLogTableOptions((JobEntryLogTable) modifiedLogTable);
}
}
}
Aggregations