public void recordRemoteFailure(int coordinationId, DremioPBError failure) { // logger.debug("Updating failed future."); try { RpcOutcome<?> rpc = removeFromMap(coordinationId); rpc.setException(UserRemoteException.create(failure)); } catch (Exception ex) { logger.warn("Failed to remove from map. Not a problem since we were updating on failed future.", ex); } }
@Override public void statusUpdate(final FragmentStatus status) { logger.debug("New fragment status was provided to QueryManager of {}", status); switch(status.getProfile().getState()) { case AWAITING_ALLOCATION: case RUNNING: case CANCELLATION_REQUESTED: updateFragmentStatus(status); break; case FAILED: logger.info("Fragment {} failed, cancelling remaining fragments.", QueryIdHelper.getQueryIdentifier(status.getHandle())); completionListener.failed(UserRemoteException.create(status.getProfile().getError())); fragmentDone(status); break; case FINISHED: FragmentHandle fragmentHandle = status.getHandle(); if (fragmentHandle.getMajorFragmentId() == 0) { cancelExecutingFragments(); } fragmentDone(status); break; case CANCELLED: fragmentDone(status); break; default: throw new UnsupportedOperationException(String.format("Received status of %s", status)); } } };
if (isFailureResult) { resultsListener.submissionFailed(UserRemoteException.create(queryResult.getError(0)));
@Test public void testRemoteRuntimeException() throws Exception { UserRemoteException ure = UserRemoteException.create(UserException .unsupportedError(new UserRpcException(null, "user rpc exception", new RuntimeException("test message"))) .build(logger).getOrCreatePBError(false)); exception.expect(RuntimeException.class); exception.expectMessage("test message"); RpcException.propagateIfPossible(new RpcException(ure), TestException.class); } }
private static final RpcException newRPCException(NodeEndpoint endpoint, IOException ioe) { UserRemoteException ure = UserRemoteException.create(UserException .ioExceptionError(ioe) .addIdentity(endpoint) .build(logger).getOrCreatePBError(false)); return new RpcException(ure); } @Test
@Test public void testRemoteTestException() throws Exception { UserRemoteException ure = UserRemoteException.create(UserException .unsupportedError(new UserRpcException(null, "user rpc exception", new TestException("test message"))) .build(logger).getOrCreatePBError(false)); exception.expect(TestException.class); exception.expectMessage("test message"); RpcException.propagateIfPossible(new RpcException(ure), TestException.class); }