use of com.sequenceiq.datalake.flow.diagnostics.event.SdxCmDiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsService method collectCmDiagnostics.
public FlowIdentifier collectCmDiagnostics(CmDiagnosticsCollectionRequest request) {
String userId = ThreadBasedUserCrnProvider.getUserCrn();
SdxCluster cluster = sdxService.getByCrn(userId, request.getStackCrn());
StackV4Response stackV4Response = sdxService.getDetail(cluster.getClusterName(), new HashSet<>(), cluster.getAccountId());
diagnosticsCollectionValidator.validate(request, stackV4Response);
Map<String, Object> properties = diagnosticsParamsConverter.convertFromCmRequest(request);
SdxCmDiagnosticsCollectionEvent event = new SdxCmDiagnosticsCollectionEvent(cluster.getId(), userId, properties, null);
FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerCmDiagnosticsCollection(event, cluster.getClusterName());
LOGGER.debug("Start CM based diagnostics collection with flow pollable identifier: {}", flowIdentifier.getPollableId());
return flowIdentifier;
}
use of com.sequenceiq.datalake.flow.diagnostics.event.SdxCmDiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class SdxCmDiagnosticsActions method startCmDiagnosticsCollection.
@Bean(name = "CM_DIAGNOSTICS_COLLECTION_START_STATE")
public Action<?, ?> startCmDiagnosticsCollection() {
return new AbstractSdxAction<>(SdxCmDiagnosticsCollectionEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxCmDiagnosticsCollectionEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxCmDiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
LOGGER.debug("Start CM based diagnostics collection for sdx cluster with id: {}", context.getSdxId());
FlowIdentifier flowIdentifier = diagnosticsFlowService.startCmDiagnosticsCollection(payload.getProperties());
SdxCmDiagnosticsCollectionEvent event = new SdxCmDiagnosticsCollectionEvent(payload.getResourceId(), payload.getUserId(), payload.getProperties(), flowIdentifier);
sendEvent(context, SDX_CM_DIAGNOSTICS_COLLECTION_IN_PROGRESS_EVENT.event(), event);
}
@Override
protected Object getFailurePayload(SdxCmDiagnosticsCollectionEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return SdxCmDiagnosticsFailedEvent.from(payload, ex);
}
};
}
Aggregations