use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class Flow2Handler method retryLastFailedFlowFromStart.
/**
* Retry the failed flow completely
*
* @param resourceId Datalake ID
* @return Identifier of flow or a flow chain
*/
public FlowIdentifier retryLastFailedFlowFromStart(Long resourceId) {
FlowLog firstSuccessfulStateLog = getFirstRetryableStateLogfromLatestFlow(resourceId);
LOGGER.info("Trying to restart flow {}", firstSuccessfulStateLog.getFlowType().getName());
restartFlow(firstSuccessfulStateLog);
LOGGER.info("Restarted flow : {}", firstSuccessfulStateLog.getFlowType().getName());
if (firstSuccessfulStateLog.getFlowChainId() != null) {
return new FlowIdentifier(FlowType.FLOW_CHAIN, firstSuccessfulStateLog.getFlowChainId());
} else {
return new FlowIdentifier(FlowType.FLOW, firstSuccessfulStateLog.getFlowId());
}
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class TerminationTriggerServiceTest method whenStackNotDeletedAndNotForcedTerminationFlowLogAndForcedShouldTerminate.
@Test
public void whenStackNotDeletedAndNotForcedTerminationFlowLogAndForcedShouldTerminate() {
FlowLog flowLog = getTerminationFlowLog(false);
when(flowLogService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(anyLong())).thenReturn(List.of(flowLog));
setupKerberized();
underTest.triggerTermination(getAvailableStack(), true);
verifyTerminationEventFired(true, true, false);
verify(flowCancelService).cancelFlowSilently(flowLog);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class TerminationTriggerServiceTest method whenStackNotDeletedAndNotTerminationFlowLogAndKerbAndForcedShouldTerminate.
@Test
public void whenStackNotDeletedAndNotTerminationFlowLogAndKerbAndForcedShouldTerminate() {
FlowLog flowLog = new FlowLog();
flowLog.setFlowType(ClassValue.of(StackCreationFlowConfig.class));
when(flowLogService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(anyLong())).thenReturn(List.of(flowLog));
setupKerberized();
underTest.triggerTermination(getAvailableStack(), true);
verifyTerminationEventFired(true, true, false);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class TerminationTriggerServiceTest method getTerminationFlowLog.
private FlowLog getTerminationFlowLog(boolean forced) {
FlowLog flowLog = new FlowLog();
flowLog.setFlowType(ClassValue.of(StackTerminationFlowConfig.class));
flowLog.setCurrentState("INIT_STATE");
TerminationEvent event = new TerminationEvent("selector", 1L, forced ? TerminationType.FORCED : TerminationType.REGULAR);
flowLog.setPayload(JsonWriter.objectToJson(event));
flowLog.setPayloadType(ClassValue.of(TerminationEvent.class));
return flowLog;
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class TerminationTriggerServiceTest method whenStackNotDeletedAndNotTerminationFlowLogAndNotKerbAndNotForcedShouldTerminate.
@Test
public void whenStackNotDeletedAndNotTerminationFlowLogAndNotKerbAndNotForcedShouldTerminate() {
FlowLog flowLog = new FlowLog();
flowLog.setFlowType(ClassValue.of(StackCreationFlowConfig.class));
when(flowLogService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(anyLong())).thenReturn(List.of(flowLog));
setupNotKerberized();
underTest.triggerTermination(getAvailableStack(), false);
verifyTerminationEventFired(false, false, false);
}
Aggregations