热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中org.apache.hadoop.yarn.api.records.Container.getPriority()方法的一些代码示例,展示了

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

Container.getPriority介绍

[英]Get the Priority at which the Container was allocated.
[中]获取分配ContainerPriority

代码示例

代码示例来源:origin: apache/drill

public static String labelContainer(Container container) {
StringBuilder buf = new StringBuilder()
.append("[id: ")
.append(container.getId())
.append(", host: ")
.append(container.getNodeId().getHost())
.append(", priority: ")
.append(container.getPriority())
.append("]");
return buf.toString();
}

代码示例来源:origin: apache/drill

/**
* Utility method to display YARN container information in a useful way for
* log messages.
*
* @param container
* @return
*/
public static String describeContainer(Container container) {
StringBuilder buf = new StringBuilder()
.append("[id: ")
.append(container.getId())
.append(", host: ")
.append(container.getNodeId().getHost())
.append(", priority: ")
.append(container.getPriority())
.append(", memory: ")
.append(container.getResource().getMemory())
.append(" MB, vcores: ")
.append(container.getResource().getVirtualCores())
.append("]");
return buf.toString();
}

代码示例来源:origin: apache/flink

private static Container mockContainer(String host, int port, int containerId, Resource resource) {
Container mockCOntainer= mock(Container.class);
NodeId mockNodeId = NodeId.newInstance(host, port);
ContainerId mockCOntainerId= ContainerId.newInstance(
ApplicationAttemptId.newInstance(
ApplicationId.newInstance(System.currentTimeMillis(), 1),
1
),
containerId
);
when(mockContainer.getId()).thenReturn(mockContainerId);
when(mockContainer.getNodeId()).thenReturn(mockNodeId);
when(mockContainer.getResource()).thenReturn(resource);
when(mockContainer.getPriority()).thenReturn(Priority.UNDEFINED);
return mockContainer;
}

代码示例来源:origin: apache/drill

@Override
public synchronized void containersAllocated(List containers) {
EventContext cOntext= new EventContext(this);
for (Container container : containers) {
if (allocatedContainers.contains(container.getId())) {
continue;
}
// We should never get a container on a node in the blacklist we
// sent to YARN. If we do, something is wrong. Log the error and
// reject the container. Else, bad things happen further along as
// the tracking mechanisms assume one task per node.
String host = container.getNodeId().getHost();
if (nodeInventory.isInUse(host)) {
LOG.error( "Host is in use, but YARN allocated a container: " +
DoYUtil.labelContainer(container) + " - container rejected." );
yarn.releaseContainer(container);
continue;
}
// The container is fine.
allocatedContainers.add(container.getId());
int priority = container.getPriority().getPriority();
int offset = priority - PRIORITY_OFFSET;
if (offset <0 || offset > prioritizedGroups.size()) {
LOG.error("Container allocated with unknown priority " + DoYUtil.labelContainer(container));
continue;
}
context.setGroup(prioritizedGroups.get(offset));
context.group.containerAllocated(context, container);
}
}

代码示例来源:origin: alibaba/jstorm

