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

org.apache.hadoop.yarn.util.RackResolver类的使用及代码示例

本文整理了Java中org.apache.hadoop.yarn.util.RackResolver类的一些代码示例,展示了RackResolver

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

RackResolver介绍

暂无

代码示例

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

@Override
protected void serviceInit(Configuration conf) throws Exception {
RackResolver.init(conf);
super.serviceInit(conf);
}

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

/**
* resolving the network topology.
* @param hostName the hostname of this node.
* @return the resolved {@link Node} for this nodemanager.
*/
public static Node resolve(String hostName) {
return RackResolver.resolve(hostName);
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method initializes the class with the
* right resolver implementation.
* @param conf
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(Configuration conf, String hostName) {
init(conf);
return coreResolve(hostName);
}

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

@Test
public void testCaching() {
Configuration cOnf= new Configuration();
conf.setClass(
CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
MyResolver.class, DNSToSwitchMapping.class);
RackResolver.init(conf);
try {
InetAddress iaddr = InetAddress.getByName("host1");
MyResolver.resolvedHost1 = iaddr.getHostAddress();
} catch (UnknownHostException e) {
// Ignore if not found
}
Node node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve(invalidHost);
Assert.assertEquals(NetworkTopology.DEFAULT_RACK, node.getNetworkLocation());
}

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

@Test
public void testScriptName() {
Configuration cOnf= new Configuration();
conf
.setClass(
CommonConfigurationKeysPublic.
NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
ScriptBasedMapping.class, DNSToSwitchMapping.class);
conf.set(CommonConfigurationKeysPublic.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
"testScript");
RackResolver.init(conf);
Assert.assertEquals(RackResolver.getDnsToSwitchMapping().toString(),
"script-based mapping with script testScript");
}
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method doesn't initialize the class.
* Call {@link #init(Configuration)} explicitly.
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(String hostName) {
if (!initCalled) {
throw new IllegalStateException("RackResolver class not yet initialized");
}
return coreResolve(hostName);
}

代码示例来源:origin: org.apache.tez/tez-mapreduce

RackResolver.init(conf);
Map locToRackMap = new HashMap(distinctLocations.size());
Map rackLocatiOns= createLocationsMap(conf);
String rack = emptyLocation;
if (location != emptyLocation) {
rack = RackResolver.resolve(location).getNetworkLocation();

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

@Test
public void testScriptName() {
Configuration cOnf= new Configuration();
conf
.setClass(
CommonConfigurationKeysPublic.
NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
ScriptBasedMapping.class, DNSToSwitchMapping.class);
conf.set(CommonConfigurationKeysPublic.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
"testScript");
RackResolver.init(conf);
Assert.assertEquals(RackResolver.getDnsToSwitchMapping().toString(),
"script-based mapping with script testScript");
}
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method doesn't initialize the class.
* Call {@link #init(Configuration)} explicitly.
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(String hostName) {
if (!initCalled) {
throw new IllegalStateException("RackResolver class not yet initialized");
}
return coreResolve(hostName);
}

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test
public void testCaching() {
Configuration cOnf= new Configuration();
conf.setClass(
CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
MyResolver.class, DNSToSwitchMapping.class);
RackResolver.init(conf);
try {
InetAddress iaddr = InetAddress.getByName("host1");
MyResolver.resolvedHost1 = iaddr.getHostAddress();
} catch (UnknownHostException e) {
// Ignore if not found
}
Node node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve(invalidHost);
Assert.assertEquals(NetworkTopology.DEFAULT_RACK, node.getNetworkLocation());
}

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

/**
* resolving the network topology.
* @param hostName the hostname of this node.
* @return the resolved {@link Node} for this nodemanager.
*/
public static Node resolve(String hostName) {
return RackResolver.resolve(hostName);
}

代码示例来源:origin: io.hops/hadoop-yarn-client

@Override
protected void serviceInit(Configuration conf) throws Exception {
RackResolver.init(conf);
super.serviceInit(conf);
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method initializes the class with the
* right resolver implementation.
* @param conf
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(Configuration conf, String hostName) {
init(conf);
return coreResolve(hostName);
}

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test
public void testScriptName() {
Configuration cOnf= new Configuration();
conf
.setClass(
CommonConfigurationKeysPublic.
NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
ScriptBasedMapping.class, DNSToSwitchMapping.class);
conf.set(CommonConfigurationKeysPublic.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
"testScript");
RackResolver.init(conf);
Assert.assertEquals(RackResolver.getDnsToSwitchMapping().toString(),
"script-based mapping with script testScript");
}
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method doesn't initialize the class.
* Call {@link #init(Configuration)} explicitly.
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(String hostName) {
if (!initCalled) {
throw new IllegalStateException("RackResolver class not yet initialized");
}
return coreResolve(hostName);
}

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

@Test
public void testCaching() {
Configuration cOnf= new Configuration();
conf.setClass(
CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
MyResolver.class, DNSToSwitchMapping.class);
RackResolver.init(conf);
try {
InetAddress iaddr = InetAddress.getByName("host1");
MyResolver.resolvedHost1 = iaddr.getHostAddress();
} catch (UnknownHostException e) {
// Ignore if not found
}
Node node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve("host1");
Assert.assertEquals("/rack1", node.getNetworkLocation());
node = RackResolver.resolve(invalidHost);
Assert.assertEquals(NetworkTopology.DEFAULT_RACK, node.getNetworkLocation());
}

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

/**
* resolving the network topology.
* @param hostName the hostname of this node.
* @return the resolved {@link Node} for this nodemanager.
*/
public static Node resolve(String hostName) {
return RackResolver.resolve(hostName);
}

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

@Override
protected void serviceInit(Configuration conf) throws Exception {
RackResolver.init(conf);
super.serviceInit(conf);
}

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

/**
* Utility method for getting a hostname resolved to a node in the
* network topology. This method initializes the class with the
* right resolver implementation.
* @param conf
* @param hostName
* @return node {@link Node} after resolving the hostname
*/
public static Node resolve(Configuration conf, String hostName) {
init(conf);
return coreResolve(hostName);
}

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

RackResolver.init(conf);
this.dataLocalRacks = new HashSet();
for (String host : this.dataLocalHosts) {
this.dataLocalRacks.add(RackResolver.resolve(host).getNetworkLocation());

推荐阅读
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文介绍了Java高并发程序设计中线程安全的概念与synchronized关键字的使用。通过一个计数器的例子,演示了多线程同时对变量进行累加操作时可能出现的问题。最终值会小于预期的原因是因为两个线程同时对变量进行写入时,其中一个线程的结果会覆盖另一个线程的结果。为了解决这个问题,可以使用synchronized关键字来保证线程安全。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
  • 本文整理了Java中org.apache.solr.common.SolrDocument.setField()方法的一些代码示例,展示了SolrDocum ... [详细]
  • 图像因存在错误而无法显示 ... [详细]
  • 代理模式的详细介绍及应用场景
    代理模式是一种在软件开发中常用的设计模式,通过在客户端和目标对象之间增加一层中间层,让代理对象代替目标对象进行访问,从而简化系统的复杂性。代理模式可以根据不同的使用目的分为远程代理、虚拟代理、Copy-on-Write代理、保护代理、防火墙代理、智能引用代理和Cache代理等几种。本文将详细介绍代理模式的原理和应用场景。 ... [详细]
author-avatar
321
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有