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

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

java 1次浏览

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

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

示例1: InMemoryPlan

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy,
    ReservationAgent agent, Resource totalCapacity, long step,
    ResourceCalculator resCalc, Resource minAlloc, Resource maxAlloc,
    String queueName, Planner replanner, boolean getMoveOnExpiry) {
  this(queueMetrics, policy, agent, totalCapacity, step, resCalc, minAlloc,
      maxAlloc, queueName, replanner, getMoveOnExpiry, new UTCClock());
}
 

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

示例2: ClientRMService

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
public ClientRMService(RMContext rmContext, YarnScheduler scheduler,
    RMAppManager rmAppManager, ApplicationACLsManager applicationACLsManager,
    QueueACLsManager queueACLsManager,
    RMDelegationTokenSecretManager rmDTSecretManager) {
  this(rmContext, scheduler, rmAppManager, applicationACLsManager,
      queueACLsManager, rmDTSecretManager, new UTCClock());
}
 

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

示例3: InMemoryPlan

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
public InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy,
    ReservationAgent agent, Resource totalCapacity, long step,
    ResourceCalculator resCalc, Resource minAlloc, Resource maxAlloc,
    String queueName, Planner replanner, boolean getMoveOnExpiry,
    RMContext rmContext) {
  this(queueMetrics, policy, agent, totalCapacity, step, resCalc, minAlloc,
      maxAlloc, queueName, replanner, getMoveOnExpiry, rmContext,
      new UTCClock());
}
 

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

示例4: createReservationSubmissionRequest

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的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

示例5: createReservationSubmissionRequest

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的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

示例6: testUpdateReservation

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testUpdateReservation() {
  ResourceManager rm = setupResourceManager();
  ClientRMService clientService = rm.getClientRMService();
  Clock clock = new UTCClock();
  long arrival = clock.getTime();
  long duration = 60000;
  long deadline = (long) (arrival + 1.05 * duration);
  ReservationSubmissionRequest sRequest =
      submitReservationTestHelper(clientService, arrival, deadline, duration);

  ReservationDefinition rDef = sRequest.getReservationDefinition();
  ReservationRequest rr =
      rDef.getReservationRequests().getReservationResources().get(0);
  ReservationId reservationID = sRequest.getReservationId();
  rr.setNumContainers(5);
  arrival = clock.getTime();
  duration = 30000;
  deadline = (long) (arrival + 1.05 * duration);
  rr.setDuration(duration);
  rDef.setArrival(arrival);
  rDef.setDeadline(deadline);
  ReservationUpdateRequest uRequest =
      ReservationUpdateRequest.newInstance(rDef, reservationID);
  ReservationUpdateResponse uResponse = null;
  try {
    uResponse = clientService.updateReservation(uRequest);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(uResponse);
  System.out.println("Update reservation response: " + uResponse);

  rm.stop();
}
 

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

示例7: testListReservationsByReservationId

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testListReservationsByReservationId() {
  ResourceManager rm = setupResourceManager();
  ClientRMService clientService = rm.getClientRMService();
  Clock clock = new UTCClock();
  long arrival = clock.getTime();
  long duration = 60000;
  long deadline = (long) (arrival + 1.05 * duration);
  ReservationSubmissionRequest sRequest =
      submitReservationTestHelper(clientService, arrival, deadline, duration);

  ReservationId reservationID = sRequest.getReservationId();
  ReservationListResponse response = null;
  ReservationListRequest request = ReservationListRequest.newInstance(
      ReservationSystemTestUtil.reservationQ, reservationID.toString(), -1,
      -1, false);
  try {
    response = clientService.listReservations(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertEquals(1, response.getReservationAllocationState().size());
  Assert.assertEquals(response.getReservationAllocationState().get(0)
      .getReservationId().getId(), reservationID.getId());
  Assert.assertEquals(response.getReservationAllocationState().get(0)
      .getResourceAllocationRequests().size(), 0);

  rm.stop();
}
 

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

示例8: testCreateReservation

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testCreateReservation() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    // Submit the reservation again with the same request and make sure it
    // passes.
    client.submitReservation(sRequest);

    // Submit the reservation with the same reservation id but different
    // reservation definition, and ensure YarnException is thrown.
    arrival = clock.getTime();
    ReservationDefinition rDef = sRequest.getReservationDefinition();
    rDef.setArrival(arrival + duration);
    sRequest.setReservationDefinition(rDef);
    try {
      client.submitReservation(sRequest);
      Assert.fail("Reservation submission should fail if a duplicate "
          + "reservation id is used, but the reservation definition has been "
          + "updated.");
    } catch (Exception e) {
      Assert.assertTrue(e instanceof YarnException);
    }
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例9: testUpdateReservation

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testUpdateReservation() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    ReservationDefinition rDef = sRequest.getReservationDefinition();
    ReservationRequest rr =
        rDef.getReservationRequests().getReservationResources().get(0);
    ReservationId reservationID = sRequest.getReservationId();
    rr.setNumContainers(5);
    arrival = clock.getTime();
    duration = 30000;
    deadline = (long) (arrival + 1.05 * duration);
    rr.setDuration(duration);
    rDef.setArrival(arrival);
    rDef.setDeadline(deadline);
    ReservationUpdateRequest uRequest =
        ReservationUpdateRequest.newInstance(rDef, reservationID);
    ReservationUpdateResponse uResponse = client.updateReservation(uRequest);
    Assert.assertNotNull(uResponse);
    System.out.println("Update reservation response: " + uResponse);
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例10: testListReservationsByReservationId

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testListReservationsByReservationId() throws Exception{
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    ReservationId reservationID = sRequest.getReservationId();
    ReservationListRequest request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, reservationID.toString(), -1,
        -1, false);
    ReservationListResponse response = client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(1, response.getReservationAllocationState().size());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getReservationId().getId(), reservationID.getId());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getResourceAllocationRequests().size(), 0);
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例11: testListReservationsByInvalidTimeInterval

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testListReservationsByInvalidTimeInterval() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    // List reservations, search by invalid end time == -1.
    ReservationListRequest request = ReservationListRequest
        .newInstance(ReservationSystemTestUtil.reservationQ, "", 1, -1, true);

    ReservationListResponse response = client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(1, response.getReservationAllocationState().size());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getReservationId().getId(), sRequest.getReservationId().getId());

    // List reservations, search by invalid end time < -1.
    request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", 1, -10, true);

    response = client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(1, response.getReservationAllocationState().size());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getReservationId().getId(), sRequest.getReservationId().getId());
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例12: testReservationDelete

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testReservationDelete() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    ReservationId reservationID = sRequest.getReservationId();
    // Delete the reservation
    ReservationDeleteRequest dRequest =
        ReservationDeleteRequest.newInstance(reservationID);
    ReservationDeleteResponse dResponse = client.deleteReservation(dRequest);
    Assert.assertNotNull(dResponse);
    System.out.println("Delete reservation response: " + dResponse);

    // List reservations, search by non-existent reservationID
    ReservationListRequest request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, reservationID.toString(), -1,
        -1, false);

    ReservationListResponse response =  client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(0, response.getReservationAllocationState().size());
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例13: SimpleCapacityReplanner

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
public SimpleCapacityReplanner() {
  this(new UTCClock());
}
 

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

