本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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;
}