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:boa.runtime.BoaCombiner.java
License:Apache License
/** {@inheritDoc} */ @Override/*www. j a v a2 s.com*/ public void setConf(final Configuration conf) { this.conf = conf; this.robust = conf.getBoolean("boa.runtime.robust", false); }
From source file:cascading.flow.hadoop.util.HadoopUtil.java
License:Open Source License
public static boolean isInflow(Configuration conf) { return conf.getBoolean(CASCADING_FLOW_EXECUTING, false); }
From source file:cascading.tap.hadoop.Hfs.java
License:Open Source License
protected static boolean getUseCombinedInput(Configuration conf) { String platform = conf.get("cascading.flow.platform", ""); boolean combineEnabled = conf.getBoolean("cascading.hadoop.hfs.combine.files", false); // only supported by these platforms if (platform.equals("hadoop") || platform.equals("hadoop2-mr1")) return combineEnabled; if (combineEnabled && !Boolean.getBoolean("cascading.hadoop.hfs.combine.files.warned")) { LOG.warn(/* w ww .j ava 2 s . c o m*/ "'cascading.hadoop.hfs.combine.files' has been set to true, but is unsupported by this platform: {}, will be ignored to prevent failures", platform); System.setProperty("cascading.hadoop.hfs.combine.files.warned", "true"); } return false; }
From source file:cascading.tap.hadoop.Hfs.java
License:Open Source License
protected static boolean getCombinedInputSafeMode(Configuration conf) { return conf.getBoolean("cascading.hadoop.hfs.combine.safemode", true); }
From source file:cascading.tap.hadoop.util.Hadoop18TapUtil.java
License:Open Source License
/** * should only be called if not in a Flow * * @param conf//from w ww. j a va 2s.co m * @throws IOException */ public static void setupJob(Configuration conf) throws IOException { Path outputPath = FileOutputFormat.getOutputPath(asJobConfInstance(conf)); if (outputPath == null) return; if (getFSSafe(conf, outputPath) == null) return; String taskID = conf.get("mapred.task.id", conf.get("mapreduce.task.id")); if (taskID == null) // need to stuff a fake id { String mapper = conf.getBoolean("mapred.task.is.map", conf.getBoolean("mapreduce.task.is.map", true)) ? "m" : "r"; String value = String.format("attempt_%012d_0000_%s_000000_0", (int) Math.rint(System.currentTimeMillis()), mapper); conf.set("mapred.task.id", value); conf.set("mapreduce.task.id", value); } makeTempPath(conf); if (writeDirectlyToWorkingPath(conf, outputPath)) { LOG.info("writing directly to output path: {}", outputPath); setWorkOutputPath(conf, outputPath); return; } // "mapred.work.output.dir" Path taskOutputPath = getTaskOutputPath(conf); setWorkOutputPath(conf, taskOutputPath); }
From source file:cascading.tap.hadoop.util.Hadoop18TapUtil.java
License:Open Source License
/** used in AWS EMR to disable temp paths on some file systems, s3. */ private static boolean writeDirectlyToWorkingPath(Configuration conf, Path path) { FileSystem fs = getFSSafe(conf, path); if (fs == null) return false; boolean result = conf.getBoolean("mapred.output.direct." + fs.getClass().getSimpleName(), false); if (result)/* w ww . j a va 2s . c o m*/ LOG.info("output direct is enabled for this fs: " + fs.getName()); return result; }
From source file:cascading.tuple.hadoop.util.HasherPartitioner.java
License:Open Source License
@Override public void setConf(Configuration conf) { if (this.conf != null) return;/*from w w w . jav a 2 s. co m*/ this.conf = conf; defaultComparator = TupleSerialization.getDefaultComparator(defaultComparator, conf); comparators = DeserializerComparator.getFieldComparatorsFrom(conf, "cascading.group.comparator"); if (conf.getBoolean(HASHER_PARTITIONER_USE_LEGACY_HASH, false)) this.hashFunction = new LegacyHashFunction(); initialize(defaultComparator, comparators); }
From source file:cloudbase.core.client.mapreduce.CloudbaseOutputFormatShim.java
License:Apache License
protected static boolean isMock(Configuration conf) { return conf.getBoolean(MOCK, false); }
From source file:clustering.inverted_index.InvertedIndexReducer.java
License:Apache License
@Override protected void setup(Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); int deci_num = conf.getInt("deci.number", 4); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("0."); for (int i = 0; i < deci_num; i++) { stringBuilder.append('0'); }/*from ww w .ja v a 2 s. c om*/ this.decimalFormat = new DecimalFormat(stringBuilder.toString()); this.pruning = conf.getBoolean("pruning", false); this.pruningThreshold = conf.getDouble("pruning.threshold", 0.001d); }
From source file:cmd.freebase2rdf4mr.java
License:Apache License
@Override public int run(String[] args) throws Exception { if (args.length != 2) { System.err.printf("Usage: %s [generic options] <input> <output>\n", getClass().getName()); ToolRunner.printGenericCommandUsage(System.err); return -1; }/*w w w .j av a 2 s . co m*/ Configuration configuration = getConf(); boolean overrideOutput = configuration.getBoolean(OPTION_OVERRIDE_OUTPUT, OPTION_OVERRIDE_OUTPUT_DEFAULT); FileSystem fs = FileSystem.get(new Path(args[1]).toUri(), configuration); if (overrideOutput) { fs.delete(new Path(args[1]), true); } Tool driver = new Freebase2RDFDriver(configuration); driver.run(new String[] { args[0], args[1] }); return 0; }