• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ReservationSystemTestUtil类的典型用法和代码示例

java 2次浏览

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

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

示例1: createSimpleReservationRequest

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createSimpleReservationRequest(
    int numContainers, long arrival, long deadline, long duration) {
  // create a request with a single atomic ask
  ReservationRequest r =
      ReservationRequest.newInstance(Resource.newInstance(1024, 1, 1),
          numContainers, 1, duration);
  ReservationRequests reqs =
      ReservationRequests.newInstance(Collections.singletonList(r),
          ReservationRequestInterpreter.R_ALL);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(arrival, deadline, reqs,
          "testClientRMService#reservation");
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef,
          ReservationSystemTestUtil.reservationQ);
  return request;
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:18,
代码来源:TestClientRMService.java

示例2: createSimpleReservationRequest

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createSimpleReservationRequest(
    int numContainers, long arrival, long deadline, long duration) {
  // create a request with a single atomic ask
  ReservationRequest r =
      ReservationRequest.newInstance(Resource.newInstance(1024, 1),
          numContainers, 1, duration);
  ReservationRequests reqs =
      ReservationRequests.newInstance(Collections.singletonList(r),
          ReservationRequestInterpreter.R_ALL);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(arrival, deadline, reqs,
          "testYarnClient#reservation");
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef,
          ReservationSystemTestUtil.reservationQ);
  return request;
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:18,
代码来源:TestYarnClient.java

示例3: getSchedulerDynamicConfiguration

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private Configuration getSchedulerDynamicConfiguration() throws IOException {
  conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
  conf.setTimeDuration(
      YarnConfiguration.RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP, 1L,
      TimeUnit.SECONDS);
  if (getSchedulerType() == SchedulerType.CAPACITY) {
    CapacitySchedulerConfiguration schedulerConf =
        new CapacitySchedulerConfiguration(conf);
    ReservationSystemTestUtil.setupDynamicQueueConfiguration(schedulerConf);
    return schedulerConf;
  } else {
    String allocFile = new File(FairSchedulerTestBase.TEST_DIR,
        TestWorkPreservingRMRestart.class.getSimpleName() + ".xml")
            .getAbsolutePath();
    ReservationSystemTestUtil.setupFSAllocationFile(allocFile);
    conf.setClass(YarnConfiguration.RM_SCHEDULER, FairScheduler.class,
        ResourceScheduler.class);
    conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, allocFile);
    return conf;
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:22,
代码来源:TestWorkPreservingRMRestart.java

示例4: createSimpleReservationRequest

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createSimpleReservationRequest(
    int numContainers, long arrival, long deadline, long duration) {
  // create a request with a single atomic ask
  ReservationRequest r =
      ReservationRequest.newInstance(Resource.newInstance(1024, 1),
          numContainers, 1, duration);
  ReservationRequests reqs =
      ReservationRequests.newInstance(Collections.singletonList(r),
          ReservationRequestInterpreter.R_ALL);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(arrival, deadline, reqs,
          "testClientRMService#reservation");
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef,
          ReservationSystemTestUtil.reservationQ);
  return request;
}
 

开发者ID:yncxcw,
项目名称:big-c,
代码行数:18,
代码来源:TestClientRMService.java

示例5: setupResourceManager

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ResourceManager setupResourceManager() {
  CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
  ReservationSystemTestUtil.setupQueueConfiguration(conf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
      ResourceScheduler.class);
  conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
  MockRM rm = new MockRM(conf);
  rm.start();
  try {
    rm.registerNode("127.0.0.1:1", 102400, 100, 100);
    // allow plan follower to synchronize
    Thread.sleep(1050);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  return rm;
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:18,
代码来源:TestClientRMService.java

示例6: setupMiniYARNCluster

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private MiniYARNCluster setupMiniYARNCluster() throws Exception {
  CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
  ReservationSystemTestUtil.setupQueueConfiguration(conf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
      ResourceScheduler.class);
  conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
  final MiniYARNCluster cluster =
      new MiniYARNCluster("testReservationAPIs", 2, 1, 1);

  cluster.init(conf);
  cluster.start();

  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return cluster.getResourceManager().getRMContext()
          .getReservationSystem()
          .getPlan(ReservationSystemTestUtil.reservationQ)
          .getTotalCapacity().getMemorySize() > 6000;
    }
  }, 10, 10000);

  return cluster;
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:25,
代码来源:TestYarnClient.java

