Search in sources :

Example 1 with SavepointReplayEvent

use of com.thinkbiganalytics.nifi.savepoint.model.SavepointReplayEvent 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 SavepointReplayEvent

use of com.thinkbiganalytics.nifi.savepoint.model.SavepointReplayEvent 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)

Aggregations

SavepointReplayJobExecution (com.thinkbiganalytics.jobrepo.model.SavepointReplayJobExecution)2 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