Search in sources :

Example 1 with DefaultCheckDataJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultCheckDataJob 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;
}
Also used : DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) ExecutedJob(com.thinkbiganalytics.jobrepo.query.model.ExecutedJob) DefaultCheckDataJob(com.thinkbiganalytics.jobrepo.query.model.DefaultCheckDataJob) DefaultCheckDataJob(com.thinkbiganalytics.jobrepo.query.model.DefaultCheckDataJob) CheckDataJob(com.thinkbiganalytics.jobrepo.query.model.CheckDataJob)

Aggregations

CheckDataJob (com.thinkbiganalytics.jobrepo.query.model.CheckDataJob)1 DefaultCheckDataJob (com.thinkbiganalytics.jobrepo.query.model.DefaultCheckDataJob)1 DefaultExecutedJob (com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)1 ExecutedJob (com.thinkbiganalytics.jobrepo.query.model.ExecutedJob)1