Search in sources :

Example 1 with SavepointReplayJobExecution

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;
    });
}
Also used : JpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.JpaBatchJobExecution) BatchJobExecution(com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution) SavepointReplayJobExecution(com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution) SavepointReplayEvent(com.thinkbiganalytics.nifi.savepoint.model.SavepointReplayEvent) JpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.JpaBatchJobExecution)

Example 2 with SavepointReplayJobExecution

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;
    });
}
Also used : JpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.JpaBatchJobExecution) BatchJobExecution(com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution) SavepointReplayJobExecution(com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution) SavepointReplayEvent(com.thinkbiganalytics.nifi.savepoint.model.SavepointReplayEvent) JpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.JpaBatchJobExecution)

Example 3 with SavepointReplayJobExecution

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();
}
Also used : SavepointReplayJobExecution(com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 4 with SavepointReplayJobExecution

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();
}
Also used : SavepointReplayJobExecution(com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

SavepointReplayJobExecution (com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution)4 BatchJobExecution (com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution)2 JpaBatchJobExecution (com.thinkbiganalytics.metadata.jpa.jobrepo.job.JpaBatchJobExecution)2 SavepointReplayEvent (com.thinkbiganalytics.nifi.savepoint.model.SavepointReplayEvent)2 RestResponseStatus (com.thinkbiganalytics.rest.model.RestResponseStatus)2 ApiOperation (io.swagger.annotations.ApiOperation)2 ApiResponses (io.swagger.annotations.ApiResponses)2 POST (javax.ws.rs.POST)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2