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


Java ReservationId.parseReservationId方法代码示例

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


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

示例1: storeReservationState

import org.apache.hadoop.yarn.api.records.ReservationId; //导入方法依赖的package包/类
@Override
protected synchronized void storeReservationState(
    ReservationAllocationStateProto reservationAllocation, String planName,
    String reservationIdName) throws Exception {
  LOG.info("Storing reservationallocation for " + reservationIdName + " " +
          "for plan " + planName);
  Map<ReservationId, ReservationAllocationStateProto> planState =
      state.getReservationState().get(planName);
  if (planState == null) {
    planState = new HashMap<>();
    state.getReservationState().put(planName, planState);
  }
  ReservationId reservationId =
      ReservationId.parseReservationId(reservationIdName);
  planState.put(reservationId, reservationAllocation);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:MemoryRMStateStore.java

示例2: removeReservationState

import org.apache.hadoop.yarn.api.records.ReservationId; //导入方法依赖的package包/类
@Override
protected synchronized void removeReservationState(
    String planName, String reservationIdName) throws Exception {
  LOG.info("Removing reservationallocation " + reservationIdName
            + " for plan " + planName);

  Map<ReservationId, ReservationAllocationStateProto> planState =
      state.getReservationState().get(planName);
  if (planState == null) {
    throw new YarnRuntimeException("State for plan " + planName + " does " +
        "not exist");
  }
  ReservationId reservationId =
      ReservationId.parseReservationId(reservationIdName);
  planState.remove(reservationId);
  if (planState.isEmpty()) {
    state.getReservationState().remove(planName);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:MemoryRMStateStore.java

示例3: loadReservationSystemState

import org.apache.hadoop.yarn.api.records.ReservationId; //导入方法依赖的package包/类
private void loadReservationSystemState(RMState rmState) throws Exception {
  List<String> planNodes = getChildren(reservationRoot);
  for (String planName : planNodes) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Loading plan from znode: " + planName);
    }
    String planNodePath = getNodePath(reservationRoot, planName);

    List<String> reservationNodes = getChildren(planNodePath);
    for (String reservationNodeName : reservationNodes) {
      String reservationNodePath = getNodePath(planNodePath,
          reservationNodeName);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Loading reservation from znode: " + reservationNodePath);
      }
      byte[] reservationData = getData(reservationNodePath);
      ReservationAllocationStateProto allocationState =
          ReservationAllocationStateProto.parseFrom(reservationData);
      if (!rmState.getReservationState().containsKey(planName)) {
        rmState.getReservationState().put(planName,
            new HashMap<ReservationId, ReservationAllocationStateProto>());
      }
      ReservationId reservationId =
          ReservationId.parseReservationId(reservationNodeName);
      rmState.getReservationState().get(planName).put(reservationId,
          allocationState);
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:30,代码来源:ZKRMStateStore.java

示例4: processChildNode

import org.apache.hadoop.yarn.api.records.ReservationId; //导入方法依赖的package包/类
@Override
public void processChildNode(String planName, String childNodeName,
    byte[] childData) throws IOException {
  ReservationAllocationStateProto allocationState =
      ReservationAllocationStateProto.parseFrom(childData);
  if (!rmState.getReservationState().containsKey(planName)) {
    rmState.getReservationState().put(planName,
        new HashMap<ReservationId, ReservationAllocationStateProto>());
  }
  ReservationId reservationId =
      ReservationId.parseReservationId(childNodeName);
  rmState.getReservationState().get(planName).put(reservationId,
      allocationState);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:FileSystemRMStateStore.java

示例5: testSubmissionReservationHelper

import org.apache.hadoop.yarn.api.records.ReservationId; //导入方法依赖的package包/类
private ReservationId testSubmissionReservationHelper(String path,
    String media) throws JSONException, Exception {

  String reservationJson = loadJsonFile("submit-reservation.json");

  JSONJAXBContext jc =
      new JSONJAXBContext(JSONConfiguration.mapped()
          .build(), ReservationSubmissionRequestInfo.class);
  JSONUnmarshaller unmarshaller = jc.createJSONUnmarshaller();
  ReservationSubmissionRequestInfo rsci =
      unmarshaller.unmarshalFromJSON(new StringReader(reservationJson),
          ReservationSubmissionRequestInfo.class);

  Thread.sleep(1000);
  ClientResponse response =
      constructWebResource(path).entity(rsci, MediaType.APPLICATION_JSON)
          .accept(media).post(ClientResponse.class);

  if (!this.isAuthenticationEnabled()) {
    assertEquals(Status.UNAUTHORIZED, response.getClientResponseStatus());
    return null;
  }

  System.out.println("RESPONSE:" + response);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);

  assertEquals("incorrect number of elements", 1, json.length());
  ReservationId rid = null;
  try {
    rid = ReservationId.parseReservationId(json.getString("reservation-id"));
    assertEquals("incorrect return value", rid.getId(), 1);
  } catch (JSONException j) {
    // failure is possible and is checked outside
  }
  return rid;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:38,代码来源:TestRMWebServicesReservation.java


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