ResourceManager command-line parsing section

Source: Internet
Author: User

Org.apache.hadoop.util.GenericOptionsParser Mark

The main parsing command line to the RM parameters, there is no good analysis of the use of the Hadoop CLI tool, the command tool parameters set to the Yarnconfiguration

/**
* Modify configuration according user-specified generic options
* @param conf Configuration to be modified
* @param line user-specified generic options
*/
private void Processgeneraloptions (Configuration conf,
CommandLine line) throws IOException {
if (line.hasoption ("FS")) {
Filesystem.setdefaulturi (conf, Line.getoptionvalue ("FS"));
}

if (line.hasoption ("JT")) {
String OptionValue = Line.getoptionvalue ("JT");
if (Optionvalue.equalsignorecase ("local")) {
Conf.set ("Mapreduce.framework.name", OptionValue);
}

Conf.set ("Yarn.resourcemanager.address", OptionValue,
"FROM-JT command line option");
}
if (line.hasoption ("conf")) {
String[] values = line.getoptionvalues ("conf");
for (String value:values) {
Conf.addresource (new Path (value));
}
}

if (line.hasoption (' D ')) {
String[] Property = Line.getoptionvalues (' D ');
for (String Prop:property) {
string[] Keyval = prop.split ("=", 2);
if (keyval.length = = 2) {
Conf.set (Keyval[0], keyval[1], "from command line");
}
}
}

if (Line.hasoption ("Libjars")) {
Conf.set ("Tmpjars",
Validatefiles (Line.getoptionvalue ("Libjars"), conf),
"From-libjars command line option");
Setting Libjars in Client Classpath
url[] Libjars = getlibjars (conf);
if (libjars!=null && libjars.length>0) {
Conf.setclassloader (New URLClassLoader (Libjars, Conf.getclassloader ()));
Thread.CurrentThread (). Setcontextclassloader (
New URLClassLoader (Libjars,
Thread.CurrentThread (). Getcontextclassloader ());
}
}
if (line.hasoption ("files")) {
Conf.set ("Tmpfiles",
Validatefiles (Line.getoptionvalue ("Files"), conf),
"From-files command line option");
}
if (line.hasoption ("Archives")) {
Conf.set ("Tmparchives",
Validatefiles (Line.getoptionvalue ("Archives"), conf),
"From-archives command line option");
}
Conf.setboolean ("mapreduce.client.genericoptionsparser.used", true);

Tokensfile
if (line.hasoption ("Tokencachefile")) {
String fileName = Line.getoptionvalue ("Tokencachefile");
Check if the local file exists
FileSystem Localfs = filesystem.getlocal (conf);
Path p = localfs.makequalified (New path (fileName));
if (!localfs.exists (p)) {
throw new FileNotFoundException ("File" +filename+ "does not exist.");
}
if (log.isdebugenabled ()) {
Log.debug ("Setting conf tokensfile:" + fileName);
}
Usergroupinformation.getcurrentuser (). Addcredentials (
Credentials.readtokenstoragefile (P, conf));
Conf.set ("Mapreduce.job.credentials.binary", p.tostring (),
"From-tokencachefile command line option");

}
}

ResourceManager command-line parsing section

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.