use of com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class SdxDiagnosticsActions method startDiagnosticsCollection.
@Bean(name = "DIAGNOSTICS_COLLECTION_START_STATE")
public Action<?, ?> startDiagnosticsCollection() {
return new AbstractSdxAction<>(SdxDiagnosticsCollectionEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxDiagnosticsCollectionEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxDiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
LOGGER.debug("Start diagnostics collection for sdx cluster with id: {}", context.getSdxId());
payload.getProperties().put(DIAGNOSTICS_UUID_PARAM, context.getFlowId());
FlowIdentifier flowIdentifier = diagnosticsFlowService.startDiagnosticsCollection(payload.getProperties());
SdxDiagnosticsCollectionEvent event = new SdxDiagnosticsCollectionEvent(payload.getResourceId(), payload.getUserId(), payload.getProperties(), flowIdentifier);
sendEvent(context, SDX_DIAGNOSTICS_COLLECTION_IN_PROGRESS_EVENT.event(), event);
}
@Override
protected Object getFailurePayload(SdxDiagnosticsCollectionEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return SdxDiagnosticsFailedEvent.from(payload, ex);
}
};
}
use of com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsService method collectDiagnostics.
public FlowIdentifier collectDiagnostics(DiagnosticsCollectionRequest 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.convertFromRequest(request);
SdxDiagnosticsCollectionEvent event = new SdxDiagnosticsCollectionEvent(cluster.getId(), userId, properties, null);
FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerDiagnosticsCollection(event, cluster.getClusterName());
LOGGER.debug("Start diagnostics collection with flow pollable identifier: {}", flowIdentifier.getPollableId());
return flowIdentifier;
}
Aggregations