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


Java ApplicationAttemptHistoryData.newInstance方法代码示例

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


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

示例1: getApplicationAttempts

import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData; //导入方法依赖的package包/类
@Override
public Map<ApplicationAttemptId, ApplicationAttemptHistoryData>
    getApplicationAttempts(ApplicationId appId) throws IOException {
  Map<ApplicationAttemptId, ApplicationAttemptHistoryData> historyDataMap =
      new HashMap<ApplicationAttemptId, ApplicationAttemptHistoryData>();
  HistoryFileReader hfReader = getHistoryFileReader(appId);
  try {
    while (hfReader.hasNext()) {
      HistoryFileReader.Entry entry = hfReader.next();
      if (entry.key.id.startsWith(
          ConverterUtils.APPLICATION_ATTEMPT_PREFIX)) {
        ApplicationAttemptId appAttemptId = 
            ConverterUtils.toApplicationAttemptId(entry.key.id);
        if (appAttemptId.getApplicationId().equals(appId)) {
          ApplicationAttemptHistoryData historyData = 
              historyDataMap.get(appAttemptId);
          if (historyData == null) {
            historyData = ApplicationAttemptHistoryData.newInstance(
                appAttemptId, null, -1, null, null, null,
                FinalApplicationStatus.UNDEFINED, null);
            historyDataMap.put(appAttemptId, historyData);
          }
          if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
            mergeApplicationAttemptHistoryData(historyData,
                parseApplicationAttemptStartData(entry.value));
          } else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
            mergeApplicationAttemptHistoryData(historyData,
                parseApplicationAttemptFinishData(entry.value));
          }
        }
      }
    }
    LOG.info("Completed reading history information of all application"
        + " attempts of application " + appId);
  } catch (IOException e) {
    LOG.info("Error when reading history information of some application"
        + " attempts of application " + appId);
  } finally {
    hfReader.close();
  }
  return historyDataMap;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:FileSystemApplicationHistoryStore.java

示例2: getApplicationAttempt

import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData; //导入方法依赖的package包/类
@Override
public ApplicationAttemptHistoryData getApplicationAttempt(
    ApplicationAttemptId appAttemptId) throws IOException {
  HistoryFileReader hfReader =
      getHistoryFileReader(appAttemptId.getApplicationId());
  try {
    boolean readStartData = false;
    boolean readFinishData = false;
    ApplicationAttemptHistoryData historyData =
        ApplicationAttemptHistoryData.newInstance(appAttemptId, null, -1,
          null, null, null, FinalApplicationStatus.UNDEFINED, null);
    while ((!readStartData || !readFinishData) && hfReader.hasNext()) {
      HistoryFileReader.Entry entry = hfReader.next();
      if (entry.key.id.equals(appAttemptId.toString())) {
        if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
          ApplicationAttemptStartData startData =
              parseApplicationAttemptStartData(entry.value);
          mergeApplicationAttemptHistoryData(historyData, startData);
          readStartData = true;
        } else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
          ApplicationAttemptFinishData finishData =
              parseApplicationAttemptFinishData(entry.value);
          mergeApplicationAttemptHistoryData(historyData, finishData);
          readFinishData = true;
        }
      }
    }
    if (!readStartData && !readFinishData) {
      return null;
    }
    if (!readStartData) {
      LOG.warn("Start information is missing for application attempt "
          + appAttemptId);
    }
    if (!readFinishData) {
      LOG.warn("Finish information is missing for application attempt "
          + appAttemptId);
    }
    LOG.info("Completed reading history information of application attempt "
        + appAttemptId);
    return historyData;
  } catch (IOException e) {
    LOG.error("Error when reading history file of application attempt"
        + appAttemptId, e);
    throw e;
  } finally {
    hfReader.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:FileSystemApplicationHistoryStore.java

示例3: getApplicationAttempts

import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData; //导入方法依赖的package包/类
@Override
public Map<ApplicationAttemptId, ApplicationAttemptHistoryData>
    getApplicationAttempts(ApplicationId appId) throws IOException {
  Map<ApplicationAttemptId, ApplicationAttemptHistoryData> historyDataMap =
      new HashMap<ApplicationAttemptId, ApplicationAttemptHistoryData>();
  HistoryFileReader hfReader = getHistoryFileReader(appId);
  try {
    while (hfReader.hasNext()) {
      HistoryFileReader.Entry entry = hfReader.next();
      if (entry.key.id.startsWith(
          ConverterUtils.APPLICATION_ATTEMPT_PREFIX)) {
        ApplicationAttemptId appAttemptId = ApplicationAttemptId.fromString(
            entry.key.id);
        if (appAttemptId.getApplicationId().equals(appId)) {
          ApplicationAttemptHistoryData historyData = 
              historyDataMap.get(appAttemptId);
          if (historyData == null) {
            historyData = ApplicationAttemptHistoryData.newInstance(
                appAttemptId, null, -1, null, null, null,
                FinalApplicationStatus.UNDEFINED, null);
            historyDataMap.put(appAttemptId, historyData);
          }
          if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
            mergeApplicationAttemptHistoryData(historyData,
                parseApplicationAttemptStartData(entry.value));
          } else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
            mergeApplicationAttemptHistoryData(historyData,
                parseApplicationAttemptFinishData(entry.value));
          }
        }
      }
    }
    LOG.info("Completed reading history information of all application"
        + " attempts of application " + appId);
  } catch (IOException e) {
    LOG.info("Error when reading history information of some application"
        + " attempts of application " + appId);
  } finally {
    hfReader.close();
  }
  return historyDataMap;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:43,代码来源:FileSystemApplicationHistoryStore.java

示例4: getApplicationAttempt

import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData; //导入方法依赖的package包/类
@Override
public ApplicationAttemptHistoryData getApplicationAttempt(
    ApplicationAttemptId appAttemptId) throws IOException {
  HistoryFileReader hfReader =
      getHistoryFileReader(appAttemptId.getApplicationId());
  try {
    boolean readStartData = false;
    boolean readFinishData = false;
    ApplicationAttemptHistoryData historyData =
        ApplicationAttemptHistoryData.newInstance(appAttemptId, null, -1,
          null, null, null, FinalApplicationStatus.UNDEFINED, null);
    while ((!readStartData || !readFinishData) && hfReader.hasNext()) {
      HistoryFileReader.Entry entry = hfReader.next();
      if (entry.key.id.equals(appAttemptId.toString())) {
        if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
          ApplicationAttemptStartData startData =
              parseApplicationAttemptStartData(entry.value);
          mergeApplicationAttemptHistoryData(historyData, startData);
          readStartData = true;
        } else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
          ApplicationAttemptFinishData finishData =
              parseApplicationAttemptFinishData(entry.value);
          mergeApplicationAttemptHistoryData(historyData, finishData);
          readFinishData = true;
        }
      }
    }
    if (!readStartData && !readFinishData) {
      return null;
    }
    if (!readStartData) {
      LOG.warn("Start information is missing for application attempt "
          + appAttemptId);
    }
    if (!readFinishData) {
      LOG.warn("Finish information is missing for application attempt "
          + appAttemptId);
    }
    LOG.info("Completed reading history information of application attempt "
        + appAttemptId);
    return historyData;
  } catch (IOException e) {
    LOG.error("Error when reading history file of application attempt"
        + appAttemptId);
    throw e;
  } finally {
    hfReader.close();
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:50,代码来源:FileSystemApplicationHistoryStore.java


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