use of com.thinkbiganalytics.jobrepo.query.model.CheckDataJob in project kylo by Teradata.
the class JobModelTransform method checkDataJob.
public static CheckDataJob checkDataJob(LatestFeedJobExecution latestFeedJobExecution) {
ExecutedJob job = executedJob(latestFeedJobExecution);
CheckDataJob checkDataJob = new DefaultCheckDataJob(job);
boolean valid = false;
String msg = "Unknown";
Map<String, String> jobExecutionContext = latestFeedJobExecution.getJobExecution().getJobExecutionContextAsMap();
if (BatchJobExecution.JobStatus.ABANDONED.equals(latestFeedJobExecution.getStatus())) {
valid = true;
msg = latestFeedJobExecution.getExitMessage();
} else if (jobExecutionContext != null) {
msg = jobExecutionContext.get(CheckDataStepConstants.VALIDATION_MESSAGE_KEY);
String isValid = jobExecutionContext.get(CheckDataStepConstants.VALIDATION_KEY);
if (msg == null) {
msg = job.getExitStatus();
}
if (StringUtils.isBlank(isValid)) {
valid = ExitStatus.COMPLETED.getExitCode().equals(job.getExitStatus());
} else {
valid = BooleanUtils.toBoolean(isValid);
}
}
checkDataJob.setValidationMessage(msg);
checkDataJob.setIsValid(valid);
return checkDataJob;
}
Aggregations