org.apache.hadoop.yarn.api.records.Container.getExecutionType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中org.apache.hadoop.yarn.api.records.Container.getExecutionType()方法的一些代码示例,展示了Container.getExecutionType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.getExecutionType()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.Container
类名称:Container
方法名:getExecutionType

Container.getExecutionType介绍

[英]Get the ExecutionType for the container.
[中]获取容器的ExecutionType

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
public ExecutionType getExecutionType() {
 return container.getExecutionType();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

/**
 * Update the resources of the node when releasing a container.
 * @param container Container to release.
 */
protected synchronized void updateResourceForReleasedContainer(
  Container container) {
 if (container.getExecutionType() == ExecutionType.GUARANTEED) {
  addUnallocatedResource(container.getResource());
  --numContainers;
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-applications-distributedshell

@Override
public void onContainerStatusReceived(ContainerId containerId,
  ContainerStatus containerStatus) {
 if (LOG.isDebugEnabled()) {
  LOG.debug("Container Status: id=" + containerId + ", status=" +
    containerStatus);
 }
 // If promote_opportunistic_after_start is set, automatically promote
 // opportunistic containers to guaranteed.
 if (autoPromoteContainers) {
  if (containerStatus.getState() == ContainerState.RUNNING) {
   Container container = containers.get(containerId);
   if (container.getExecutionType() == ExecutionType.OPPORTUNISTIC) {
    // Promote container
    LOG.info("Promoting container {} to {}", container.getId(),
      container.getExecutionType());
    UpdateContainerRequest updateRequest = UpdateContainerRequest
      .newInstance(container.getVersion(), container.getId(),
        ContainerUpdateType.PROMOTE_EXECUTION_TYPE, null,
        ExecutionType.GUARANTEED);
    amRMClient.requestContainerUpdate(container, updateRequest);
   }
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private RMContainer createContainer(
  Resource request, ApplicationAttemptId appAttemptId) {
 RMContainer container = mock(RMContainer.class);
 Container containerInner = mock(Container.class);
 ContainerId id = mock(ContainerId.class);
 when(id.getContainerId()).thenReturn((long)containers.size());
 when(containerInner.getResource()).
   thenReturn(Resources.clone(request));
 when(containerInner.getId()).thenReturn(id);
 when(containerInner.getExecutionType()).
   thenReturn(ExecutionType.GUARANTEED);
 when(container.getApplicationAttemptId()).thenReturn(appAttemptId);
 when(container.getContainerId()).thenReturn(id);
 when(container.getContainer()).thenReturn(containerInner);
 when(container.getExecutionType()).thenReturn(ExecutionType.GUARANTEED);
 when(container.getAllocatedResource()).
   thenReturn(Resources.clone(request));
 when(container.compareTo(any())).thenAnswer(new Answer<Integer>() {
  public Integer answer(InvocationOnMock invocation) {
   return
     Long.compare(
     ((RMContainer)invocation.getMock()).getContainerId()
       .getContainerId(),
     ((RMContainer)invocation.getArguments()[0]).getContainerId()
       .getContainerId());
  }
 });
 containers.add(container);
 return container;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client

validateContainerExecTypeChangeRequest(
   updateContainerRequest.getContainerUpdateType(),
   container.getId(), container.getExecutionType(),
   updateContainerRequest.getExecutionType());
} else if (updateContainerRequest.getExecutionType() == null &&

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-applications-distributedshell

@Override
public void onContainersUpdated(
  List<UpdatedContainer> containers) {
 for (UpdatedContainer container : containers) {
  LOG.info("Container {} updated, updateType={}, resource={}, "
      + "execType={}",
    container.getContainer().getId(),
    container.getUpdateType().toString(),
    container.getContainer().getResource().toString(),
    container.getContainer().getExecutionType());
  // TODO Remove this line with finalized updateContainer API.
  // Currently nm client needs to notify the NM to update container
  // execution type via NMClient#updateContainerResource() or
  // NMClientAsync#updateContainerResourceAsync() when
  // auto-update.containers is disabled, but this API is
  // under evolving and will need to be replaced by a proper new API.
  nmClientAsync.updateContainerResourceAsync(container.getContainer());
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
 public DistributedSchedulingAllocateResponse
   allocateForDistributedScheduling(
   DistributedSchedulingAllocateRequest request)
   throws YarnException, IOException {
  List<ResourceRequest> askList =
    request.getAllocateRequest().getAskList();
  List<Container> allocatedContainers = request.getAllocatedContainers();
  Assert.assertEquals(1, allocatedContainers.size());
  Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
    allocatedContainers.get(0).getExecutionType());
  Assert.assertEquals(1, askList.size());
  Assert.assertTrue(askList.get(0)
    .getExecutionTypeRequest().getEnforceExecutionType());
  DistributedSchedulingAllocateResponse resp = factory
    .newRecordInstance(DistributedSchedulingAllocateResponse.class);
  RemoteNode remoteNode1 = RemoteNode.newInstance(
    NodeId.newInstance("h1", 1234), "http://h1:4321");
  RemoteNode remoteNode2 = RemoteNode.newInstance(
    NodeId.newInstance("h2", 1234), "http://h2:4321");
  remoteNode2.setNodePartition("l1");
  resp.setNodesForScheduling(
    Arrays.asList(remoteNode1, remoteNode2));
  return resp;
 }
};

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

updatedResource,
  existingRMContainer.getContainer().getPriority(), null,
  tempContainer.getExecutionType());
newContainer.setAllocationRequestId(
  existingRMContainer.getContainer().getAllocationRequestId());
  existingRMContainer.getContainer().getExecutionType());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

Assert.assertEquals(container.getId(), uc.getContainer().getId());
Assert.assertEquals(ExecutionType.GUARANTEED,
  uc.getContainer().getExecutionType());
Assert.assertEquals(container.getId(), containersFromNM.getId());
Assert.assertEquals(ExecutionType.GUARANTEED,
  containersFromNM.getExecutionType());
uc = allocateResponse.getUpdatedContainers().get(0);
Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
  uc.getContainer().getExecutionType());
  response.getContainersToUpdate().get(0).getExecutionType());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

container.getPriority(), rmContainer.getCreationTime(),
this.logAggregationContext, rmContainer.getNodeLabelExpression(),
containerType, container.getExecutionType(),
container.getAllocationRequestId(),
rmContainer.getAllocationTags()));

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

Container uc =
  allocateResponse.getUpdatedContainers().get(0).getContainer();
Assert.assertEquals(ExecutionType.GUARANTEED, uc.getExecutionType());
Assert.assertEquals(uc.getId(), container.getId());
Assert.assertEquals(uc.getVersion(), container.getVersion() + 1);
Assert.assertEquals(ExecutionType.OPPORTUNISTIC, uc.getExecutionType());
Assert.assertEquals(uc.getId(), container.getId());
Assert.assertEquals(uc.getVersion(), container.getVersion() + 2);

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

Container uc =
  allocateResponse.getUpdatedContainers().get(0).getContainer();
Assert.assertEquals(ExecutionType.GUARANTEED, uc.getExecutionType());
Assert.assertEquals(uc.getId(), container.getId());
Assert.assertEquals(uc.getVersion(), container.getVersion() + 1);

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

Assert.assertEquals(1, allocatedContainers.size());
Assert.assertEquals(ExecutionType.OPPORTUNISTIC,
  allocatedContainers.get(0).getExecutionType());
Assert.assertEquals(12345, allocResp.getNumClusterNodes());

相关文章