当前位置: 首页>>代码示例>>Java>>正文


Java NotFoundException类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.webapp.NotFoundException的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException类的具体用法?Java NotFoundException怎么用?Java NotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotFoundException类属于org.apache.hadoop.yarn.webapp包,在下文中一共展示了NotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContainerLogFile

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
/**
 * Finds the log file with the given filename for the given container.
 */
public static File getContainerLogFile(ContainerId containerId,
    String fileName, String remoteUser, Context context) throws YarnException {
  Container container = context.getContainers().get(containerId);
  
  Application application = getApplicationForContainer(containerId, context);
  checkAccess(remoteUser, application, context);
  if (container != null) {
    checkState(container.getContainerState());
  }
  
  try {
    LocalDirsHandlerService dirsHandler = context.getLocalDirsHandler();
    String relativeContainerLogDir = ContainerLaunch.getRelativeContainerLogDir(
        application.getAppId().toString(), containerId.toString());
    Path logPath = dirsHandler.getLogPathToRead(
        relativeContainerLogDir + Path.SEPARATOR + fileName);
    URI logPathURI = new File(logPath.toString()).toURI();
    File logFile = new File(logPathURI.getPath());
    return logFile;
  } catch (IOException e) {
    LOG.warn("Failed to find log file", e);
    throw new NotFoundException("Cannot find this log on the local disk.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:ContainerLogsUtils.java

示例2: checkState

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
private static void checkState(ContainerState state) {
  if (state == ContainerState.NEW || state == ContainerState.LOCALIZING ||
      state == ContainerState.LOCALIZED) {
    throw new NotFoundException("Container is not yet running. Current state is "
        + state);
  }
  if (state == ContainerState.LOCALIZATION_FAILED) {
    throw new NotFoundException("Container wasn't started. Localization failed.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:ContainerLogsUtils.java

示例3: getNodeApp

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/apps/{appid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppInfo getNodeApp(@PathParam("appid") String appId) {
  init();
  ApplicationId id = ConverterUtils.toApplicationId(recordFactory, appId);
  if (id == null) {
    throw new NotFoundException("app with id " + appId + " not found");
  }
  Application app = this.nmContext.getApplications().get(id);
  if (app == null) {
    throw new NotFoundException("app with id " + appId + " not found");
  }
  return new AppInfo(app);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:NMWebServices.java

示例4: getNodeContainer

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@PathParam("containerid") String id) {
  ContainerId containerId = null;
  init();
  try {
    containerId = ConverterUtils.toContainerId(id);
  } catch (Exception e) {
    throw new BadRequestException("invalid container id, " + id);
  }

  Container container = nmContext.getContainers().get(containerId);
  if (container == null) {
    throw new NotFoundException("container with id, " + id + ", not found");
  }
  return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
      .toString(), webapp.name());

}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:NMWebServices.java

示例5: getApp

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/apps/{appid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppInfo getApp(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) {
  init();
  if (appId == null || appId.isEmpty()) {
    throw new NotFoundException("appId, " + appId + ", is empty or null");
  }
  ApplicationId id;
  id = ConverterUtils.toApplicationId(recordFactory, appId);
  if (id == null) {
    throw new NotFoundException("appId is null");
  }
  RMApp app = rm.getRMContext().getRMApps().get(id);
  if (app == null) {
    throw new NotFoundException("app with id: " + appId + " not found");
  }
  return new AppInfo(rm, app, hasAccess(app, hsr), hsr.getScheme() + "://");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:RMWebServices.java

示例6: getAppState

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/apps/{appid}/state")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppState getAppState(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
      "UNKNOWN", "RMWebService",
      "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppState ret = new AppState();
  ret.setState(app.getState().toString());

  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:RMWebServices.java

示例7: getAppQueue

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/apps/{appid}/queue")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppQueue getAppQueue(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "UNKNOWN-USER";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
      "UNKNOWN", "RMWebService",
      "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppQueue ret = new AppQueue();
  ret.setQueue(app.getQueue());

  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:RMWebServices.java

示例8: getRMAppForAppId

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
private RMApp getRMAppForAppId(String appId) {

    if (appId == null || appId.isEmpty()) {
      throw new NotFoundException("appId, " + appId + ", is empty or null");
    }
    ApplicationId id;
    try {
      id = ConverterUtils.toApplicationId(recordFactory, appId);
    } catch (NumberFormatException e) {
      throw new NotFoundException("appId is invalid");
    }
    if (id == null) {
      throw new NotFoundException("appId is invalid");
    }
    RMApp app = rm.getRMContext().getRMApps().get(id);
    if (app == null) {
      throw new NotFoundException("app with id: " + appId + " not found");
    }
    return app;
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:RMWebServices.java

示例9: getSingleTaskCounters

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks/{taskid}/counters")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public JobTaskCounterInfo getSingleTaskCounters(
    @Context HttpServletRequest hsr, @PathParam("jobid") String jid,
    @PathParam("taskid") String tid) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  TaskId taskID = MRApps.toTaskID(tid);
  if (taskID == null) {
    throw new NotFoundException("taskid " + tid + " not found or invalid");
  }
  Task task = job.getTask(taskID);
  if (task == null) {
    throw new NotFoundException("task not found with id " + tid);
  }
  return new JobTaskCounterInfo(task);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:HsWebServices.java

示例10: getNodeContainer

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@javax.ws.rs.core.Context
    HttpServletRequest hsr, @PathParam("containerid") String id) {
  ContainerId containerId = null;
  init();
  try {
    containerId = ConverterUtils.toContainerId(id);
  } catch (Exception e) {
    throw new BadRequestException("invalid container id, " + id);
  }

  Container container = nmContext.getContainers().get(containerId);
  if (container == null) {
    throw new NotFoundException("container with id, " + id + ", not found");
  }
  return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
      .toString(), webapp.name(), hsr.getRemoteUser());

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:NMWebServices.java

示例11: getPortsInfo

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path(PATH_PHYSICAL_PLAN_OPERATORS + "/{operatorId:\\d+}/ports/{portName}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPortsInfo(@PathParam("operatorId") int operatorId, @PathParam("portName") String portName) throws Exception
{
  init();
  OperatorInfo oi = dagManager.getOperatorInfo(operatorId);
  if (oi == null) {
    throw new NotFoundException();
  }
  for (PortInfo pi : oi.ports) {
    if (pi.name.equals(portName)) {
      return new JSONObject(objectMapper.writeValueAsString(pi));
    }
  }
  throw new NotFoundException();
}
 
开发者ID:apache,项目名称:apex-core,代码行数:18,代码来源:StramWebServices.java

示例12: describeOperator

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path(PATH_OPERATOR_CLASSES + "/{className}")
@Produces(MediaType.APPLICATION_JSON)
@SuppressWarnings("unchecked")
public JSONObject describeOperator(@PathParam("className") String className)
{
  init();
  if (className == null) {
    throw new UnsupportedOperationException();
  }
  try {
    Class<?> clazz = Class.forName(className);
    if (Operator.class.isAssignableFrom(clazz)) {
      return operatorDiscoverer.describeOperator(className);
    } else {
      throw new NotFoundException();
    }
  } catch (Exception ex) {
    throw new NotFoundException();
  }
}
 
开发者ID:apache,项目名称:apex-core,代码行数:22,代码来源:StramWebServices.java

示例13: getContainer

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path(PATH_PHYSICAL_PLAN_CONTAINERS + "/{containerId}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getContainer(@PathParam("containerId") String containerId) throws Exception
{
  init();
  ContainerInfo ci = null;
  if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) {
    ci = dagManager.getAppMasterContainerInfo();
  } else {
    for (ContainerInfo containerInfo : dagManager.getCompletedContainerInfo()) {
      if (containerInfo.id.equals(containerId)) {
        ci = containerInfo;
      }
    }
    if (ci == null) {
      StreamingContainerAgent sca = dagManager.getContainerAgent(containerId);
      if (sca == null) {
        throw new NotFoundException();
      }
      ci = sca.getContainerInfo();
    }
  }
  return new JSONObject(objectMapper.writeValueAsString(ci));
}
 
开发者ID:apache,项目名称:apex-core,代码行数:26,代码来源:StramWebServices.java

示例14: getOperatorAttributes

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/attributes")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getOperatorAttributes(@PathParam("operatorName") String operatorName, @QueryParam("attributeName") String attributeName)
{
  init();
  OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
  if (logicalOperator == null) {
    throw new NotFoundException();
  }
  HashMap<String, String> map = new HashMap<>();
  for (Map.Entry<Attribute<?>, Object> entry : dagManager.getOperatorAttributes(operatorName).entrySet()) {
    if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) {
      Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>)(Map.Entry)entry;
      map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue()));
    }
  }
  return new JSONObject(map);
}
 
开发者ID:apache,项目名称:apex-core,代码行数:20,代码来源:StramWebServices.java

示例15: getPorts

import org.apache.hadoop.yarn.webapp.NotFoundException; //导入依赖的package包/类
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPorts(@PathParam("operatorName") String operatorName)
{
  init();
  OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
  Set<LogicalPlan.InputPortMeta> inputPorts;
  Set<LogicalPlan.OutputPortMeta> outputPorts;
  if (logicalOperator == null) {
    ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
    if (logicalModule == null) {
      throw new NotFoundException();
    }
    inputPorts = logicalModule.getInputStreams().keySet();
    outputPorts = logicalModule.getOutputStreams().keySet();
  } else {
    inputPorts = logicalOperator.getInputStreams().keySet();
    outputPorts = logicalOperator.getOutputStreams().keySet();
  }

  JSONObject result = getPortsObjects(inputPorts, outputPorts);
  return result;
}
 
开发者ID:apache,项目名称:apex-core,代码行数:25,代码来源:StramWebServices.java


注:本文中的org.apache.hadoop.yarn.webapp.NotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。