Search in sources :

Example 1 with ExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.ExecutedJob 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)

Example 2 with ExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.ExecutedJob in project kylo by Teradata.

the class JobsRestController method getJob.

@GET
@Path("/{executionId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets the specified job.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the job.", response = ExecutedJob.class), @ApiResponse(code = 400, message = "The executionId is not a valid integer.", response = RestResponseStatus.class) })
public ExecutedJob getJob(@PathParam("executionId") String executionId, @QueryParam(value = "includeSteps") @DefaultValue("false") boolean includeSteps) {
    this.accessController.checkPermission(AccessController.SERVICES, OperationsAccessControl.ACCESS_OPS);
    return metadataAccess.read(() -> {
        ExecutedJob executedJob = null;
        BatchJobExecution jobExecution = jobExecutionProvider.findByJobExecutionId(Long.parseLong(executionId), false);
        if (jobExecution != null) {
            if (includeSteps) {
                executedJob = JobModelTransform.executedJob(jobExecution);
            } else {
                executedJob = JobModelTransform.executedJobSimple(jobExecution);
            }
        }
        return executedJob;
    });
}
Also used : ExecutedJob(com.thinkbiganalytics.jobrepo.query.model.ExecutedJob) BatchJobExecution(com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

ExecutedJob (com.thinkbiganalytics.jobrepo.query.model.ExecutedJob)2 CheckDataJob (com.thinkbiganalytics.jobrepo.query.model.CheckDataJob)1 DefaultCheckDataJob (com.thinkbiganalytics.jobrepo.query.model.DefaultCheckDataJob)1 DefaultExecutedJob (com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)1 BatchJobExecution (com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1