• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ReservationId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getReservationId

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Override
public ReservationId getReservationId() {
  ReservationSubmissionResponseProtoOrBuilder p = viaProto ? proto : builder;
  if (reservationId != null) {
    return reservationId;
  }
  if (!p.hasReservationId()) {
    return null;
  }
  reservationId = convertFromProtoFormat(p.getReservationId());
  return reservationId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ReservationSubmissionResponsePBImpl.java


示例2: deleteReservation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Override
public boolean deleteReservation(ReservationId reservationID) {
  writeLock.lock();
  try {
    ReservationAllocation reservation = getReservationById(reservationID);
    if (reservation == null) {
      String errMsg =
          "The specified Reservation with ID " + reservationID
              + " does not exist in the plan";
      LOG.error(errMsg);
      throw new IllegalArgumentException(errMsg);
    }
    return removeReservation(reservation);
  } finally {
    writeLock.unlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:InMemoryPlan.java


示例3: InMemoryReservationAllocation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
InMemoryReservationAllocation(ReservationId reservationID,
    ReservationDefinition contract, String user, String planName,
    long startTime, long endTime,
    Map<ReservationInterval, ReservationRequest> allocationRequests,
    ResourceCalculator calculator, Resource minAlloc) {
  this.contract = contract;
  this.startTime = startTime;
  this.endTime = endTime;
  this.reservationID = reservationID;
  this.user = user;
  this.allocationRequests = allocationRequests;
  this.planName = planName;
  resourcesOverTime = new RLESparseResourceAllocation(calculator, minAlloc);
  for (Map.Entry<ReservationInterval, ReservationRequest> r : allocationRequests
      .entrySet()) {
    resourcesOverTime.addInterval(r.getKey(), r.getValue());
    if (r.getValue().getConcurrency() > 1) {
      hasGang = true;
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:InMemoryReservationAllocation.java


示例4: testBlocks

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testBlocks() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 10, 10, 10, 10, 10, 10 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, false, false);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertFalse(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i]), (alloc[i])),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestInMemoryReservationAllocation.java


示例5: testSteps

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testSteps() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 10, 10, 10, 10, 10, 10 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, true, false);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertFalse(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(
        Resource.newInstance(1024 * (alloc[i] + i), (alloc[i] + i), (alloc[i] + i)),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestInMemoryReservationAllocation.java


示例6: testSkyline

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testSkyline() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 0, 5, 10, 10, 5, 0 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, true, false);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertFalse(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(
        Resource.newInstance(1024 * (alloc[i] + i), (alloc[i] + i), (alloc[i] + i)),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestInMemoryReservationAllocation.java


示例7: testZeroAlloaction

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testZeroAlloaction() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = {};
  long start = 0;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      new HashMap<ReservationInterval, ReservationRequest>();
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, (int) start,
      alloc);
  Assert.assertFalse(rAllocation.containsGangs());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestInMemoryReservationAllocation.java


示例8: testGangAlloaction

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testGangAlloaction() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 10, 10, 10, 10, 10, 10 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, false, true);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertTrue(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i]), (alloc[i])),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestInMemoryReservationAllocation.java


示例9: testAddEmptyReservation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testAddEmptyReservation() {
  Plan plan =
      new InMemoryPlan(queueMetrics, policy, agent, totalCapacity, 1L,
          resCalc, minAlloc, maxAlloc, planName, replanner, true);
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  int[] alloc = {};
  int start = 100;
  Map<ReservationInterval, ReservationRequest> allocations =
      new HashMap<ReservationInterval, ReservationRequest>();
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length,
          alloc.length, allocations.values());
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length, allocations, resCalc, minAlloc);
  Assert.assertNull(plan.getReservationById(reservationID));
  try {
    plan.addReservation(rAllocation);
  } catch (PlanningException e) {
    Assert.fail(e.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestInMemoryPlan.java


示例10: setUp

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Before
public void setUp() {
  clock = mock(Clock.class);
  plan = mock(Plan.class);
  rSystem = mock(ReservationSystem.class);
  plans.put(PLAN_NAME, plan);
  rrValidator = new ReservationInputValidator(clock);
  when(clock.getTime()).thenReturn(1L);
  ResourceCalculator rCalc = new DefaultResourceCalculator();
  Resource resource = Resource.newInstance(10240, 10, 10);
  when(plan.getResourceCalculator()).thenReturn(rCalc);
  when(plan.getTotalCapacity()).thenReturn(resource);
  when(rSystem.getQueueForReservation(any(ReservationId.class))).thenReturn(
      PLAN_NAME);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(plan);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestReservationInputValidator.java


示例11: testUpdateReservationDoesnotExist

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestReservationInputValidator.java


示例12: testDeleteReservationDoesnotExist

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestReservationInputValidator.java


示例13: testDeleteReservationInvalidPlan

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestReservationInputValidator.java


示例14: toInMemoryAllocation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
public static InMemoryReservationAllocation toInMemoryAllocation(
    String planName, ReservationId reservationId,
    ReservationAllocationStateProto allocationState, Resource minAlloc,
    ResourceCalculator planResourceCalculator) {
  ReservationDefinition definition =
      convertFromProtoFormat(
          allocationState.getReservationDefinition());
  Map<ReservationInterval, Resource> allocations = toAllocations(
          allocationState.getAllocationRequestsList());
  InMemoryReservationAllocation allocation =
      new InMemoryReservationAllocation(reservationId, definition,
      allocationState.getUser(), planName, allocationState.getStartTime(),
      allocationState.getEndTime(), allocations, planResourceCalculator,
      minAlloc, allocationState.getContainsGangs());
  return allocation;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:ReservationSystemUtil.java


示例15: recover

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Override
public void recover(RMState state) throws Exception {
  LOG.info("Recovering Reservation system");
  writeLock.lock();
  try {
    Map<String, Map<ReservationId, ReservationAllocationStateProto>> reservationSystemState =
        state.getReservationState();
    if (planFollower != null) {
      for (String plan : plans.keySet()) {
        // recover reservations if any from state store
        if (reservationSystemState.containsKey(plan)) {
          loadPlan(plan, reservationSystemState.get(plan));
        }
        synchronizePlan(plan, false);
      }
      startPlanFollower(conf.getLong(
          YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS,
          YarnConfiguration.DEFAULT_RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS));
    }
  } finally {
    writeLock.unlock();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:AbstractReservationSystem.java


示例16: testSkyline

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testSkyline() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 0, 5, 10, 10, 5, 0 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, true, false);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertFalse(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(
        Resource.newInstance(1024 * (alloc[i] + i), (alloc[i] + i)),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:23,代码来源:TestInMemoryReservationAllocation.java


示例17: testGangAlloaction

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testGangAlloaction() {
  ReservationId reservationID =
      ReservationId.newInstance(rand.nextLong(), rand.nextLong());
  int[] alloc = { 10, 10, 10, 10, 10, 10 };
  int start = 100;
  ReservationDefinition rDef =
      createSimpleReservationDefinition(start, start + alloc.length + 1,
          alloc.length);
  Map<ReservationInterval, ReservationRequest> allocations =
      generateAllocation(start, alloc, false, true);
  ReservationAllocation rAllocation =
      new InMemoryReservationAllocation(reservationID, rDef, user, planName,
          start, start + alloc.length + 1, allocations, resCalc, minAlloc);
  doAssertions(rAllocation, reservationID, rDef, allocations, start, alloc);
  Assert.assertTrue(rAllocation.containsGangs());
  for (int i = 0; i < alloc.length; i++) {
    Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i])),
        rAllocation.getResourcesAtTime(start + i));
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:22,代码来源:TestInMemoryReservationAllocation.java


示例18: testSubmitReservation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testSubmitReservation() throws JSONException, Exception {
  rm.start();
  for (int i = 0; i < 100; i++) {
    MockNM amNodeManager =
        rm.registerNode("127.0.0." + i + ":1234", 100 * 1024);
    amNodeManager.nodeHeartbeat(true);
  }
  ReservationId rid =
      testSubmissionReservationHelper("reservation/submit",
          MediaType.APPLICATION_JSON);
  if (this.isAuthenticationEnabled()) {
    assertNotNull(rid);
  }
  rm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:TestRMWebServicesReservation.java


示例19: testUpdateReservation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
@Test
public void testUpdateReservation() throws JSONException, Exception {
  rm.start();
  for (int i = 0; i < 100; i++) {
    MockNM amNodeManager =
        rm.registerNode("127.0.0." + i + ":1234", 100 * 1024);
    amNodeManager.nodeHeartbeat(true);
  }
  ReservationId rid =
      testSubmissionReservationHelper("reservation/submit",
          MediaType.APPLICATION_JSON);
  if (this.isAuthenticationEnabled()) {
    assertNotNull(rid);
  }
  testUpdateReservationHelper("reservation/update", rid,
      MediaType.APPLICATION_JSON);

  rm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:TestRMWebServicesReservation.java


示例20: validateStoredReservation

import org.apache.hadoop.yarn.api.records.ReservationId; //导入依赖的package包/类
private void validateStoredReservation(
    RMStateStoreHelper stateStoreHelper, TestDispatcher dispatcher,
    RMContext rmContext, ReservationId r1, String planName,
    ReservationAllocation allocation,
    ReservationAllocationStateProto allocationStateProto) throws Exception {
  RMStateStore store = stateStoreHelper.getRMStateStore();
  when(rmContext.getStateStore()).thenReturn(store);
  store.setRMDispatcher(dispatcher);
  RMState state = store.loadState();
  Map<String, Map<ReservationId, ReservationAllocationStateProto>>
      reservationState = state.getReservationState();
  Assert.assertNotNull(reservationState);
  Map<ReservationId, ReservationAllocationStateProto> reservations =
      reservationState.get(planName);
  Assert.assertNotNull(reservations);
  ReservationAllocationStateProto storedReservationAllocation =
      reservations.get(r1);
  Assert.assertNotNull(storedReservationAllocation);

  assertAllocationStateEqual(
      allocationStateProto, storedReservationAllocation);
  assertAllocationStateEqual(allocation, storedReservationAllocation);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:RMStateStoreTestBase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ObjectClass类代码示例发布时间:2022-05-23
下一篇:
Java BindingConfig类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap