msg("cmd=" + cmd);
return cmd;
}
void parseArgv(){
CommandLine cmdLine = null;
try{
cmdLine = parser.parse(allOptions, argv_);
}catch(Exception oe){
LOG.error(oe.getMessage());
exitUsage(argv_.length > 0 && "-info".equals(argv_[0]));
}
if (cmdLine != null){
verbose_ = cmdLine.hasOption("verbose");
detailedUsage_ = cmdLine.hasOption("info");
debug_ = cmdLine.hasOption("debug")? debug_ + 1 : debug_;
String[] values = cmdLine.getOptionValues("input");
if (values != null && values.length > 0) {
for (String input : values) {
inputSpecs_.add(input);
}
}
output_ = (String) cmdLine.getOptionValue("output");
mapCmd_ = (String)cmdLine.getOptionValue("mapper");
comCmd_ = (String)cmdLine.getOptionValue("combiner");
redCmd_ = (String)cmdLine.getOptionValue("reducer");
values = cmdLine.getOptionValues("file");
if (values != null && values.length > 0) {
StringBuilder unpackRegex = new StringBuilder(
config_.getPattern(JobContext.JAR_UNPACK_PATTERN,
JobConf.UNPACK_JAR_PATTERN_DEFAULT).pattern());
for (String file : values) {
packageFiles_.add(file);
String fname = new File(file).getName();
unpackRegex.append("|(?:").append(Pattern.quote(fname)).append(")");
}
config_.setPattern(JobContext.JAR_UNPACK_PATTERN,
Pattern.compile(unpackRegex.toString()));
validate(packageFiles_);
}
String fsName = (String)cmdLine.getOptionValue("dfs");
if (null != fsName){
LOG.warn("-dfs option is deprecated, please use -fs instead.");
config_.set("fs.default.name", fsName);
}
additionalConfSpec_ = (String)cmdLine.getOptionValue("additionalconfspec");
inputFormatSpec_ = (String)cmdLine.getOptionValue("inputformat");
outputFormatSpec_ = (String)cmdLine.getOptionValue("outputformat");
numReduceTasksSpec_ = (String)cmdLine.getOptionValue("numReduceTasks");
partitionerSpec_ = (String)cmdLine.getOptionValue("partitioner");
inReaderSpec_ = (String)cmdLine.getOptionValue("inputreader");
mapDebugSpec_ = (String)cmdLine.getOptionValue("mapdebug");
reduceDebugSpec_ = (String)cmdLine.getOptionValue("reducedebug");
ioSpec_ = (String)cmdLine.getOptionValue("io");
String[] car = cmdLine.getOptionValues("cacheArchive");
if (null != car && car.length > 0){
LOG.warn("-cacheArchive option is deprecated, please use -archives instead.");
for(String s : car){
cacheArchives = (cacheArchives == null)?s :cacheArchives + "," + s;
}
}
String[] caf = cmdLine.getOptionValues("cacheFile");
if (null != caf && caf.length > 0){
LOG.warn("-cacheFile option is deprecated, please use -files instead.");
for(String s : caf){
cacheFiles = (cacheFiles == null)?s :cacheFiles + "," + s;
}
}
String[] jobconf = cmdLine.getOptionValues("jobconf");
if (null != jobconf && jobconf.length > 0){
LOG.warn("-jobconf option is deprecated, please use -D instead.");
for(String s : jobconf){
String []parts = s.split("=", 2);
config_.set(parts[0], parts[1]);
}
}
String[] cmd = cmdLine.getOptionValues("cmdenv");
if (null != cmd && cmd.length > 0){
for(String s : cmd) {
if (addTaskEnvironment_.length() > 0) {
addTaskEnvironment_ += " ";
}