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


Java ConverterUtils.toApplicationId方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.util.ConverterUtils.toApplicationId方法的典型用法代码示例。如果您正苦于以下问题:Java ConverterUtils.toApplicationId方法的具体用法?Java ConverterUtils.toApplicationId怎么用?Java ConverterUtils.toApplicationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.util.ConverterUtils的用法示例。


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

示例1: render

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
@Override
protected void render(Block html) {
  ApplicationId applicationID =
      ConverterUtils.toApplicationId(this.recordFactory,
          $(APPLICATION_ID));
  Application app = this.nmContext.getApplications().get(applicationID);
  AppInfo info = new AppInfo(app);
  info("Application's information")
        ._("ApplicationId", info.getId())
        ._("ApplicationState", info.getState())
        ._("User", info.getUser());
  TABLE<Hamlet> containersListBody = html._(InfoBlock.class)
      .table("#containers");
  for (String containerIdStr : info.getContainers()) {
    containersListBody
           .tr().td()
             .a(url("container", containerIdStr), containerIdStr)
             ._()._();
  }
  containersListBody._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationPage.java

示例2: getNodeApp

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的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

示例3: getApp

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的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

示例4: getRMAppForAppId

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的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

示例5: loadRMAppState

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
private synchronized void loadRMAppState(RMState rmState) throws Exception {
  List<String> childNodes = getChildrenWithRetries(rmAppRoot, false);
  for (String childNodeName : childNodes) {
    String childNodePath = getNodePath(rmAppRoot, childNodeName);
    byte[] childData = getDataWithRetries(childNodePath, false);
    if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
      // application
      if (LOG.isDebugEnabled()) {
        LOG.debug("Loading application from znode: " + childNodeName);
      }
      ApplicationId appId = ConverterUtils.toApplicationId(childNodeName);
      ApplicationStateDataPBImpl appState =
          new ApplicationStateDataPBImpl(
              ApplicationStateDataProto.parseFrom(childData));
      if (!appId.equals(
          appState.getApplicationSubmissionContext().getApplicationId())) {
        throw new YarnRuntimeException("The child node name is different " +
            "from the application id");
      }
      rmState.appState.put(appId, appState);
      loadApplicationAttemptState(appState, appId);
    } else {
      LOG.info("Unknown child node with name: " + childNodeName);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:ZKRMStateStore.java

示例6: getAllApplications

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
@Override
public Map<ApplicationId, ApplicationHistoryData> getAllApplications()
    throws IOException {
  Map<ApplicationId, ApplicationHistoryData> historyDataMap =
      new HashMap<ApplicationId, ApplicationHistoryData>();
  FileStatus[] files = fs.listStatus(rootDirPath);
  for (FileStatus file : files) {
    ApplicationId appId =
        ConverterUtils.toApplicationId(file.getPath().getName());
    try {
      ApplicationHistoryData historyData = getApplication(appId);
      if (historyData != null) {
        historyDataMap.put(appId, historyData);
      }
    } catch (IOException e) {
      // Eat the exception not to disturb the getting the next
      // ApplicationHistoryData
      LOG.error("History information of application " + appId
          + " is not included into the result due to the exception", e);
    }
  }
  return historyDataMap;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:FileSystemApplicationHistoryStore.java

示例7: killApplication

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
/**
 * Kills the application with the application id as appId
 * 
 * @param applicationId
 * @throws YarnException
 * @throws IOException
 */
private void killApplication(String applicationId) throws YarnException,
    IOException {
  ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
  ApplicationReport  appReport = null;
  try {
    appReport = client.getApplicationReport(appId);
  } catch (ApplicationNotFoundException e) {
    sysout.println("Application with id '" + applicationId +
        "' doesn't exist in RM.");
    throw e;
  }

  if (appReport.getYarnApplicationState() == YarnApplicationState.FINISHED
      || appReport.getYarnApplicationState() == YarnApplicationState.KILLED
      || appReport.getYarnApplicationState() == YarnApplicationState.FAILED) {
    sysout.println("Application " + applicationId + " has already finished ");
  } else {
    sysout.println("Killing application " + applicationId);
    client.killApplication(appId);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:ApplicationCLI.java

示例8: main

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
  String clientId = args[0];
  String appIdStr = args[1];
  String bucket = args[2];

  ApplicationId appId = ConverterUtils.toApplicationId(appIdStr);
  Configuration cfg = generateHadoopConfig(clientId, DEFAULT_USER_NAME, bucket);

  logger.info("Dumping log files");
  dumpFullLogs(cfg, appId);
  logger.info("Dumping full history information");
  dumpFullHistory(cfg, appId);
  logger.info("Starting local JHS");
  startJHS(cfg);
}
 
开发者ID:spotify,项目名称:spydra,代码行数:16,代码来源:HistoryLogUtils.java

示例9: parseApplicationId

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
protected static ApplicationId parseApplicationId(String appId) {
  if (appId == null || appId.isEmpty()) {
    throw new NotFoundException("appId, " + appId + ", is empty or null");
  }
  ApplicationId aid = ConverterUtils.toApplicationId(appId);
  if (aid == null) {
    throw new NotFoundException("appId is null");
  }
  return aid;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:WebServices.java

示例10: loadUserLocalizedResources

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
private RecoveredUserResources loadUserLocalizedResources(
    LeveldbIterator iter, String keyPrefix) throws IOException {
  RecoveredUserResources userResources = new RecoveredUserResources();
  while (iter.hasNext()) {
    Entry<byte[],byte[]> entry = iter.peekNext();
    String key = asString(entry.getKey());
    if (!key.startsWith(keyPrefix)) {
      break;
    }

    if (key.startsWith(LOCALIZATION_FILECACHE_SUFFIX, keyPrefix.length())) {
      userResources.privateTrackerState = loadResourceTrackerState(iter,
          keyPrefix + LOCALIZATION_FILECACHE_SUFFIX);
    } else if (key.startsWith(LOCALIZATION_APPCACHE_SUFFIX,
        keyPrefix.length())) {
      int appIdStartPos = keyPrefix.length() +
          LOCALIZATION_APPCACHE_SUFFIX.length();
      int appIdEndPos = key.indexOf('/', appIdStartPos);
      if (appIdEndPos < 0) {
        throw new IOException("Unable to determine appID in resource key: "
            + key);
      }
      ApplicationId appId = ConverterUtils.toApplicationId(
          key.substring(appIdStartPos, appIdEndPos));
      userResources.appTrackerStates.put(appId,
          loadResourceTrackerState(iter, key.substring(0, appIdEndPos+1)));
    } else {
      throw new IOException("Unexpected user resource key " + key);
    }
  }
  return userResources;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:NMLeveldbStateStoreService.java

示例11: getAppAttempts

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/appattempts")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppAttemptsInfo getAppAttempts(@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");
  }

  AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
  for (RMAppAttempt attempt : app.getAppAttempts().values()) {
    AppAttemptInfo attemptInfo = new AppAttemptInfo(attempt, app.getUser());
    appAttemptsInfo.add(attemptInfo);
  }

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

示例12: createAppSubmissionContext

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
/**
 * Create the actual ApplicationSubmissionContext to be submitted to the RM
 * from the information provided by the user.
 * 
 * @param newApp
 *          the information provided by the user
 * @return returns the constructed ApplicationSubmissionContext
 * @throws IOException
 */
protected ApplicationSubmissionContext createAppSubmissionContext(
    ApplicationSubmissionContextInfo newApp) throws IOException {

  // create local resources and app submission context

  ApplicationId appid;
  String error =
      "Could not parse application id " + newApp.getApplicationId();
  try {
    appid =
        ConverterUtils.toApplicationId(recordFactory,
          newApp.getApplicationId());
  } catch (Exception e) {
    throw new BadRequestException(error);
  }
  ApplicationSubmissionContext appContext =
      ApplicationSubmissionContext.newInstance(appid,
        newApp.getApplicationName(), newApp.getQueue(),
        Priority.newInstance(newApp.getPriority()),
        createContainerLaunchContext(newApp), newApp.getUnmanagedAM(),
        newApp.getCancelTokensWhenComplete(), newApp.getMaxAppAttempts(),
        createAppSubmissionContextResource(newApp),
        newApp.getApplicationType(),
        newApp.getKeepContainersAcrossApplicationAttempts(),
        newApp.getAppNodeLabelExpression(),
        newApp.getAMContainerNodeLabelExpression());
  appContext.setApplicationTags(newApp.getApplicationTags());

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

示例13: createApplicationState

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
private ApplicationStateData createApplicationState(String appIdStr,
    byte[] data) throws IOException {
  ApplicationId appId = ConverterUtils.toApplicationId(appIdStr);
  ApplicationStateDataPBImpl appState =
      new ApplicationStateDataPBImpl(
          ApplicationStateDataProto.parseFrom(data));
  if (!appId.equals(
      appState.getApplicationSubmissionContext().getApplicationId())) {
    throw new YarnRuntimeException("The database entry for " + appId
        + " contains data for "
        + appState.getApplicationSubmissionContext().getApplicationId());
  }
  return appState;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:LeveldbRMStateStore.java

示例14: moveApplicationAcrossQueues

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
/**
 * Moves the application with the given ID to the given queue.
 */
private void moveApplicationAcrossQueues(String applicationId, String queue)
    throws YarnException, IOException {
  ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
  ApplicationReport appReport = client.getApplicationReport(appId);
  if (appReport.getYarnApplicationState() == YarnApplicationState.FINISHED
      || appReport.getYarnApplicationState() == YarnApplicationState.KILLED
      || appReport.getYarnApplicationState() == YarnApplicationState.FAILED) {
    sysout.println("Application " + applicationId + " has already finished ");
  } else {
    sysout.println("Moving application " + applicationId + " to queue " + queue);
    client.moveApplicationAcrossQueues(appId, queue);
    sysout.println("Successfully completed move.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ApplicationCLI.java

示例15: dumpAContainersLogs

import org.apache.hadoop.yarn.util.ConverterUtils; //导入方法依赖的package包/类
@Private
@VisibleForTesting
public int dumpAContainersLogs(String appId, String containerId,
    String nodeId, String jobOwner) throws IOException {

  ApplicationId applicationId = ConverterUtils.toApplicationId(appId);
  List<Path> remoteAppLogDirs = AggregatedLogsBlock.getRemoteAppLogDirs(getConf(), applicationId, jobOwner);
  String remoteAppLogDir = StringUtils.join(remoteAppLogDirs, ",");

  RemoteIterator<FileStatus> nodeFiles;
  try {
    nodeFiles = AggregatedLogsBlock.getFileListAtRemoteAppDir(getConf(), remoteAppLogDirs, applicationId, jobOwner);
  } catch (FileNotFoundException fnf) {
    logDirNotExist(remoteAppLogDir.toString());
    return -1;
  }
  boolean foundContainerLogs = false;
  while (nodeFiles.hasNext()) {
    FileStatus thisNodeFile = nodeFiles.next();
    String fileName = thisNodeFile.getPath().getName();
    if (fileName.contains(LogAggregationUtils.getNodeString(nodeId))
        && !fileName.endsWith(LogAggregationUtils.TMP_FILE_SUFFIX)) {
      AggregatedLogFormat.LogReader reader = null;
      try {
        reader =
            new AggregatedLogFormat.LogReader(getConf(),
              thisNodeFile.getPath());
        if (dumpAContainerLogs(containerId, reader, System.out,
            thisNodeFile.getModificationTime()) > -1) {
          foundContainerLogs = true;
        }
      } finally {
        if (reader != null) {
          reader.close();
        }
      }
    }
  }
  if (!foundContainerLogs) {
    containerLogNotFound(containerId);
    return -1;
  }
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:45,代码来源:LogCLIHelpers.java


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