use of com.sequenceiq.datalake.service.AbstractSdxAction in project cloudbreak by hortonworks.
the class SdxStartActions method failedAction.
@Bean(name = "SDX_START_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractSdxAction<>(SdxFailedEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxFailedEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxFailedEvent payload, Map<Object, Object> variables) throws Exception {
Exception exception = payload.getException();
DatalakeStatusEnum failedStatus = DatalakeStatusEnum.START_FAILED;
LOGGER.info("Update SDX status to {} for resource: {}", failedStatus, payload.getResourceId(), exception);
String statusReason = "SDX start failed";
if (exception.getMessage() != null) {
statusReason = exception.getMessage();
}
SdxCluster sdxCluster = sdxStatusService.setStatusForDatalakeAndNotify(failedStatus, statusReason, payload.getResourceId());
metricService.incrementMetricCounter(MetricType.SDX_START_FAILED, sdxCluster);
sendEvent(context, SDX_START_FAILED_HANDLED_EVENT.event(), payload);
}
@Override
protected Object getFailurePayload(SdxFailedEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return null;
}
};
}
use of com.sequenceiq.datalake.service.AbstractSdxAction in project cloudbreak by hortonworks.
the class SdxRepairActions method failedAction.
@Bean(name = "SDX_REPAIR_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractSdxAction<>(SdxRepairFailedEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxRepairFailedEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxRepairFailedEvent payload, Map<Object, Object> variables) throws Exception {
Exception exception = payload.getException();
LOGGER.error("Datalake repair failed for datalakeId: {}", payload.getResourceId(), exception);
String statusReason = "Datalake stack repair failed";
if (exception.getMessage() != null) {
statusReason = exception.getMessage();
}
Flow flow = getFlow(context.getFlowParameters().getFlowId());
flow.setFlowFailed(payload.getException());
SdxCluster sdxCluster = sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.REPAIR_FAILED, statusReason, payload.getResourceId());
metricService.incrementMetricCounter(MetricType.SDX_REPAIR_FAILED, sdxCluster);
sendEvent(context, SDX_REPAIR_FAILED_HANDLED_EVENT.event(), payload);
}
@Override
protected Object getFailurePayload(SdxRepairFailedEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return null;
}
};
}
Aggregations