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