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());
}
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);
}
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());
}
Aggregations