use of com.sequenceiq.datalake.flow.repair.event.SdxRepairSuccessEvent in project cloudbreak by hortonworks.
the class SdxRepairWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxRepairWaitRequest> event) {
SdxRepairWaitRequest sdxRepairWaitRequest = event.getData();
Long sdxId = sdxRepairWaitRequest.getResourceId();
String userId = sdxRepairWaitRequest.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling stack repair process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
repairService.waitCloudbreakClusterRepair(sdxId, pollingConfig);
response = new SdxRepairSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Repair polling exited before timeout. Cause: ", userBreakException);
response = new SdxRepairFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Repair poller stopped for stack: {}", sdxId);
response = new SdxRepairFailedEvent(sdxId, userId, new PollerStoppedException("Datalake repair timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Repair polling failed for stack: {}", sdxId);
response = new SdxRepairFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.sequenceiq.datalake.flow.repair.event.SdxRepairSuccessEvent in project cloudbreak by hortonworks.
the class SdxRepairActions method finishedAction.
@Bean(name = "SDX_REPAIR_FINISHED_STATE")
public Action<?, ?> finishedAction() {
return new AbstractSdxAction<>(SdxRepairSuccessEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxRepairSuccessEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxRepairSuccessEvent payload, Map<Object, Object> variables) throws Exception {
LOGGER.info("Datalake repair finalized: {}", payload.getResourceId());
SdxCluster sdxCluster = sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.RUNNING, ResourceEvent.SDX_REPAIR_FINISHED, "Repair finished, Datalake is running", payload.getResourceId());
metricService.incrementMetricCounter(MetricType.SDX_REPAIR_FINISHED, sdxCluster);
jobService.schedule(sdxCluster.getId(), SdxClusterJobAdapter.class);
sendEvent(context, SDX_REPAIR_FINALIZED_EVENT.event(), payload);
}
@Override
protected Object getFailurePayload(SdxRepairSuccessEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return null;
}
};
}
Aggregations