use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.
the class ReactorFlowManager method notify.
private void notify(String selector, Acceptable acceptable) {
Event<Acceptable> event = eventFactory.createEventWithErrHandler(acceptable);
reactor.notify(selector, event);
try {
Boolean accepted = true;
if (event.getData().accepted() != null) {
accepted = event.getData().accepted().await(WAIT_FOR_ACCEPT, TimeUnit.SECONDS);
}
if (accepted == null || !accepted) {
Stack stack = stackService.get(event.getData().getStackId());
throw new FlowsAlreadyRunningException(String.format("Stack %s has flows under operation, request not allowed.", stack.getName()));
}
} catch (InterruptedException e) {
throw new CloudbreakApiException(e.getMessage());
}
}
use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.
the class ReactorFlowManager method triggerClusterUpscale.
public void triggerClusterUpscale(Long stackId, HostGroupAdjustmentJson hostGroupAdjustment) {
String selector = CLUSTER_UPSCALE_TRIGGER_EVENT.event();
Acceptable event = new ClusterScaleTriggerEvent(selector, stackId, hostGroupAdjustment.getHostGroup(), hostGroupAdjustment.getScalingAdjustment());
notify(selector, event);
}
use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.
the class ReactorFlowManager method triggerStackUpscale.
public void triggerStackUpscale(Long stackId, InstanceGroupAdjustmentJson instanceGroupAdjustment, boolean withClusterEvent) {
String selector = FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT;
Acceptable stackAndClusterUpscaleTriggerEvent = new StackAndClusterUpscaleTriggerEvent(selector, stackId, instanceGroupAdjustment.getInstanceGroup(), instanceGroupAdjustment.getScalingAdjustment(), withClusterEvent ? ScalingType.UPSCALE_TOGETHER : ScalingType.UPSCALE_ONLY_STACK);
notify(selector, stackAndClusterUpscaleTriggerEvent);
}
use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.
the class ReactorFlowManager method triggerStackDownscale.
public void triggerStackDownscale(Long stackId, InstanceGroupAdjustmentJson instanceGroupAdjustment) {
String selector = STACK_DOWNSCALE_EVENT.event();
Acceptable stackScaleTriggerEvent = new StackDownscaleTriggerEvent(selector, stackId, instanceGroupAdjustment.getInstanceGroup(), instanceGroupAdjustment.getScalingAdjustment());
notify(selector, stackScaleTriggerEvent);
}
use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.
the class ReactorFlowManager method triggerClusterDownscale.
public void triggerClusterDownscale(Long stackId, HostGroupAdjustmentJson hostGroupAdjustment) {
String selector = FlowChainTriggers.FULL_DOWNSCALE_TRIGGER_EVENT;
ScalingType scalingType = hostGroupAdjustment.getWithStackUpdate() ? ScalingType.DOWNSCALE_TOGETHER : ScalingType.DOWNSCALE_ONLY_CLUSTER;
Acceptable event = new ClusterAndStackDownscaleTriggerEvent(selector, stackId, hostGroupAdjustment.getHostGroup(), hostGroupAdjustment.getScalingAdjustment(), scalingType);
notify(selector, event);
}
Aggregations