use of com.sequenceiq.datalake.entity.DatalakeStatusEnum 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.entity.DatalakeStatusEnum in project cloudbreak by hortonworks.
the class UpgradeCcmActions method failedAction.
@Bean(name = "UPGRADE_CCM_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractUpgradeCcmSdxAction<>(UpgradeCcmFailedEvent.class) {
@Override
protected void doExecute(SdxContext context, UpgradeCcmFailedEvent payload, Map<Object, Object> variables) {
Exception exception = payload.getException();
DatalakeStatusEnum failedStatus = DatalakeStatusEnum.DATALAKE_UPGRADE_CCM_FAILED;
LOGGER.info("Update SDX status to {} for resource: {}", failedStatus, payload.getResourceId(), exception);
String statusReason = "Cluster Connectivity Manager upgrade failed";
if (exception.getMessage() != null) {
statusReason = exception.getMessage();
}
SdxCluster sdxCluster = sdxStatusService.setStatusForDatalakeAndNotify(failedStatus, statusReason, payload.getResourceId());
metricService.incrementMetricCounter(MetricType.UPGRADE_CCM_FAILED, sdxCluster);
sendEvent(context, UPGRADE_CCM_FAILED_HANDLED_EVENT.event(), payload);
}
};
}
use of com.sequenceiq.datalake.entity.DatalakeStatusEnum in project cloudbreak by hortonworks.
the class SdxClusterStatusCheckerJob method syncSdxStatus.
private void syncSdxStatus(JobExecutionContext context) {
getCluster().ifPresent(sdx -> {
StackStatusV4Response stack = cloudbreakInternalCrnClient.withInternalCrn().autoscaleEndpoint().getStatusByCrn(getRemoteResourceCrn());
updateCertExpirationStateIfDifferent(sdx, stack);
SdxStatusEntity sdxStatus = sdxStatusService.getActualStatusForSdx(sdx);
DatalakeStatusEnum originalStatus = sdxStatus.getStatus();
DatalakeStatusEnum updatedStatus = updateStatusIfNecessary(stack, sdx, sdxStatus);
if (!Objects.equals(originalStatus, updatedStatus)) {
logStateChange(originalStatus, updatedStatus);
updateSyncScheduleIfNecessary(updatedStatus, sdx, context);
}
});
}
Aggregations