use of com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeVmReplaceWaitRequest in project cloudbreak by hortonworks.
the class DatalakeVmReplaceWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeVmReplaceWaitRequest> event) {
DatalakeVmReplaceWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling cluster VM replacement process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
upgradeService.waitCloudbreakFlow(sdxId, pollingConfig, "VM replace");
response = new DatalakeUpgradeSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("VM replace polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("VM replace poller stopped for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, new PollerStoppedException("VM replace timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("VM replace polling failed for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened during VM replacement wait phase", anotherException);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, anotherException);
}
return response;
}
use of com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeVmReplaceWaitRequest in project cloudbreak by hortonworks.
the class DatalakeUpgradeActions method replaceVmsWait.
@Bean(name = "DATALAKE_REPLACE_VMS_IN_PROGRESS_STATE")
public Action<?, ?> replaceVmsWait() {
return new AbstractSdxAction<>(SdxEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxEvent payload, Map<Object, Object> variables) {
LOGGER.info("Datalake upgrade vm replacement is in progress for {} ", payload.getResourceId());
sendEvent(context, new DatalakeVmReplaceWaitRequest(context));
}
@Override
protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return DatalakeUpgradeFailedEvent.from(payload, ex);
}
};
}
Aggregations