示例7: createSimpleReservationRequest

点赞 3

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createSimpleReservationRequest(
    ReservationId reservationId, int numContainers, long arrival,
    long deadline, long duration) {
  // create a request with a single atomic ask
  ReservationRequest r =
      ReservationRequest.newInstance(Resource.newInstance(1024, 1),
          numContainers, 1, duration);
  ReservationRequests reqs =
      ReservationRequests.newInstance(Collections.singletonList(r),
          ReservationRequestInterpreter.R_ALL);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(arrival, deadline, reqs,
          "testYarnClient#reservation");
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef,
          ReservationSystemTestUtil.reservationQ, reservationId);
  return request;
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:19,
代码来源:TestYarnClient.java

示例8: setup

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Override
public void setup() throws Exception {
  CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
  ReservationSystemTestUtil.setupQueueConfiguration(conf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
      ResourceScheduler.class);
  conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
  configuration = conf;

  super.setup();
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:12,
代码来源:TestReservationSystemWithRMHA.java

示例9: testSubmitReservationAndCheckAfterFailover

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testSubmitReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest();
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  ReservationId reservationID = response.getReservationId();
  Assert.assertNotNull(reservationID);
  LOG.info("Submit reservation response: " + reservationID);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Map<ReservationId, ReservationAllocationStateProto> reservationStateMap =
      state.getReservationState().get(ReservationSystemTestUtil.reservationQ);
  Assert.assertNotNull(reservationStateMap);
  Assert.assertNotNull(reservationStateMap.get(reservationID));
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:33,
代码来源:TestReservationSystemWithRMHA.java

示例10: testDeleteReservationAndCheckAfterFailover

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest();
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  ReservationId reservationID = response.getReservationId();
  Assert.assertNotNull(reservationID);

  // Delete the reservation
  ReservationDeleteRequest deleteRequest =
      ReservationDeleteRequest.newInstance(reservationID);
  clientService.deleteReservation(deleteRequest);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Assert.assertNull(state.getReservationState()
      .get(ReservationSystemTestUtil.reservationQ));
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:35,
代码来源:TestReservationSystemWithRMHA.java

示例11: addNodeCapacityToPlan

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private void addNodeCapacityToPlan(MockRM rm, int memory, int vCores) {
  try {
    rm.registerNode("127.0.0.1:1", memory, vCores);
    int attempts = 10;
    do {
      DrainDispatcher dispatcher =
          (DrainDispatcher) rm1.getRMContext().getDispatcher();
      dispatcher.await();
      rm.getRMContext().getReservationSystem()
          .synchronizePlan(ReservationSystemTestUtil.reservationQ, false);
      if (rm.getRMContext().getReservationSystem()
          .getPlan(ReservationSystemTestUtil.reservationQ).getTotalCapacity()
          .getMemory() > 0) {
        break;
      }
      LOG.info("Waiting for node capacity to be added to plan");
      Thread.sleep(100);
    } while (attempts-- > 0);
    if (attempts <= 0) {
      Assert.fail("Exhausted attempts in checking if node capacity was "
          + "added to the plan");
    }

  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:28,
代码来源:TestReservationSystemWithRMHA.java

示例12: createReservationSubmissionRequest

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createReservationSubmissionRequest() {
  Clock clock = new UTCClock();
  long arrival = clock.getTime();
  long duration = 60000;
  long deadline = (long) (arrival + duration + 1500);
  return ReservationSystemTestUtil.createSimpleReservationRequest(4, arrival,
      deadline, duration);
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:9,
代码来源:TestReservationSystemWithRMHA.java

示例13: testFailoverAndSubmitReservation

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testFailoverAndSubmitReservation() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  // Do the failover
  explicitFailover();

  addNodeCapacityToPlan(rm2, 102400, 100);

  // create a reservation
  ClientRMService clientService = rm2.getClientRMService();
  ReservationSubmissionRequest request = createReservationSubmissionRequest();
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  ReservationId reservationID = response.getReservationId();
  Assert.assertNotNull(reservationID);
  LOG.info("Submit reservation response: " + reservationID);
  ReservationDefinition reservationDefinition =
      request.getReservationDefinition();

  // check if reservation is submitted successfully
  Plan plan = rm2.getRMContext().getReservationSystem()
      .getPlan(ReservationSystemTestUtil.reservationQ);
  validateReservation(plan, reservationID, reservationDefinition);
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:33,
代码来源:TestReservationSystemWithRMHA.java

示例14: setup

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Before
public void setup() throws Exception {

  long seed = rand.nextLong();
  rand.setSeed(seed);
  Log.info("Running with seed: " + seed);

  // setting completely loose quotas
  long timeWindow = 1000000L;
  Resource clusterCapacity = Resource.newInstance(100 * 1024, 100);
  step = 1000L;
  String reservationQ =
      ReservationSystemTestUtil.getFullReservationQueueName();

  float instConstraint = 100;
  float avgConstraint = 100;

  ReservationSchedulerConfiguration conf =
      ReservationSystemTestUtil.createConf(reservationQ, timeWindow,
          instConstraint, avgConstraint);
  CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
  policy.init(reservationQ, conf);

  agent = new GreedyReservationAgent();

  QueueMetrics queueMetrics = mock(QueueMetrics.class);
  RMContext context = ReservationSystemTestUtil.createMockRMContext();

  plan = new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step,
      res, minAlloc, maxAlloc, "dedicated", null, true, context);
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:32,
代码来源:TestGreedyReservationAgent.java

示例15: testSimple

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testSimple() throws PlanningException {

  prepareBasicPlan();

  // create a request with a single atomic ask
  ReservationDefinition rr = new ReservationDefinitionPBImpl();
  rr.setArrival(5 * step);
  rr.setDeadline(20 * step);
  ReservationRequest r = ReservationRequest.newInstance(
      Resource.newInstance(2048, 2), 10, 5, 10 * step);
  ReservationRequests reqs = new ReservationRequestsPBImpl();
  reqs.setReservationResources(Collections.singletonList(r));
  rr.setReservationRequests(reqs);

  ReservationId reservationID = ReservationSystemTestUtil
      .getNewReservationId();
  agent.createReservation(reservationID, "u1", plan, rr);

  assertTrue("Agent-based allocation failed", reservationID != null);
  assertTrue("Agent-based allocation failed", plan.getAllReservations()
      .size() == 3);

  ReservationAllocation cs = plan.getReservationById(reservationID);

  System.out.println("--------AFTER SIMPLE ALLOCATION (queue: "
      + reservationID + ")----------");
  System.out.println(plan.toString());
  System.out.println(plan.toCumulativeString());

  for (long i = 10 * step; i < 20 * step; i++) {
    assertTrue(
        "Agent-based allocation unexpected",
        Resources.equals(cs.getResourcesAtTime(i),
            Resource.newInstance(2048 * 10, 2 * 10)));
  }

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestGreedyReservationAgent.java

示例16: testSingleSliding

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testSingleSliding() throws PlanningException {
  prepareBasicPlan();

  // create a single request for which we need subsequent (tight) packing.
  ReservationDefinition rr = new ReservationDefinitionPBImpl();
  rr.setArrival(100 * step);
  rr.setDeadline(120 * step);
  ReservationRequests reqs = new ReservationRequestsPBImpl();
  reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
  ReservationRequest r = ReservationRequest.newInstance(
      Resource.newInstance(1024, 1), 200, 10, 10 * step);

  List<ReservationRequest> list = new ArrayList<ReservationRequest>();
  list.add(r);
  reqs.setReservationResources(list);
  rr.setReservationRequests(reqs);

  // submit to agent
  ReservationId reservationID = ReservationSystemTestUtil
      .getNewReservationId();
  agent.createReservation(reservationID, "u1", plan, rr);

  // validate results, we expect the second one to be accepted
  assertTrue("Agent-based allocation failed", reservationID != null);
  assertTrue("Agent-based allocation failed", plan.getAllReservations()
      .size() == 3);

  ReservationAllocation cs = plan.getReservationById(reservationID);

  assertTrue(cs.toString(), check(cs, 100 * step, 120 * step, 100, 1024, 1));

  System.out.println("--------AFTER packed ALLOCATION (queue: "
      + reservationID + ")----------");
  System.out.println(plan.toString());
  System.out.println(plan.toCumulativeString());

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:39,
代码来源:TestGreedyReservationAgent.java

示例17: prepareBasicPlan

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private void prepareBasicPlan() throws PlanningException {

    // insert in the reservation a couple of controlled reservations, to create
    // conditions for assignment that are non-empty

    int[] f = { 10, 10, 20, 20, 20, 10, 10 };
    ReservationDefinition rDef =
        ReservationSystemTestUtil.createSimpleReservationDefinition(
            0, 0 + f.length * step, f.length * step);
    assertTrue(plan.toString(),
        plan.addReservation(new InMemoryReservationAllocation(
            ReservationSystemTestUtil.getNewReservationId(), rDef, "u1",
            "dedicated", 0L, 0L + f.length * step, ReservationSystemTestUtil
                .generateAllocation(0, step, f), res, minAlloc), false));

    int[] f2 = { 5, 5, 5, 5, 5, 5, 5 };
    Map<ReservationInterval, Resource> alloc =
        ReservationSystemTestUtil.generateAllocation(5000, step, f2);
    assertTrue(plan.toString(),
        plan.addReservation(new InMemoryReservationAllocation(
            ReservationSystemTestUtil.getNewReservationId(), rDef, "u1",
            "dedicated", 5000, 5000 + f2.length * step, alloc, res, minAlloc),
        false));

    System.out.println("--------BEFORE AGENT----------");
    System.out.println(plan.toString());
    System.out.println(plan.toCumulativeString());
  }
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:29,
代码来源:TestGreedyReservationAgent.java

示例18: testSingleReservationAccept

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testSingleReservationAccept() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario1();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          5 * step, // Job arrival time
          20 * step, // Job deadline
          new ReservationRequest[] { ReservationRequest.newInstance(
              Resource.newInstance(2048, 2), // Capability
              10, // Num containers
              5, // Concurrency
              10 * step) }, // Duration
          ReservationRequestInterpreter.R_ORDER, "u1");

  // Add reservation
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  agent.createReservation(reservationID, "u1", plan, rr1);

  // CHECK: allocation was accepted
  assertTrue("Agent-based allocation failed", reservationID != null);
  assertTrue("Agent-based allocation failed", plan.getAllReservations()
      .size() == numJobsInScenario + 1);

  // Get reservation
  ReservationAllocation alloc1 = plan.getReservationById(reservationID);

  // Verify allocation
  assertTrue(alloc1.toString(),
      check(alloc1, 10 * step, 20 * step, 10, 2048, 2));

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:37,
代码来源:TestAlignedPlanner.java

示例19: testOrderNoGapImpossible

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testOrderNoGapImpossible() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario2();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10L, // Job arrival time
          15 * step, // Job deadline
          new ReservationRequest[] {
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  step), // Duration
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  step) }, // Duration
          ReservationRequestInterpreter.R_ORDER_NO_GAP, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == numJobsInScenario);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例20: testOrderNoGapImpossible2

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testOrderNoGapImpossible2() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario2();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          13 * step, // Job deadline
          new ReservationRequest[] {
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  step), // Duration
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  10, // Num containers
                  10, // Concurrency
                  step) }, // Duration
          ReservationRequestInterpreter.R_ORDER_NO_GAP, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == numJobsInScenario);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例21: testOrderImpossible

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testOrderImpossible() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario2();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          15 * step, // Job deadline
          new ReservationRequest[] {
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  2 * step), // Duration
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  step) }, // Duration
          ReservationRequestInterpreter.R_ORDER, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == numJobsInScenario);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例22: testAnyImpossible

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testAnyImpossible() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario2();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          15 * step, // Job deadline
          new ReservationRequest[] {
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  3 * step), // Duration
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  2 * step) }, // Duration
          ReservationRequestInterpreter.R_ANY, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == numJobsInScenario);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例23: testAllImpossible

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testAllImpossible() throws PlanningException {

  // Prepare basic plan
  int numJobsInScenario = initializeScenario2();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          15 * step, // Job deadline
          new ReservationRequest[] {
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  step), // Duration
              ReservationRequest.newInstance(
                  Resource.newInstance(1024, 1), // Capability
                  20, // Num containers
                  20, // Concurrency
                  2 * step) }, // Duration
          ReservationRequestInterpreter.R_ALL, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == numJobsInScenario);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例24: testImpossibleDuration

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testImpossibleDuration() throws PlanningException {

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          15 * step, // Job deadline
          new ReservationRequest[] { ReservationRequest.newInstance(
              Resource.newInstance(1024, 1), // Capability
              20, // Num containers
              20, // Concurrency
              10 * step) }, // Duration
          ReservationRequestInterpreter.R_ALL, "u1");

  // Add reservation
  try {
    ReservationId reservationID =
        ReservationSystemTestUtil.getNewReservationId();
    agent.createReservation(reservationID, "u1", plan, rr1);
    fail();
  } catch (PlanningException e) {
    // Expected failure
  }

  // CHECK: allocation was not accepted
  assertTrue("Agent-based allocation should have failed", plan
      .getAllReservations().size() == 0);

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:31,
代码来源:TestAlignedPlanner.java

