Package org.apache.hadoop.net
Class ScriptBasedMapping.RawScriptBasedMapping
java.lang.Object
org.apache.hadoop.net.AbstractDNSToSwitchMapping
org.apache.hadoop.net.ScriptBasedMapping.RawScriptBasedMapping
- All Implemented Interfaces:
Configurable,DNSToSwitchMapping
- Enclosing class:
- ScriptBasedMapping
This is the uncached script mapping that is fed into the cache managed
by the superclass
CachedDNSToSwitchMapping-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeclare that the mapper is single-switched if a script was not named in the configuration.voidReload all of the cached mappings.voidreloadCachedMappings(List<String> names) Reload cached mappings on specific nodes.Resolves a list of DNS-names/IP-addresses and returns back a list of switch information (network paths).protected StringrunResolveCommand(List<String> args, String commandScriptName) Build and execute the resolution command.voidsetConf(Configuration conf) Set the configuration and extract the configuration parameters of interesttoString()Methods inherited from class org.apache.hadoop.net.AbstractDNSToSwitchMapping
dumpTopology, getConf, getSwitchMap, isMappingSingleSwitch, isSingleSwitchByScriptPolicy
-
Constructor Details
-
RawScriptBasedMapping
public RawScriptBasedMapping()Constructor. The mapping is not ready to use untilsetConf(Configuration)has been called
-
-
Method Details
-
setConf
Set the configuration and extract the configuration parameters of interest- Specified by:
setConfin interfaceConfigurable- Overrides:
setConfin classAbstractDNSToSwitchMapping- Parameters:
conf- the new configuration
-
resolve
Description copied from interface:DNSToSwitchMappingResolves a list of DNS-names/IP-addresses and returns back a list of switch information (network paths). One-to-one correspondence must be maintained between the elements in the lists. Consider an element in the argument list - x.y.com. The switch information that is returned must be a network path of the form /foo/rack, where / is the root, and 'foo' is the switch where 'rack' is connected. Note the hostname/ip-address is not part of the returned path. The network topology of the cluster would determine the number of components in the network path.If a name cannot be resolved to a rack, the implementation should return
NetworkTopology.DEFAULT_RACK. This is what the bundled implementations do, though it is not a formal requirement- Parameters:
names- the list of hosts to resolve (can be empty)- Returns:
- list of resolved network paths. If names is empty, the returned list is also empty
-
runResolveCommand
Build and execute the resolution command. The command is executed in the directory specified by the system property "user.dir" if set; otherwise the current working directory is used.- Parameters:
args- a list of argumentscommandScriptName- input commandScriptName.- Returns:
- null if the number of arguments is out of range, or the output of the command.
-
isSingleSwitch
public boolean isSingleSwitch()Declare that the mapper is single-switched if a script was not named in the configuration.- Overrides:
isSingleSwitchin classAbstractDNSToSwitchMapping- Returns:
- true iff there is no script
-
toString
-
reloadCachedMappings
public void reloadCachedMappings()Description copied from interface:DNSToSwitchMappingReload all of the cached mappings. If there is a cache, this method will clear it, so that future accesses will get a chance to see the new data. -
reloadCachedMappings
Description copied from interface:DNSToSwitchMappingReload cached mappings on specific nodes. If there is a cache on these nodes, this method will clear it, so that future accesses will see updated data.- Parameters:
names- input names.
-