if (nimbusMap.containsKey(containerId)) {
Container nimbusCOntainer= nimbusMap.get(containerId);
cOntainerAsk= setupContainerAskForRM(nimbusContainer.getResource().getMemory(), nimbusContainer.getResource().getVirtualCores(), nimbusContainer.getPriority().getPriority(), nimbusContainer.getNodeId().getHost());
LOG.info("restart nimbus container" + ", cOntainerId="
+ containerStatus.getContainerId());
} else if (supervisorMap.containsKey(containerId)) {
Container supervisorCOntainer= supervisorMap.get(containerId);
cOntainerAsk= setupContainerAskForRM(supervisorContainer.getResource().getMemory(), supervisorContainer.getResource().getVirtualCores(), supervisorContainer.getPriority().getPriority(), supervisorContainer.getNodeId().getHost());
LOG.info("restart supervisor container" + ", cOntainerId="
+ containerStatus.getContainerId());

代码示例来源:origin: alibaba/jstorm

if (container.getPriority().getPriority() == 0)
jstormMasterContext.supervisorContainers.add(container);
else if (container.getPriority().getPriority() == 1) {
jstormMasterContext.nimbusContainers.add(container);

代码示例来源:origin: alibaba/jstorm

if (allocatedContainer.getPriority().getPriority() == 0) {

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public Priority getAllocatedPriority() {
return container.getPriority();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public Priority getAllocatedPriority() {
return container.getPriority();
}

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

@Override
public Priority getAllocatedPriority() {
return container.getPriority();
}

代码示例来源:origin: apache/incubator-slider

/**
* Map from a container to a role key by way of its priority
* @param container container
* @return role key
*/
public static int extractRole(Container container) {
Priority priority = container.getPriority();
return extractRole(priority);
}

代码示例来源:origin: org.apache.slider/slider-core

/**
* Map from a container to a role key by way of its priority
* @param container container
* @return role key
*/
public static int extractRole(Container container) {
Priority priority = container.getPriority();
return extractRole(priority);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public int compare(RMContainer a, RMContainer b) {
Comparator c = new org.apache.hadoop.yarn.server
.resourcemanager.resource.Priority.Comparator();
int priorityComp = c.compare(b.getContainer().getPriority(),
a.getContainer().getPriority());
if (priorityComp != 0) {
return priorityComp;
}
return b.getContainerId().compareTo(a.getContainerId());
}
});

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public int compare(RMContainer a, RMContainer b) {
Comparator c = new org.apache.hadoop.yarn.server
.resourcemanager.resource.Priority.Comparator();
int priorityComp = c.compare(b.getContainer().getPriority(),
a.getContainer().getPriority());
if (priorityComp != 0) {
return priorityComp;
}
return b.getContainerId().compareTo(a.getContainerId());
}
});

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public int compare(RMContainer c1, RMContainer c2) {
int ret = c1.getContainer().getPriority().compareTo(
c2.getContainer().getPriority());
if (ret == 0) {
return c2.getContainerId().compareTo(c1.getContainerId());
}
return ret;
}
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public int compare(RMContainer c1, RMContainer c2) {
int ret = c1.getContainer().getPriority().compareTo(
c2.getContainer().getPriority());
if (ret == 0) {
return c2.getContainerId().compareTo(c1.getContainerId());
}
return ret;
}
}

代码示例来源:origin: org.apache.slider/slider-core

public static String containerToString(Container container) {
if (cOntainer== null) {
return "null container";
}
return String.format(Locale.ENGLISH,
"COntainerID=%s nodeID=%s http=%s priority=%s resource=%s",
container.getId(),
container.getNodeId(),
container.getNodeHttpAddress(),
container.getPriority(),
container.getResource());
}

代码示例来源:origin: apache/incubator-slider

public static String containerToString(Container container) {
if (cOntainer== null) {
return "null container";
}
return String.format(Locale.ENGLISH,
"COntainerID=%s nodeID=%s http=%s priority=%s resource=%s",
container.getId(),
container.getNodeId(),
container.getNodeHttpAddress(),
container.getPriority(),
container.getResource());
}

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

public static Container getMockContainer(
ContainerId containerId, NodeId nodeId,
Resource resource, Priority priority) {
Container cOntainer= mock(Container.class);
when(container.getId()).thenReturn(containerId);
when(container.getNodeId()).thenReturn(nodeId);
when(container.getResource()).thenReturn(resource);
when(container.getPriority()).thenReturn(priority);
return container;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public static Container getMockContainer(
ContainerId containerId, NodeId nodeId,
Resource resource, Priority priority) {
Container cOntainer= mock(Container.class);
when(container.getId()).thenReturn(containerId);
when(container.getNodeId()).thenReturn(nodeId);
when(container.getResource()).thenReturn(resource);
when(container.getPriority()).thenReturn(priority);
return container;
}

推荐阅读
author-avatar
mobiledu2502925667
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有