gpt4 book ai didi

org.apache.hadoop.yarn.exceptions.YarnException类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 16:24:40 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.exceptions.YarnException类的一些代码示例,展示了YarnException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnException类的具体详情如下:
包路径:org.apache.hadoop.yarn.exceptions.YarnException
类名称:YarnException

YarnException介绍

[英]YarnException indicates exceptions from yarn servers. On the other hand, IOExceptions indicates exceptions from RPC layer.
[中]YarnException表示来自Thread服务器的异常。另一方面,IOExceptions表示来自RPC层的异常。

代码示例

代码示例来源:origin: alibaba/jstorm

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());
  }
}

代码示例来源:origin: org.springframework.data/spring-yarn-core

/**
 * Constructs YarnSystemException from {@link YarnException}.
 *
 * @param e the {@link YarnException}
 */
public YarnSystemException(YarnException e) {
  super(e.getMessage(), e);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void submitAppToRMWithInValidAcl(String submitter,
  ApplicationSubmissionContext appSubmissionContext)
  throws YarnException, IOException, InterruptedException {
 ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
 SubmitApplicationRequest submitRequest = SubmitApplicationRequest
   .newInstance(appSubmissionContext);
 try {
  submitterClient.submitApplication(submitRequest);
 } catch (YarnException ex) {
  Assert.assertTrue(ex.getCause() instanceof RemoteException);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public SubmitApplicationResponse run() {
 try {
  return client.submitApplication(req);
 } catch (YarnException e) {
  e.printStackTrace();
 } catch (IOException e) {
  e.printStackTrace();
 }
 return null;
}
PrivilegedAction<SubmitApplicationResponse> setClientReq(

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

@Test
public void testExceptionCalls() throws Exception {
 client.setThrowYarnException(true);
 try {
  client.putEntitiesAsync(generateEntity("1"));
 } catch (YarnException e) {
  Assert.fail("Async calls are not expected to throw exception");
 }
 try {
  client.putEntities(generateEntity("2"));
  Assert.fail("Sync calls are expected to throw exception");
 } catch (YarnException e) {
  Assert.assertEquals("Same exception needs to be thrown",
    "ActualException", e.getCause().getMessage());
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-web-proxy

@Override
 protected ApplicationHistoryProtocol getAHSProxy(Configuration conf)
   throws IOException
 {
  GetApplicationReportResponse resp = Mockito.
    mock(GetApplicationReportResponse.class);
  historyManager = Mockito.mock(ApplicationHistoryProtocol.class);
  try {
   Mockito.when(historyManager.getApplicationReport(Mockito
     .any(GetApplicationReportRequest.class))).thenReturn(resp);
  } catch (YarnException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  return historyManager;
 }
}

代码示例来源:origin: apache/metron

@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());
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@POST
@Path("/delegation-token")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response postDelegationToken(DelegationToken tokenData,
  @Context HttpServletRequest hsr) throws AuthorizationException,
  IOException, InterruptedException, Exception {
 init();
 UserGroupInformation callerUGI;
 try {
  callerUGI = createKerberosUserGroupInformation(hsr);
 } catch (YarnException ye) {
  return Response.status(Status.FORBIDDEN).entity(ye.getMessage()).build();
 }
 return createDelegationToken(tokenData, hsr, callerUGI);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-web-proxy

@Override
 protected ApplicationHistoryProtocol getAHSProxy(Configuration conf)
   throws IOException
 {
  GetApplicationReportResponse resp = Mockito.
    mock(GetApplicationReportResponse.class);
  historyManager = Mockito.mock(ApplicationHistoryProtocol.class);
  try {
   Mockito.when(historyManager.getApplicationReport(Mockito
     .any(GetApplicationReportRequest.class))).thenReturn(resp);
  } catch (YarnException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  return historyManager;
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

/**
 * Returns an instance of {@link YarnException}
 */
public static YarnException getRemoteException(Throwable t) {
 return new YarnException(t);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@POST
@Path("/delegation-token")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response postDelegationToken(DelegationToken tokenData,
  @Context HttpServletRequest hsr) throws AuthorizationException,
  IOException, InterruptedException, Exception {
 init();
 UserGroupInformation callerUGI;
 try {
  callerUGI = createKerberosUserGroupInformation(hsr);
 } catch (YarnException ye) {
  return Response.status(Status.FORBIDDEN).entity(ye.getMessage()).build();
 }
 return createDelegationToken(tokenData, hsr, callerUGI);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

/**
 * Returns an instance of {@link YarnException}
 */
public static YarnException getRemoteException(String message) {
 return new YarnException(message);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public Void run() throws Exception {
  try {
   checkTokenRenewal(owner, other);
   return null;
  } catch (YarnException ex) {
   Assert.assertTrue(ex.getMessage().contains(owner.getUserName() +
     " tries to renew a token with renewer " +
     other.getUserName()));
   throw ex;
  }
 }
});

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

/**
 * Returns an instance of {@link YarnException}
 */
public static YarnException getRemoteException(Throwable t) {
 return new YarnException(t);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public Void run() throws Exception {
  try {
   checkTokenRenewal(owner, other);
   return null;
  } catch (YarnException ex) {
   Assert.assertTrue(ex.getMessage().contains(
     owner.getUserName() + " tries to renew a token"));
   Assert.assertTrue(ex.getMessage().contains(
     "with non-matching renewer " + other.getUserName()));
   throw ex;
  }
 }
});

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

/**
 * Returns an instance of {@link YarnException}
 */
public static YarnException getRemoteException(String message) {
 return new YarnException(message);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public Void run() throws Exception {
  try {
   checkTokenCancellation(rmService, tokOwner, tokRenewer);
   Assert.fail("We should not reach here; token owner = "
     + tokOwner.getUserName() + ", renewer = "
     + tokRenewer.getUserName());
   return null;
  } catch (YarnException e) {
   Assert.assertTrue(e.getMessage().contains(
     testerKerb.getUserName()
       + " is not authorized to cancel the token"));
   return null;
  }
 }
});

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common

/**
 * Returns an instance of {@link YarnException}
 */
public static YarnException getRemoteException(String message) {
 return new YarnException(message);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public Void run() throws Exception {
  try {
   checkTokenCancellation(tokOwner, tokRenewer);
   Assert.fail("We should not reach here; token owner = "
     + tokOwner.getUserName() + ", renewer = "
     + tokRenewer.getUserName());
   return null;
  } catch (YarnException ex) {
   Assert.assertTrue(ex.getMessage().contains(
     tester.getUserName()
       + " is not authorized to cancel the token"));
   return null;
  }
 }
});

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager

private void validateConfOrThrowException() throws YarnException {
 if (conf == null) {
  throw new YarnException("Please initialize (call initialize) before use "
    + GpuDiscoverer.class.getSimpleName());
 }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com