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;
}
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;
});
}
Aggregations