void startTimelineClient(final Configuration conf) throws YarnException, IOException, InterruptedException { try { appSubmitterUgi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { // Creating the Timeline Client timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); } else { timelineClient = null; LOG.warn("Timeline service is not enabled"); } return null; } }); } catch (UndeclaredThrowableException e) { throw new YarnException(e.getCause()); } }
@VisibleForTesting void startTimelineClient(final Configuration conf) throws YarnException, IOException, InterruptedException { try { appSubmitterUgi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { // Creating the Timeline Client timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); } else { timelineClient = null; LOG.warn("Timeline service is not enabled"); } return null; } }); } catch (UndeclaredThrowableException e) { throw new YarnException(e.getCause()); } }
/** * Returns an instance of {@link YarnException} */ public static YarnException getRemoteException(Throwable t) { return new YarnException(t); }
/** * Returns an instance of {@link YarnException} */ public static YarnException getRemoteException(String message) { return new YarnException(message); }
private void validateConfOrThrowException() throws YarnException { if (conf == null) { throw new YarnException("Please initialize (call initialize) before use " + GpuDiscoverer.class.getSimpleName()); } }
private static <V> V getChecked(Future<V> future) throws YarnException { try { return future.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new YarnException(e); } catch (ExecutionException e) { throw new YarnException(e); } }
@Override public void setEntitlement(String queue, QueueEntitlement entitlement) throws YarnException { throw new YarnException(getClass().getSimpleName() + " does not support this operation"); }
@Override public TimelinePutResponse putEntities(ApplicationAttemptId appAttemptId, TimelineEntityGroupId groupId, TimelineEntity... entities) throws IOException, YarnException { if (!timelineServiceV15Enabled) { throw new YarnException( "This API is not supported under current Timeline Service Version:"); } return timelineWriter.putEntities(appAttemptId, groupId, entities); }
@Override public void putDomain(ApplicationAttemptId appAttemptId, TimelineDomain domain) throws IOException, YarnException { if (!timelineServiceV15Enabled) { throw new YarnException( "This API is not supported under current Timeline Service Version:"); } timelineWriter.putDomain(appAttemptId, domain); }
@Override public synchronized SignalContainerResponse signalToContainer( SignalContainerRequest request) throws YarnException, IOException { throw new YarnException("Not supported yet!"); }
@Override public String moveApplication(ApplicationId appId, String newQueue) throws YarnException { if (failMove) { throw new YarnException("Move not supported"); } return newQueue; }
@Override public StartContainersResponse startContainers( StartContainersRequest requests) throws YarnException, IOException { try { // make the thread sleep to look like its not going to respond Thread.sleep(10000); } catch (Exception e) { LOG.error(e); throw new YarnException(e); } throw new YarnException("Shouldn't happen!!"); }
@Override protected void putObjects(URI base, String path, MultivaluedMap<String, String> params, Object obj) throws IOException, YarnException { if (throwYarnException) { throw new YarnException(EXCEPTION_MSG); } else { throw new IOException( "Failed to get the response from the timeline server."); } } }
@Override public GetContainerStatusesResponse getContainerStatuses( GetContainerStatusesRequest request) throws YarnException, IOException { Exception e = new Exception("Dummy function", new Exception( "Dummy function cause")); throw new YarnException(e); }
@Override public StopContainersResponse stopContainers(StopContainersRequest requests) throws YarnException, IOException { Exception e = new Exception("Dummy function", new Exception( "Dummy function cause")); throw new YarnException(e); }
@Override public StopContainersResponse stopContainers(StopContainersRequest request) throws YarnException { Exception e = new Exception(EXCEPTION_MSG, new Exception(EXCEPTION_CAUSE)); throw new YarnException(e); }
@Override public SignalContainerResponse signalToContainer( SignalContainerRequest request) throws YarnException { final Exception e = new Exception(EXCEPTION_MSG, new Exception(EXCEPTION_CAUSE)); throw new YarnException(e); }
@Override public RegisterNodeManagerResponse registerNodeManager( RegisterNodeManagerRequest request) throws YarnException, IOException { if (exception) { throw new YarnException("testMessage"); } return recordFactory.newRecordInstance(RegisterNodeManagerResponse.class); }
public TimelinePutResponse putEntities( TimelineEntity... entities) throws IOException, YarnException { TimelineEntities entitiesContainer = new TimelineEntities(); for (TimelineEntity entity : entities) { if (entity.getEntityId() == null || entity.getEntityType() == null) { throw new YarnException("Incomplete entity without entity id/type"); } entitiesContainer.addEntity(entity); } ClientResponse resp = doPosting(entitiesContainer, null); return resp.getEntity(TimelinePutResponse.class); }
@Test public void testFacadeYarnException() throws Exception { RetryPolicy policy = FederationStateStoreFacade.createRetryPolicy(conf); RetryAction action = policy.shouldRetry(new YarnException(), 0, 0, false); Assert.assertEquals(RetryAction.FAIL.action, action.action); }