示例25: testLoadedDurationIntervals

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testLoadedDurationIntervals() throws PlanningException {

  int numJobsInScenario = initializeScenario3();

  // Create reservation
  ReservationDefinition rr1 =
      createReservationDefinition(
          10 * step, // Job arrival time
          13 * step, // Job deadline
          new ReservationRequest[] { ReservationRequest.newInstance(
              Resource.newInstance(1024, 1), // Capability
              80, // Num containers
              10, // Concurrency
              step) }, // Duration
          ReservationRequestInterpreter.R_ALL, "u1");

  // Add reservation
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  agent.createReservation(reservationID, "u1", plan, rr1);

  // CHECK: allocation was accepted
  assertTrue("Agent-based allocation failed", reservationID != null);
  assertTrue("Agent-based allocation failed", plan.getAllReservations()
      .size() == numJobsInScenario + 1);

  // Get reservation
  ReservationAllocation alloc1 = plan.getReservationById(reservationID);

  // Verify allocation
  assertTrue(alloc1.toString(),
      check(alloc1, 10 * step, 11 * step, 20, 1024, 1));
  assertTrue(alloc1.toString(),
      check(alloc1, 11 * step, 12 * step, 20, 1024, 1));
  assertTrue(alloc1.toString(),
      check(alloc1, 12 * step, 13 * step, 40, 1024, 1));
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:39,
代码来源:TestAlignedPlanner.java

示例26: setup

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Before
public void setup() throws Exception {

  // Initialize random seed
  long seed = rand.nextLong();
  rand.setSeed(seed);
  Log.info("Running with seed: " + seed);

  // Set cluster parameters
  long timeWindow = 1000000L;
  int capacityMem = 100 * 1024;
  int capacityCores = 100;
  step = 60000L;

  Resource clusterCapacity = Resource.newInstance(capacityMem, capacityCores);

  String reservationQ =
      ReservationSystemTestUtil.getFullReservationQueueName();
  float instConstraint = 100;
  float avgConstraint = 100;

  ReservationSchedulerConfiguration conf =
      ReservationSystemTestUtil.createConf(reservationQ, timeWindow,
          instConstraint, avgConstraint);

  CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
  policy.init(reservationQ, conf);

  QueueMetrics queueMetrics = mock(QueueMetrics.class);
  RMContext context = ReservationSystemTestUtil.createMockRMContext();

  // Set planning agent
  agent = new AlignedPlannerWithGreedy();

  // Create Plan
  plan =
      new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step,
          res, minAlloc, maxAlloc, "dedicated", null, true, context);
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:40,
代码来源:TestAlignedPlanner.java

示例27: addFixedAllocation

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private void addFixedAllocation(long start, long step, int[] f)
    throws PlanningException {

  ReservationDefinition rDef =
      ReservationSystemTestUtil.createSimpleReservationDefinition(
          start, start + f.length * step, f.length * step);
  assertTrue(plan.toString(),
      plan.addReservation(new InMemoryReservationAllocation(
          ReservationSystemTestUtil.getNewReservationId(), rDef,
          "user_fixed", "dedicated", start, start + f.length * step,
          ReservationSystemTestUtil.generateAllocation(start, step, f), res,
          minAlloc), false));

}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:15,
代码来源:TestAlignedPlanner.java

示例28: testSubmitReservationAndCheckAfterFailover

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testSubmitReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  ReservationId reservationID = getNewReservation(clientService)
      .getReservationId();
  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest(
      reservationID);
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertNotNull(reservationID);
  LOG.info("Submit reservation response: " + reservationID);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Map<ReservationId, ReservationAllocationStateProto> reservationStateMap =
      state.getReservationState().get(ReservationSystemTestUtil.reservationQ);
  Assert.assertNotNull(reservationStateMap);
  Assert.assertNotNull(reservationStateMap.get(reservationID));
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:35,
代码来源:TestReservationSystemWithRMHA.java

示例29: testDeleteReservationAndCheckAfterFailover

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  ReservationId reservationID = getNewReservation(clientService)
      .getReservationId();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest(
      reservationID);
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertNotNull(reservationID);

  // Delete the reservation
  ReservationDeleteRequest deleteRequest =
      ReservationDeleteRequest.newInstance(reservationID);
  clientService.deleteReservation(deleteRequest);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Assert.assertNull(state.getReservationState()
      .get(ReservationSystemTestUtil.reservationQ));
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:38,
代码来源:TestReservationSystemWithRMHA.java

示例30: addNodeCapacityToPlan

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private void addNodeCapacityToPlan(MockRM rm, int memory, int vCores) {
  try {
    rm.registerNode("127.0.0.1:1", memory, vCores);
    int attempts = 10;
    do {
      DrainDispatcher dispatcher =
          (DrainDispatcher) rm1.getRMContext().getDispatcher();
      dispatcher.await();
      rm.getRMContext().getReservationSystem()
          .synchronizePlan(ReservationSystemTestUtil.reservationQ, false);
      if (rm.getRMContext().getReservationSystem()
          .getPlan(ReservationSystemTestUtil.reservationQ).getTotalCapacity()
          .getMemorySize() > 0) {
        break;
      }
      LOG.info("Waiting for node capacity to be added to plan");
      Thread.sleep(100);
    } while (attempts-- > 0);
    if (attempts <= 0) {
      Assert.fail("Exhausted attempts in checking if node capacity was "
          + "added to the plan");
    }

  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:28,
代码来源:TestReservationSystemWithRMHA.java

示例31: createReservationSubmissionRequest

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
private ReservationSubmissionRequest createReservationSubmissionRequest(
    ReservationId reservationId) {
  Clock clock = new UTCClock();
  long arrival = clock.getTime();
  long duration = 60000;
  long deadline = (long) (arrival + duration + 1500);
  return ReservationSystemTestUtil.createSimpleReservationRequest(
    reservationId, 4, arrival, deadline, duration);
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:10,
代码来源:TestReservationSystemWithRMHA.java

示例32: testFailoverAndSubmitReservation

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Test
public void testFailoverAndSubmitReservation() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  // Do the failover
  explicitFailover();

  addNodeCapacityToPlan(rm2, 102400, 100);
  ClientRMService clientService = rm2.getClientRMService();

  ReservationId reservationID = getNewReservation(clientService)
      .getReservationId();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest(
      reservationID);
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertNotNull(reservationID);
  LOG.info("Submit reservation response: " + reservationID);
  ReservationDefinition reservationDefinition =
      request.getReservationDefinition();

  // check if reservation is submitted successfully
  Plan plan = rm2.getRMContext().getReservationSystem()
      .getPlan(ReservationSystemTestUtil.reservationQ);
  validateReservation(plan, reservationID, reservationDefinition);
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:36,
代码来源:TestReservationSystemWithRMHA.java

示例33: setup

点赞 2

import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil; //导入依赖的package包/类
@Before
public void setup() throws Exception {

  long seed = rand.nextLong();
  rand.setSeed(seed);
  Log.info("Running with seed: " + seed);

  // setting completely loose quotas
  long timeWindow = 1000000L;
  Resource clusterCapacity = Resource.newInstance(100 * 1024, 100);
  step = 1000L;
  String reservationQ =
      ReservationSystemTestUtil.getFullReservationQueueName();

  float instConstraint = 100;
  float avgConstraint = 100;

  ReservationSchedulerConfiguration conf =
      ReservationSystemTestUtil.createConf(reservationQ, timeWindow,
          instConstraint, avgConstraint);
  CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
  policy.init(reservationQ, conf);

  // setting conf to
  conf.setBoolean(GreedyReservationAgent.GREEDY_FAVOR_EARLY_ALLOCATION,
      allocateLeft);

  agent = new GreedyReservationAgent(conf);

  QueueMetrics queueMetrics = mock(QueueMetrics.class);
  RMContext context = ReservationSystemTestUtil.createMockRMContext();

  plan = new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step,
      res, minAlloc, maxAlloc, "dedicated", null, true, context);
}
 

开发者ID:hopshadoop,
项目名称:hops,
代码行数:36,
代码来源:TestGreedyReservationAgent.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)