List of usage examples for org.apache.hadoop.conf Configuration getBoolean
public boolean getBoolean(String name, boolean defaultValue)
name
property as a boolean
. From source file:it.crs4.pydoop.mapreduce.pipes.CommandLineParser.java
License:Apache License
/** * Check whether the job is using a Java Reducer. * @param conf the configuration to check * @return is it a Java Reducer?//from ww w .ja v a 2 s . c o m */ public static boolean getIsJavaReducer(Configuration conf) { return conf.getBoolean(Submitter.IS_JAVA_REDUCE, false); }
From source file:it.crs4.pydoop.mapreduce.pipes.CommandLineParser.java
License:Apache License
/** * Will the reduce use a Java RecordWriter? * @param conf the configuration to check * @return true, if the output of the job will be written by Java *///from w ww .j a v a 2s.c o m public static boolean getIsJavaRecordWriter(Configuration conf) { return conf.getBoolean(Submitter.IS_JAVA_RW, false); }
From source file:it.crs4.pydoop.mapreduce.pipes.CommandLineParser.java
License:Apache License
/** * Does the user want to keep the command file for debugging? If * this is true, pipes will write a copy of the command data to a * file in the task directory named "downlink.data", which may be * used to run the C++ program under the debugger. You probably also * want to set Configuration.setKeepFailedTaskFiles(true) to keep * the entire directory from being deleted. To run using the data * file, set the environment variable "mapreduce.pipes.commandfile" * to point to the file./* w w w . j a v a 2 s. com*/ * @param conf the configuration to check * @return will the framework save the command file? */ public static boolean getKeepCommandFile(Configuration conf) { return conf.getBoolean(Submitter.PRESERVE_COMMANDFILE, false); }
From source file:it.crs4.seal.demux.DemuxReducer.java
License:Open Source License
public void setup(String localSampleSheetPath, Configuration conf) throws IOException { // load the sample sheet Path path = new Path(localSampleSheetPath).makeQualified(FileSystem.getLocal(conf)); SampleSheet sampleSheet;//from w ww.ja v a 2 s . c o m try { sampleSheet = DemuxUtils.loadSampleSheet(path, conf); } catch (SampleSheet.FormatException e) { throw new RuntimeException("Error loading sample sheet. Message: " + e.getMessage()); } barcodeLookup = new BarcodeLookup(sampleSheet, conf.getInt(Demux.CONF_MAX_MISMATCHES, Demux.DEFAULT_MAX_MISMATCHES)); expectIndexRead = !conf.getBoolean(Demux.CONF_NO_INDEX_READS, false); separatesReads = conf.getBoolean(Demux.CONF_SEPARATE_READS, false); }
From source file:it.crs4.seal.prq.PrqOptionParser.java
License:Open Source License
@Override protected CommandLine parseOptions(Configuration conf, String[] args) throws IOException, ParseException { conf.setInt(MinBasesThresholdConfigName, DefaultMinBasesThreshold); conf.setBoolean(DropFailedFilterConfigName, DropFailedFilterDefault); conf.setBoolean(WarningOnlyIfUnpairedConfigName, WarningOnlyIfUnpairedDefault); conf.setInt(NumReadsExpectedConfigName, NumReadsExpectedDefault); CommandLine line = super.parseOptions(conf, args); /* **** handle deprected properties **** */ if (conf.get(PrqOptionParser.OLD_INPUT_FORMAT_CONF) != null) { throw new ParseException("The property " + PrqOptionParser.OLD_INPUT_FORMAT_CONF + " is no longer supported.\n" + "Please use the command line option --input-format instead."); }/* w ww. j a v a 2 s .co m*/ Utils.checkDeprecatedProp(conf, LOG, MinBasesThresholdConfigName_deprecated, MinBasesThresholdConfigName); Utils.checkDeprecatedProp(conf, LOG, DropFailedFilterConfigName_deprecated, DropFailedFilterConfigName); Utils.checkDeprecatedProp(conf, LOG, WarningOnlyIfUnpairedConfigName_deprecated, WarningOnlyIfUnpairedConfigName); // Let the deprecated properties override the new ones, unless the new ones have a non-default value. // If the new property has a non-default value, it must have been set by the user. // If, on the other hand, the deprecated property has a value, it must have been set by the user since // we're not setting them here. if (conf.get(MinBasesThresholdConfigName_deprecated) != null && conf.getInt(MinBasesThresholdConfigName, DefaultMinBasesThreshold) == DefaultMinBasesThreshold) { conf.setInt(MinBasesThresholdConfigName, conf.getInt(MinBasesThresholdConfigName_deprecated, DefaultMinBasesThreshold)); } if (conf.get(DropFailedFilterConfigName_deprecated) != null && conf.getBoolean(DropFailedFilterConfigName, DropFailedFilterDefault) == DropFailedFilterDefault) { conf.setBoolean(DropFailedFilterConfigName, conf.getBoolean(DropFailedFilterConfigName_deprecated, DropFailedFilterDefault)); } if (conf.get(WarningOnlyIfUnpairedConfigName_deprecated) != null && conf.getBoolean(WarningOnlyIfUnpairedConfigName, WarningOnlyIfUnpairedDefault) == WarningOnlyIfUnpairedDefault) { conf.setBoolean(WarningOnlyIfUnpairedConfigName, conf.getBoolean(WarningOnlyIfUnpairedConfigName_deprecated, WarningOnlyIfUnpairedDefault)); } /* **** end handle deprecated properties **** */ if (line.hasOption(opt_traditionalIds.getOpt())) conf.setBoolean(PairReadsQSeq.PRQ_CONF_TRADITIONAL_IDS, true); if (line.hasOption(opt_numReads.getOpt())) { int numReads; try { numReads = Integer.valueOf(line.getOptionValue(opt_numReads.getOpt())); if (numReads <= 0) throw new ParseException("Number of reads per fragment must be >= 0 (got " + numReads + ")"); if (numReads > 2) { throw new ParseException( "Working with more than two reads per template is not supported at the moment.\n" + "If you're interested in seeing this feature implemented contact the Seal developers."); } } catch (NumberFormatException e) { throw new ParseException(e.getMessage()); } conf.setInt(NumReadsExpectedConfigName, numReads); } // set number of reduce tasks to use conf.set(ClusterUtils.NUM_RED_TASKS_PROPERTY, String.valueOf(getNReduceTasks())); return line; }
From source file:it.crs4.seal.recab.RecabTableMapper.java
License:Open Source License
public void setup(VariantReader reader, IMRContext<Text, ObservationCount> context, Configuration conf) throws IOException { this.context = context; snps = new ArrayVariantTable(); LOG.info("Using " + snps.getClass().getName() + " snp table implementation."); LOG.info("loading known variation sites."); snps.load(reader);/*from ww w .j a v a 2s. c o m*/ if (LOG.isInfoEnabled()) LOG.info("loaded " + snps.size() + " known variation sites."); referenceCoordinates = new ArrayList<Integer>(200); referenceMatches = new ArrayList<Boolean>(200); // TODO: make it configurable covariateList = new ArrayList<Covariate>(5); covariateList.add(new ReadGroupCovariate(conf)); covariateList.add(new QualityCovariate()); covariateList.add(new CycleCovariate()); covariateList.add(new DinucCovariate()); // set counters for (BaseCounters c : BaseCounters.class.getEnumConstants()) context.increment(c, 0); for (ReadCounters c : ReadCounters.class.getEnumConstants()) context.increment(c, 0); skipKnownVariantPositions = conf.getBoolean(CONF_SKIP_KNOWN_VAR_SITES, true); if (!skipKnownVariantPositions) LOG.warn("Not skipping known variant sites. This is not recommended for regular usage."); }
From source file:kdp.jobcontrol.ControlledJob.java
License:Apache License
/** * Submit this job to mapred. The state becomes RUNNING if submission is * successful, FAILED otherwise./* w ww . j av a 2 s.c o m*/ */ protected synchronized void submit() { try { Configuration conf = job.getConfiguration(); if (conf.getBoolean(CREATE_DIR, false)) { FileSystem fs = FileSystem.get(conf); Path inputPaths[] = FileInputFormat.getInputPaths(job); for (int i = 0; i < inputPaths.length; i++) { if (!fs.exists(inputPaths[i])) { try { fs.mkdirs(inputPaths[i]); } catch (IOException e) { } } } } if (requiredCounters != null) { for (RequiredCounter counter : requiredCounters) { conf.set(counter.getPropertyName(), Long.toString(counter.getCounter())); } } job.submit(); this.state = State.RUNNING; } catch (Exception ioe) { this.state = State.FAILED; this.message = StringUtils.stringifyException(ioe); } }
From source file:kogiri.common.hadoop.io.format.fasta.FastaReadDescriptionInputFormat.java
License:Open Source License
public static boolean isSplitable(Configuration conf) { return conf.getBoolean(CONF_SPLITABLE, true); }
From source file:ldbc.snb.datagen.generator.CommentGenerator.java
public CommentGenerator(TextGenerator generator, LikeGenerator likeGenerator, Configuration conf) { this.generator = generator; this.likeGenerator_ = likeGenerator; this.comment_ = new Comment(); this.richRdf = conf.getBoolean("ldbc.snb.datagen.generator.richRdf", false); }
From source file:ldbc.snb.datagen.generator.DatagenParams.java
License:Open Source License
public static void readConf(Configuration conf) { try {//from w ww. j a va 2 s .co m ParameterNames values[] = ParameterNames.values(); for (int i = 0; i < values.length; ++i) { if (conf.get(values[i].toString()) == null) { throw new IllegalStateException("Missing " + values[i].toString() + " parameter"); } } cellSize = Short.parseShort(conf.get(ParameterNames.CELL_SIZE.toString())); numberOfCellPerWindow = Integer.parseInt(conf.get(ParameterNames.NUM_CELL_WINDOW.toString())); minNumFriends = Integer.parseInt(conf.get(ParameterNames.MIN_FRIENDS.toString())); maxNumFriends = Integer.parseInt(conf.get(ParameterNames.MAX_FRIENDS.toString())); friendRejectRatio = Double.parseDouble(conf.get(ParameterNames.FRIEND_REJECT.toString())); friendReApproveRatio = Double.parseDouble(conf.get(ParameterNames.FRIEND_REACCEPT.toString())); minNumTagsPerUser = Integer.parseInt(conf.get(ParameterNames.USER_MIN_TAGS.toString())); maxNumTagsPerUser = Integer.parseInt(conf.get(ParameterNames.USER_MAX_TAGS.toString())); maxNumPostPerMonth = Integer.parseInt(conf.get(ParameterNames.USER_MAX_POST_MONTH.toString())); maxNumComments = Integer.parseInt(conf.get(ParameterNames.MAX_COMMENT_POST.toString())); limitProCorrelated = Double.parseDouble(conf.get(ParameterNames.LIMIT_CORRELATED.toString())); baseProbCorrelated = Double.parseDouble(conf.get(ParameterNames.BASE_CORRELATED.toString())); maxEmails = Integer.parseInt(conf.get(ParameterNames.MAX_EMAIL.toString())); maxCompanies = Integer.parseInt(conf.get(ParameterNames.MAX_EMAIL.toString())); probEnglish = Double.parseDouble(conf.get(ParameterNames.MAX_EMAIL.toString())); probSecondLang = Double.parseDouble(conf.get(ParameterNames.MAX_EMAIL.toString())); probAnotherBrowser = Double.parseDouble(conf.get(ParameterNames.OTHER_BROWSER_RATIO.toString())); minTextSize = Integer.parseInt(conf.get(ParameterNames.MIN_TEXT_SIZE.toString())); maxTextSize = Integer.parseInt(conf.get(ParameterNames.MAX_TEXT_SIZE.toString())); minCommentSize = Integer.parseInt(conf.get(ParameterNames.MIN_COMMENT_SIZE.toString())); maxCommentSize = Integer.parseInt(conf.get(ParameterNames.MAX_COMMENT_SIZE.toString())); ratioReduceText = Double.parseDouble(conf.get(ParameterNames.REDUCE_TEXT_RATIO.toString())); minLargePostSize = Integer.parseInt(conf.get(ParameterNames.MIN_LARGE_POST_SIZE.toString())); maxLargePostSize = Integer.parseInt(conf.get(ParameterNames.MAX_LARGE_POST_SIZE.toString())); minLargeCommentSize = Integer.parseInt(conf.get(ParameterNames.MIN_LARGE_COMMENT_SIZE.toString())); maxLargeCommentSize = Integer.parseInt(conf.get(ParameterNames.MAX_LARGE_COMMENT_SIZE.toString())); ratioLargePost = Double.parseDouble(conf.get(ParameterNames.LARGE_POST_RATIO.toString())); ratioLargeComment = Double.parseDouble(conf.get(ParameterNames.LARGE_COMMENT_RATIO.toString())); maxNumLike = Integer.parseInt(conf.get(ParameterNames.MAX_NUM_LIKE.toString())); maxNumPhotoAlbumsPerMonth = Integer.parseInt(conf.get(ParameterNames.MAX_PHOTOALBUM.toString())); maxNumPhotoPerAlbums = Integer.parseInt(conf.get(ParameterNames.MAX_PHOTO_PER_ALBUM.toString())); maxNumGroupCreatedPerUser = Integer.parseInt(conf.get(ParameterNames.USER_MAX_GROUP.toString())); maxNumMemberGroup = Integer.parseInt(conf.get(ParameterNames.MAX_GROUP_MEMBERS.toString())); groupModeratorProb = Double.parseDouble(conf.get(ParameterNames.GROUP_MODERATOR_RATIO.toString())); maxNumGroupPostPerMonth = Integer.parseInt(conf.get(ParameterNames.GROUP_MAX_POST_MONTH.toString())); missingRatio = Double.parseDouble(conf.get(ParameterNames.MISSING_RATIO.toString())); missingStatusRatio = Double.parseDouble(conf.get(ParameterNames.STATUS_MISSING_RATIO.toString())); probSingleStatus = Double.parseDouble(conf.get(ParameterNames.STATUS_SINGLE_RATIO.toString())); probDiffIPinTravelSeason = Double .parseDouble(conf.get(ParameterNames.DIFFERENT_IP_IN_TRAVEL_RATIO.toString())); probDiffIPnotTravelSeason = Double .parseDouble(conf.get(ParameterNames.DIFFERENT_IP_NOT_TRAVEL_RATIO.toString())); probUnCorrelatedCompany = Double .parseDouble(conf.get(ParameterNames.COMPANY_UNCORRELATED_RATIO.toString())); probUnCorrelatedOrganization = Double .parseDouble(conf.get(ParameterNames.UNIVERSITY_UNCORRELATED_RATIO.toString())); probTopUniv = Double.parseDouble(conf.get(ParameterNames.BEST_UNIVERSTY_RATIO.toString())); maxNumPopularPlaces = Integer.parseInt(conf.get(ParameterNames.MAX_POPULAR_PLACES.toString())); probPopularPlaces = Double.parseDouble(conf.get(ParameterNames.POPULAR_PLACE_RATIO.toString())); tagCountryCorrProb = Double.parseDouble(conf.get(ParameterNames.TAG_UNCORRELATED_COUNTRY.toString())); flashmobTagsPerMonth = Integer.parseInt(conf.get(ParameterNames.FLASHMOB_TAGS_PER_MONTH.toString())); probInterestFlashmobTag = Double .parseDouble(conf.get(ParameterNames.PROB_INTEREST_FLASHMOB_TAG.toString())); probRandomPerLevel = Double.parseDouble(conf.get(ParameterNames.PROB_RANDOM_PER_LEVEL.toString())); maxNumFlashmobPostPerMonth = Integer .parseInt(conf.get(ParameterNames.MAX_NUM_FLASHMOB_POST_PER_MONTH.toString())); maxNumGroupFlashmobPostPerMonth = Integer .parseInt(conf.get(ParameterNames.MAX_NUM_GROUP_FLASHMOB_POST_PER_MONTH.toString())); maxNumTagPerFlashmobPost = Integer .parseInt(conf.get(ParameterNames.MAX_NUM_TAG_PER_FLASHMOB_POST.toString())); flashmobTagMinLevel = Double.parseDouble(conf.get(ParameterNames.FLASHMOB_TAG_MIN_LEVEL.toString())); flashmobTagMaxLevel = Double.parseDouble(conf.get(ParameterNames.FLASHMOB_TAG_MAX_LEVEL.toString())); flashmobTagDistExp = Double.parseDouble(conf.get(ParameterNames.FLASHMOB_TAG_DIST_EXP.toString())); updatePortion = Double.parseDouble(conf.get(ParameterNames.UPDATE_PORTION.toString())); blockSize = Integer.parseInt(conf.get(ParameterNames.BLOCK_SIZE.toString())); } catch (Exception e) { System.out.println("Error reading scale factors"); System.err.println(e.getMessage()); System.exit(-1); } try { numPersons = Integer.parseInt(conf.get("ldbc.snb.datagen.generator.numPersons")); startYear = Integer.parseInt(conf.get("ldbc.snb.datagen.generator.startYear")); numYears = Integer.parseInt(conf.get("ldbc.snb.datagen.generator.numYears")); endYear = startYear + numYears; compressed = conf.getBoolean("ldbc.snb.datagen.serializer.compressed", false); numThreads = conf.getInt("ldbc.snb.datagen.generator.numThreads", 1); updateStreams = conf.getBoolean("ldbc.snb.datagen.serializer.updateStreams", false); numPartitions = conf.getInt("ldbc.snb.datagen.serializer.numPartitions", 1); numUpdatePartitions = conf.getInt("ldbc.snb.datagen.serializer.numUpdatePartitions", 1); deltaTime = conf.getInt("ldbc.snb.datagen.generator.deltaTime", 10000); outputDir = conf.get("ldbc.snb.datagen.serializer.outputDir"); hadoopDir = outputDir + "/hadoop"; socialNetworkDir = outputDir + "social_network"; System.out.println(" ... Num Persons " + numPersons); System.out.println(" ... Start Year " + startYear); System.out.println(" ... Num Years " + numYears); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } }