use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class StackCreationActions method stackCreationFailureAction.
@Bean(name = "STACK_CREATION_FAILED_STATE")
public Action<?, ?> stackCreationFailureAction() {
return new AbstractStackFailureAction<StackCreationState, StackCreationEvent>() {
@Override
protected StackFailureContext createFlowContext(String flowId, StateContext<StackCreationState, StackCreationEvent> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowId);
StackView stackView = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stackView);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowId, stackView);
}
@Override
protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
stackCreationService.handleStackCreationFailure(context.getStackView(), payload.getException());
metricService.incrementMetricCounter(MetricType.STACK_CREATION_FAILED, context.getStackView());
sendEvent(context);
}
@Override
protected Selectable createRequest(StackFailureContext context) {
return new StackEvent(StackCreationEvent.STACKCREATION_FAILURE_HANDLED_EVENT.event(), context.getStackView().getId());
}
};
}
use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class AbstractClusterUpgradeAction method createFlowContext.
@Override
protected ClusterViewContext createFlowContext(String flowId, StateContext<ClusterUpgradeState, ClusterUpgradeEvent> stateContext, P payload) {
StackView stack = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stack.getId().toString(), stack.getName(), stack.getOwner(), "CLUSTER");
return new ClusterViewContext(flowId, stack);
}
use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class StackCommonService method put.
public Response put(Long id, UpdateStackJson updateRequest) {
StackView stack = stackService.getByIdView(id);
MDCBuilder.buildMdcContext(stack);
if (updateRequest.getStatus() != null) {
stackService.updateStatus(id, updateRequest.getStatus(), updateRequest.getWithClusterEvent());
} else {
Integer scalingAdjustment = updateRequest.getInstanceGroupAdjustment().getScalingAdjustment();
validateAccountPreferences(id, scalingAdjustment);
stackService.updateNodeCount(id, updateRequest.getInstanceGroupAdjustment(), updateRequest.getWithClusterEvent());
}
return Response.status(Status.NO_CONTENT).build();
}
use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class AbstractStackFailureAction method createFlowContext.
@Override
protected StackFailureContext createFlowContext(String flowId, StateContext<S, E> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowId);
StackView stack = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stack);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowId, stack);
}
use of com.sequenceiq.cloudbreak.domain.view.StackView in project cloudbreak by hortonworks.
the class InstanceTerminationFlowTriggerCondition method isFlowTriggerable.
@Override
public boolean isFlowTriggerable(Long stackId) {
StackView stack = stackService.getByIdView(stackId);
boolean result = !stack.isDeleteInProgress();
if (result) {
LOGGER.info("Couldn't start instance termination flow because the stack has been terminating.");
}
return result;
}
Aggregations