Search in sources :

Example 1 with SdxDeleteStartEvent

use of com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent in project cloudbreak by hortonworks.

the class DatalakeResizeRecoveryFlowEventChainTest method checkEventIsDeletion.

private void checkEventIsDeletion(Selectable event) {
    assertEquals(SDX_DELETE_EVENT.selector(), event.selector());
    assertTrue(event instanceof SdxDeleteStartEvent);
    assertEquals(NEW_CLUSTER_SDX_ID, event.getResourceId());
    SdxDeleteStartEvent sdxDeleteStartEvent = (SdxDeleteStartEvent) event;
    assertTrue(sdxDeleteStartEvent.isForced());
}
Also used : SdxDeleteStartEvent(com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent)

Example 2 with SdxDeleteStartEvent

use of com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent in project cloudbreak by hortonworks.

the class DatalakeResizeFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(DatalakeResizeFlowChainStartEvent event) {
    Queue<Selectable> chain = new ConcurrentLinkedQueue<>();
    if (event.shouldTakeBackup()) {
        // Take a backup
        chain.add(new DatalakeTriggerBackupEvent(DATALAKE_TRIGGER_BACKUP_EVENT.event(), event.getResourceId(), event.getUserId(), event.getBackupLocation(), "resize" + System.currentTimeMillis(), DatalakeBackupFailureReason.BACKUP_ON_RESIZE, event.accepted()));
        // Stop datalake
        chain.add(new SdxStartStopEvent(SDX_STOP_EVENT.event(), event.getResourceId(), event.getUserId(), STOP_DATAHUBS));
    } else {
        chain.add(new SdxStartStopEvent(SDX_STOP_EVENT.event(), event.getResourceId(), event.getUserId(), STOP_DATAHUBS, event.accepted()));
    }
    // Detach sdx from environment
    chain.add(new SdxStartDetachEvent(SDX_DETACH_EVENT.event(), event.getResourceId(), event.getSdxCluster(), event.getUserId()));
    // Create new
    chain.add(new SdxEvent(SDX_VALIDATION_EVENT.event(), event.getResourceId(), event.getSdxCluster().getClusterName(), event.getUserId()));
    if (event.shouldPerformRestore()) {
        // restore the new cluster
        chain.add(new DatalakeTriggerRestoreEvent(DATALAKE_TRIGGER_RESTORE_EVENT.event(), event.getResourceId(), event.getSdxCluster().getClusterName(), event.getUserId(), null, event.getBackupLocation(), null, DatalakeRestoreFailureReason.RESTORE_ON_RESIZE));
    }
    // Delete the detached Sdx
    chain.add(new SdxDeleteStartEvent(SDX_DELETE_EVENT.event(), event.getResourceId(), event.getUserId(), true));
    chain.add(new DatahubRefreshStartEvent(event.getResourceId(), event.getSdxCluster().getClusterName(), event.getUserId()));
    return new FlowTriggerEventQueue(getName(), event, chain);
}
Also used : DatalakeTriggerRestoreEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) SdxStartStopEvent(com.sequenceiq.datalake.flow.stop.event.SdxStartStopEvent) SdxStartDetachEvent(com.sequenceiq.datalake.flow.detach.event.SdxStartDetachEvent) SdxEvent(com.sequenceiq.datalake.flow.SdxEvent) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) SdxDeleteStartEvent(com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent) DatahubRefreshStartEvent(com.sequenceiq.datalake.flow.refresh.event.DatahubRefreshStartEvent) DatalakeTriggerBackupEvent(com.sequenceiq.datalake.flow.dr.backup.event.DatalakeTriggerBackupEvent)

Example 3 with SdxDeleteStartEvent

use of com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent in project cloudbreak by hortonworks.

the class SdxReactorFlowManager method triggerSdxDeletion.

public FlowIdentifier triggerSdxDeletion(SdxCluster cluster, boolean forced) {
    LOGGER.info("Trigger Datalake deletion for: {} forced: {}", cluster, forced);
    String selector = SDX_DELETE_EVENT.event();
    String userId = ThreadBasedUserCrnProvider.getUserCrn();
    return notify(selector, new SdxDeleteStartEvent(selector, cluster.getId(), userId, forced), cluster.getClusterName());
}
Also used : SdxDeleteStartEvent(com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent)

Aggregations

SdxDeleteStartEvent (com.sequenceiq.datalake.flow.delete.event.SdxDeleteStartEvent)3 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 SdxEvent (com.sequenceiq.datalake.flow.SdxEvent)1 SdxStartDetachEvent (com.sequenceiq.datalake.flow.detach.event.SdxStartDetachEvent)1 DatalakeTriggerBackupEvent (com.sequenceiq.datalake.flow.dr.backup.event.DatalakeTriggerBackupEvent)1 DatalakeTriggerRestoreEvent (com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent)1 DatahubRefreshStartEvent (com.sequenceiq.datalake.flow.refresh.event.DatahubRefreshStartEvent)1 SdxStartStopEvent (com.sequenceiq.datalake.flow.stop.event.SdxStartStopEvent)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1