use of com.sequenceiq.datalake.flow.diagnostics.event.SdxCmDiagnosticsWaitRequest in project cloudbreak by hortonworks.
the class SdxCmDiagnosticsCollectionHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxCmDiagnosticsWaitRequest> event) {
SdxCmDiagnosticsWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Map<String, Object> properties = request.getProperties();
Selectable response;
try {
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
diagnosticsFlowService.waitForDiagnosticsCollection(sdxId, pollingConfig, request.getFlowIdentifier(), true);
response = new SdxDiagnosticsSuccessEvent(sdxId, userId, properties);
LOGGER.debug("SDX CM based diagnostics collection event finished");
} catch (UserBreakException userBreakException) {
LOGGER.error("Polling exited before timeout for SDX (CM based diagnostic collection): {}. Cause: ", sdxId, userBreakException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Poller stopped for SDX (CM based diagnostic collection): {}", sdxId, pollerStoppedException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, new PollerStoppedException("Datalake CM based diagnostic collection timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Polling failed for stack (CM based diagnostic collection): {}", sdxId, exception);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in CM based diagnostic collection wait phase", anotherException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, anotherException);
}
return response;
}
Aggregations