cascading.property.AppProps Java Examples
The following examples show how to use
cascading.property.AppProps.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigReader.java From aws-big-data-blog with Apache License 2.0 | 5 votes |
public Properties renderProperties(Object caller) throws IOException { Properties properties = new Properties(); String propFileName = "config.properties"; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName); if (inputStream != null) { properties.load(inputStream); AppProps.setApplicationJarClass(properties, caller.getClass()); } else { throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath"); } return properties; }
Example #2
Source File: JoinFilterExampleCascading.java From hadoop-arch-book with Apache License 2.0 | 4 votes |
public static void main(String[] args) { String fooInputPath = args[0]; String barInputPath = args[1]; String outputPath = args[2]; int fooValMax = Integer.parseInt(args[3]); int joinValMax = Integer.parseInt(args[4]); int numberOfReducers = Integer.parseInt(args[5]); Properties properties = new Properties(); AppProps.setApplicationJarClass(properties, JoinFilterExampleCascading.class); properties.setProperty("mapred.reduce.tasks", Integer.toString(numberOfReducers)); properties.setProperty("mapreduce.job.reduces", Integer.toString(numberOfReducers)); SpillableProps props = SpillableProps.spillableProps() .setCompressSpill( true ) .setMapSpillThreshold( 50 * 1000 ); HadoopFlowConnector flowConnector = new HadoopFlowConnector(properties); // create source and sink taps Fields fooFields = new Fields("fooId", "fooVal", "foobarId"); Tap fooTap = new Hfs(new TextDelimited(fooFields, "|"), fooInputPath); Fields barFields = new Fields("barId", "barVal"); Tap barTap = new Hfs(new TextDelimited(barFields, "|"), barInputPath); Tap outputTap = new Hfs(new TextDelimited(false, "|"), outputPath); Fields joinFooFields = new Fields("foobarId"); Fields joinBarFields = new Fields("barId"); Pipe fooPipe = new Pipe("fooPipe"); Pipe barPipe = new Pipe("barPipe"); Pipe fooFiltered = new Each(fooPipe, fooFields, new FooFilter(fooValMax)); Pipe joinedPipe = new HashJoin(fooFiltered, joinFooFields, barPipe, joinBarFields); props.setProperties( joinedPipe.getConfigDef(), Mode.REPLACE ); Fields joinFields = new Fields("fooId", "fooVal", "foobarId", "barVal"); Pipe joinedFilteredPipe = new Each(joinedPipe, joinFields, new JoinedFilter(joinValMax)); FlowDef flowDef = FlowDef.flowDef().setName("wc") .addSource(fooPipe, fooTap).addSource(barPipe, barTap) .addTailSink(joinedFilteredPipe, outputTap); Flow wcFlow = flowConnector.connect(flowDef); wcFlow.writeDOT("dot/wc.dot"); wcFlow.complete(); }