use of com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution in project kylo by Teradata.
the class DefaultJobService method stopJobExecution.
@Override
public boolean stopJobExecution(ReplayJobExecution replayJobExecution) throws JobExecutionException {
SavepointReplayJobExecution savepointReplayJobExecution = ((SavepointReplayJobExecution) replayJobExecution);
return metadataAccess.commit(() -> {
BatchJobExecution jobExecution = this.jobExecutionProvider.findByJobExecutionId(savepointReplayJobExecution.getJobExecutionId(), false);
if (jobExecution != null) {
((JpaBatchJobExecution) jobExecution).markAsRunning();
// ((JpaBatchJobExecution)jobExecution).failJob();
// trigger the jms message
SavepointReplayEvent event = new SavepointReplayEvent();
event.setJobExecutionId(savepointReplayJobExecution.getJobExecutionId());
event.setFlowfileId(savepointReplayJobExecution.getFlowFileId());
event.setAction(SavepointReplayEvent.Action.RELEASE);
savepointReplayJmsEventService.triggerSavepoint(event);
}
return true;
});
}
use of com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution in project kylo by Teradata.
the class DefaultJobService method restartJobExecution.
@Override
public Long restartJobExecution(ReplayJobExecution replayJobExecution) throws JobExecutionException {
SavepointReplayJobExecution savepointReplayJobExecution = ((SavepointReplayJobExecution) replayJobExecution);
return metadataAccess.commit(() -> {
BatchJobExecution jobExecution = this.jobExecutionProvider.findByJobExecutionId(savepointReplayJobExecution.getJobExecutionId(), false);
if (jobExecution != null) {
((JpaBatchJobExecution) jobExecution).markAsRunning();
// trigger the jms message
SavepointReplayEvent event = new SavepointReplayEvent();
event.setJobExecutionId(savepointReplayJobExecution.getJobExecutionId());
event.setFlowfileId(savepointReplayJobExecution.getFlowFileId());
event.setAction(SavepointReplayEvent.Action.RETRY);
savepointReplayJmsEventService.triggerSavepoint(event);
return jobExecution.getJobExecutionId();
}
return null;
});
}
use of com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution in project kylo by Teradata.
the class JobsRestController method triggerSavepointRelease.
@POST
@Path("/{executionId}/savepoint/trigger-release/{flowfileId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "replay the specified job.", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the job.", response = ExecutedJob.class), @ApiResponse(code = 404, message = "The executionId is not a valid integer.", response = RestResponseStatus.class) })
public Response triggerSavepointRelease(@PathParam("executionId") Long executionId, @PathParam("flowfileId") String flowfileId) throws JobExecutionException {
log.info("Attempt to trigger Release for savepoint on job {} with flowfile: {} ", executionId, flowfileId);
SavepointReplayJobExecution savepointReplayJobExecution = new SavepointReplayJobExecution(executionId, flowfileId, SavepointReplayEvent.Action.RELEASE.name());
this.jobService.stopJobExecution(savepointReplayJobExecution);
return Response.ok(new RestResponseStatus.ResponseStatusBuilder().buildSuccess()).build();
}
use of com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution in project kylo by Teradata.
the class JobsRestController method triggerSavepointRetry.
@POST
@Path("/{executionId}/savepoint/trigger-retry/{flowfileId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "replay the specified job.", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the job.", response = ExecutedJob.class), @ApiResponse(code = 404, message = "The executionId is not a valid integer.", response = RestResponseStatus.class) })
public Response triggerSavepointRetry(@PathParam("executionId") Long executionId, @PathParam("flowfileId") String flowfileId) throws JobExecutionException {
log.info("Attempt to trigger Retry for savepoint on job {} with flowfile: {} ", executionId, flowfileId);
SavepointReplayJobExecution savepointReplayJobExecution = new SavepointReplayJobExecution(executionId, flowfileId, SavepointReplayEvent.Action.RETRY.name());
this.jobService.restartJobExecution(savepointReplayJobExecution);
return Response.ok(new RestResponseStatus.ResponseStatusBuilder().buildSuccess()).build();
}
Aggregations