use of com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsSuccessEvent 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;
}
use of com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsSuccessEvent in project cloudbreak by hortonworks.
the class SdxDiagnosticsCollectionHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxDiagnosticsWaitRequest> event) {
SdxDiagnosticsWaitRequest 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());
response = new SdxDiagnosticsSuccessEvent(sdxId, userId, properties);
LOGGER.debug("SDX diagnostics collection event finished");
} catch (UserBreakException userBreakException) {
LOGGER.error("Polling exited before timeout for SDX (diagnostic collection): {}. Cause: ", sdxId, userBreakException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Poller stopped for SDX (diagnostic collection): {}", sdxId, pollerStoppedException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, new PollerStoppedException("Datalake diagnostic collection timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Polling failed for stack (diagnostic collection): {}", sdxId, exception);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in diagnostic collection wait phase", anotherException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, anotherException);
}
return response;
}
use of com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsSuccessEvent in project cloudbreak by hortonworks.
the class SdxDiagnosticsCollectionHandlerTest method testAcceptHappyPath.
@Test
void testAcceptHappyPath() {
Event<SdxDiagnosticsWaitRequest> event = initEvent();
underTest.accept(event);
SdxDiagnosticsSuccessEvent sdxDiagnosticsSuccessEvent = new SdxDiagnosticsSuccessEvent(1L, "userId", Map.of());
Mockito.verify(eventBus, Mockito.times(1)).notify(eq(sdxDiagnosticsSuccessEvent.selector()), any(Event.class));
}
Aggregations