Search in sources :

Example 41 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class StopStartUpscaleFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(StackAndClusterUpscaleTriggerEvent event) {
    StackView stackView = stackService.getViewByIdWithoutAuth(event.getResourceId());
    ClusterView clusterView = stackView.getClusterView();
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    addStackSyncTriggerEvent(event, flowEventChain);
    addClusterScaleTriggerEventIfNeeded(event, stackView, clusterView, flowEventChain);
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : ClusterView(com.sequenceiq.cloudbreak.domain.view.ClusterView) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StackView(com.sequenceiq.cloudbreak.domain.view.StackView) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 42 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class TerminationFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(TerminationEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    flowEventChain.add(new StackEvent(ClusterTerminationEvent.TERMINATION_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new TerminationEvent(START_EXTERNAL_DATABASE_TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType(), event.accepted()));
    flowEventChain.add(new TerminationEvent(StackTerminationEvent.TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType(), event.accepted()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) ClusterTerminationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent) StackTerminationEvent(com.sequenceiq.cloudbreak.core.flow2.stack.termination.StackTerminationEvent) TerminationEvent(com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)

Example 43 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class UpgradeDatalakeFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(ClusterUpgradeTriggerEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    addUpgradeValidationToChain(event, flowEventChain);
    flowEventChain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new ClusterUpgradeTriggerEvent(CLUSTER_UPGRADE_INIT_EVENT.event(), event.getResourceId(), event.accepted(), event.getImageId()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) ClusterUpgradeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterUpgradeTriggerEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 44 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class UpgradeDistroxFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(DistroXUpgradeTriggerEvent event) {
    LOGGER.debug("Creating flow trigger event queue for distrox upgrade with event {}", event);
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    createUpgradeValidationEvent(event).ifPresent(flowEventChain::add);
    flowEventChain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new ClusterUpgradeTriggerEvent(CLUSTER_UPGRADE_INIT_EVENT.event(), event.getResourceId(), event.accepted(), event.getImageChangeDto().getImageId()));
    flowEventChain.add(new StackImageUpdateTriggerEvent(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT, event.getImageChangeDto()));
    if (event.isReplaceVms()) {
        Map<String, List<String>> nodeMap = getReplaceableInstancesByHostgroup(event);
        flowEventChain.add(new ClusterRepairTriggerEvent(FlowChainTriggers.CLUSTER_REPAIR_TRIGGER_EVENT, event.getResourceId(), nodeMap, true, event.getTriggeredStackVariant()));
    }
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : ClusterRepairTriggerEvent(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterRepairTriggerEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) ClusterUpgradeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterUpgradeTriggerEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) StackImageUpdateTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)

Example 45 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class RecoverDatalakeFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(ClusterRecoveryTriggerEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    flowEventChain.add(new FlowChainInitPayload(getName(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new TerminationEvent(FlowChainTriggers.RECOVERY_TERMINATION_TRIGGER_EVENT, event.getResourceId(), TerminationType.RECOVERY));
    flowEventChain.add(new ClusterRecoveryTriggerEvent(RECOVERY_BRINGUP_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new StackEvent(FlowChainTriggers.RECOVERY_PROVISION_TRIGGER_EVENT, event.getResourceId(), event.accepted()));
    flowEventChain.add(new FlowChainFinalizePayload(getName(), event.getResourceId(), event.accepted()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : FlowChainInitPayload(com.sequenceiq.flow.core.chain.init.flowevents.FlowChainInitPayload) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) FlowChainFinalizePayload(com.sequenceiq.flow.core.chain.finalize.flowevents.FlowChainFinalizePayload) ClusterRecoveryTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterRecoveryTriggerEvent) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) TerminationEvent(com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)

Aggregations

FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)52 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)35 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)26 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)15 Test (org.junit.Test)10 Test (org.junit.jupiter.api.Test)9 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)5 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)4 TerminationEvent (com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)4 ClusterTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent)3 StackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackDownscaleTriggerEvent)3 StackSyncTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent)3 StackTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.stack.termination.StackTerminationEvent)3 DatalakeResizeRecoveryFlowChainStartEvent (com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent)3 CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)2 Payload (com.sequenceiq.cloudbreak.common.event.Payload)2 ClusterAndStackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterAndStackDownscaleTriggerEvent)2 ClusterDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterDownscaleTriggerEvent)2