List of usage examples for org.apache.hadoop.mapred JobConf setCompressMapOutput
public void setCompressMapOutput(boolean compress)
From source file:org.sf.xrime.algorithms.partitions.connected.strongly.ForwardTrimPartB.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, ForwardTrimPartB.class); conf.setJobName("ForwardTrimPartB"); // the keys are vertex identifiers (strings) conf.setOutputKeyClass(Text.class); // the values are vertexes (Writable) conf.setOutputValueClass(LabeledAdjBiSetVertex.class); conf.setMapperClass(MapClass.class); // No combiner is permitted. conf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. conf.setInputFormat(SequenceFileInputFormat.class); conf.setOutputFormat(SequenceFileOutputFormat.class); try {//from www .j a va 2 s . c o m FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); conf.setNumReduceTasks(getReducerNum()); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.partitions.connected.strongly.LabelPropagation.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, LabelPropagation.class); conf.setJobName("LabelPropagation"); // the keys are vertex identifiers (strings) conf.setOutputKeyClass(Text.class); // the values are adjacent vertexes with labels (Writable) conf.setOutputValueClass(LabeledAdjBiSetVertex.class); conf.setMapperClass(MapClass.class); conf.setCombinerClass(ReduceClass.class); conf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. conf.setInputFormat(SequenceFileInputFormat.class); conf.setOutputFormat(SequenceFileOutputFormat.class); try {// ww w . java 2s. co m FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); conf.setNumReduceTasks(getReducerNum()); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.partitions.connected.strongly.PivotChoose.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, PivotChoose.class); conf.setJobName("PivotChoose"); // This is necessary. conf.setMapOutputKeyClass(Text.class); conf.setMapOutputValueClass(LabeledAdjBiSetVertex.class); // the keys are a pseudo one. conf.setOutputKeyClass(Text.class); // the values are chosen vertex id. conf.setOutputValueClass(Text.class); conf.setMapperClass(MapClass.class); // Since k2,v2 is different from k3,v3. No combiner is permitted. conf.setReducerClass(ReduceClass.class); // The format of input data is generated with WritableSerialization. conf.setInputFormat(SequenceFileInputFormat.class); try {/*from w w w . jav a2 s. c om*/ FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); // Only one reducer is permitted, or the largest value will be wrong. conf.setNumReduceTasks(1); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.partitions.connected.weakly.alg_2.VertexLabelPropagation.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, VertexLabelPropagation.class); conf.setJobName("VertexLabelPropagation"); // the keys are vertex identifiers (strings) conf.setOutputKeyClass(Text.class); // the values are adjacent vertexes with labels (Writable) conf.setOutputValueClass(LabeledAdjSetVertex.class); // mapper, combiner, reducer, all show up. conf.setMapperClass(MapClass.class); conf.setCombinerClass(CombineClass.class); conf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. conf.setInputFormat(SequenceFileInputFormat.class); conf.setOutputFormat(SequenceFileOutputFormat.class); // Enable compression. conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try {/*from w w w .j a va 2 s. co m*/ FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); conf.setNumReduceTasks(getReducerNum()); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.partitions.connected.weakly.alg_2.VertexSetSummarize.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, VertexSetSummarize.class); conf.setJobName("VertexSetSummarize"); // the keys are vertex labels (strings) conf.setOutputKeyClass(Text.class); // the values are vertex sets (Writable) conf.setOutputValueClass(VertexSet.class); conf.setMapperClass(MapClass.class); conf.setCombinerClass(ReduceClass.class); conf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. conf.setInputFormat(SequenceFileInputFormat.class); conf.setOutputFormat(SequenceFileOutputFormat.class); // Enable compression. conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try {//from w w w . j a v a 2 s . c o m FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); conf.setNumReduceTasks(getReducerNum()); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.statistics.AverageVertexDegree.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, AverageVertexDegree.class); conf.setJobName("AverageDegree"); // the keys are a pseudo one ("Average_Degree") conf.setOutputKeyClass(Text.class); // the values are degrees (ints) conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(MapClass.class); // No combiner is permitted. conf.setReducerClass(ReduceClass.class); // The format of input data is generated with WritableSerialization. conf.setInputFormat(SequenceFileInputFormat.class); try {//from w w w . j a va 2 s. c o m FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); // Only one reducer is permitted, or the average value will be wrong. conf.setNumReduceTasks(1); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.statistics.LargestLabeledSetWithLabelDegree.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, LargestLabeledSetWithLabelDegree.class); conf.setJobName("LargestLabeledSetWithLabelDegree"); // the keys are a pseudo one ("Largest_Degree") conf.setOutputKeyClass(Text.class); // the values are degrees (ints) conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(MapClass.class); conf.setCombinerClass(ReduceClass.class); conf.setReducerClass(ReduceClass.class); // The format of input data is generated with WritableSerialization. conf.setInputFormat(SequenceFileInputFormat.class); try {/* w w w. j ava2s.c o m*/ FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); // Only one reducer is permitted, or the largest value will be wrong. conf.setNumReduceTasks(1); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.statistics.LargestVertexDegree.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf conf = new JobConf(context, LargestVertexDegree.class); conf.setJobName("LargestDegree"); // the keys are a pseudo one ("Largest_Degree") conf.setOutputKeyClass(Text.class); // the values are degrees (ints) conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(MapClass.class); conf.setCombinerClass(ReduceClass.class); conf.setReducerClass(ReduceClass.class); // The format of input data is generated with WritableSerialization. conf.setInputFormat(SequenceFileInputFormat.class); try {//from w w w . ja v a 2s . com FileInputFormat.setInputPaths(conf, getSource().getPath()); FileOutputFormat.setOutputPath(conf, getDestination().getPath()); } catch (IllegalAccessException e1) { throw new ProcessorExecutionException(e1); } conf.setNumMapTasks(getMapperNum()); // Only one reducer is permitted, or the largest value will be wrong. conf.setNumReduceTasks(1); conf.setCompressMapOutput(true); conf.setMapOutputCompressorClass(GzipCodec.class); try { this.runningJob = JobClient.runJob(conf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.statistics.ViewAdjSetVertexWithLabelDegree.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf jobConf = new JobConf(conf, ViewAdjSetVertexWithLabelDegree.class); jobConf.setJobName("ViewAdjSetVertexWithLabelDegree"); // the keys are vertex identifiers (strings) jobConf.setOutputKeyClass(Text.class); // the values are adjacent vertexes with labels (Writable) jobConf.setOutputValueClass(Text.class); jobConf.setMapperClass(MapClass.class); // no combiner is needed. // jobConf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. jobConf.setInputFormat(SequenceFileInputFormat.class); jobConf.setOutputFormat(SequenceFileOutputFormat.class); // Enable compression. jobConf.setCompressMapOutput(true); jobConf.setMapOutputCompressorClass(GzipCodec.class); FileInputFormat.setInputPaths(jobConf, srcPath); FileOutputFormat.setOutputPath(jobConf, destPath); jobConf.setNumMapTasks(mapperNum);/* w w w .ja v a 2 s.c o m*/ jobConf.setNumReduceTasks(reducerNum); try { this.runningJob = JobClient.runJob(jobConf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }
From source file:org.sf.xrime.algorithms.statistics.ViewLabeledSetWithLabelDegree.java
License:Apache License
@Override public void execute() throws ProcessorExecutionException { JobConf jobConf = new JobConf(conf, ViewLabeledSetWithLabelDegree.class); jobConf.setJobName("ViewLabeledSetWithLabelDegree"); // the keys are vertex identifiers (strings) jobConf.setOutputKeyClass(Text.class); // the values are adjacent vertexes with labels (Writable) jobConf.setOutputValueClass(Text.class); jobConf.setMapperClass(MapClass.class); // no combiner is needed. // jobConf.setReducerClass(ReduceClass.class); // makes the file format suitable for machine processing. jobConf.setInputFormat(SequenceFileInputFormat.class); jobConf.setOutputFormat(SequenceFileOutputFormat.class); // Enable compression. jobConf.setCompressMapOutput(true); jobConf.setMapOutputCompressorClass(GzipCodec.class); FileInputFormat.setInputPaths(jobConf, srcPath); FileOutputFormat.setOutputPath(jobConf, destPath); jobConf.setNumMapTasks(mapperNum);/*ww w . jav a 2 s . c o m*/ jobConf.setNumReduceTasks(1); try { this.runningJob = JobClient.runJob(jobConf); } catch (IOException e) { throw new ProcessorExecutionException(e); } }