示例14: testListReservationsByTimeInterval

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testListReservationsByTimeInterval() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    // List reservations, search by a point in time within the reservation
    // range.
    arrival = clock.getTime();
    ReservationId reservationID = sRequest.getReservationId();
    ReservationListRequest request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", arrival + duration / 2,
        arrival + duration / 2, true);

    ReservationListResponse response = client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(1, response.getReservationAllocationState().size());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getReservationId().getId(), reservationID.getId());
    // List reservations, search by time within reservation interval.
    request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", 1, Long.MAX_VALUE, true);

    response = client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(1, response.getReservationAllocationState().size());
    Assert.assertEquals(response.getReservationAllocationState().get(0)
        .getReservationId().getId(), reservationID.getId());
    // Verify that the full resource allocations exist.
    Assert.assertTrue(response.getReservationAllocationState().get(0)
        .getResourceAllocationRequests().size() > 0);

    // Verify that the full RDL is returned.
    ReservationRequests reservationRequests =
        response.getReservationAllocationState().get(0)
            .getReservationDefinition().getReservationRequests();
    Assert.assertTrue(
        reservationRequests.getInterpreter().toString().equals("R_ALL"));
    Assert.assertTrue(reservationRequests.getReservationResources().get(0)
        .getDuration() == duration);
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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

示例15: testListReservationsByTimeIntervalContainingNoReservations

点赞 2

import org.apache.hadoop.yarn.util.UTCClock; //导入依赖的package包/类
@Test
public void testListReservationsByTimeIntervalContainingNoReservations()
    throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    // List reservations, search by very large start time.
    ReservationListRequest request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", Long.MAX_VALUE, -1,
        false);

    ReservationListResponse response = client.listReservations(request);

    // Ensure all reservations are filtered out.
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getReservationAllocationState().size(), 0);

    duration = 30000;
    deadline = sRequest.getReservationDefinition().getDeadline();

    // List reservations, search by start time after the reservation
    // end time.
    request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", deadline + duration,
        deadline + 2 * duration, false);

    response = client.listReservations(request);

    // Ensure all reservations are filtered out.
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getReservationAllocationState().size(), 0);

    arrival = clock.getTime();
    // List reservations, search by end time before the reservation start
    // time.
    request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, "", 0, arrival - duration,
        false);

    response = client.listReservations(request);

    // Ensure all reservations are filtered out.
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getReservationAllocationState().size(), 0);

    // List reservations, search by very small end time.
    request = ReservationListRequest
        .newInstance(ReservationSystemTestUtil.reservationQ, "", 0, 1, false);

    response = client.listReservations(request);

    // Ensure all reservations are filtered out.
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getReservationAllocationState().size(), 0);

  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
 

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


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