@Test public void testRunVersion() throws Exception { assertEquals(0, new HalyardSummary().run(new String[]{"-v"})); }
@Override public int run(CommandLine cmd) throws Exception { String source = cmd.getOptionValue('s'); String target = cmd.getOptionValue('t'); TableMapReduceUtil.addDependencyJars(getConf(), HalyardExport.class, Rio.class, AbstractRDFHandler.class, RDFFormat.class, RDFParser.class, HTable.class, HBaseConfiguration.class, AuthenticationProtos.class, Trace.class, Gauge.class); HBaseConfiguration.addHbaseResources(getConf()); Job job = Job.getInstance(getConf(), "HalyardSummary " + source + (target == null ? " update" : " -> " + target)); job.getConfiguration().set(SOURCE, source); if (target != null) job.getConfiguration().set(TARGET, target); if (cmd.hasOption('g')) job.getConfiguration().set(TARGET_GRAPH, cmd.getOptionValue('g')); if (cmd.hasOption('d')) job.getConfiguration().setInt(DECIMATION_FACTOR, Integer.parseInt(cmd.getOptionValue('d'))); job.setJarByClass(HalyardSummary.class); TableMapReduceUtil.initCredentials(job); Scan scan = HalyardTableUtils.scan(new byte[]{HalyardTableUtils.POS_PREFIX}, new byte[]{HalyardTableUtils.POS_PREFIX + 1}); TableMapReduceUtil.initTableMapperJob(source, scan, SummaryMapper.class, ImmutableBytesWritable.class, LongWritable.class, job); job.setNumReduceTasks(1); job.setCombinerClass(SummaryCombiner.class); job.setReducerClass(SummaryReducer.class); job.setOutputFormatClass(NullOutputFormat.class); if (job.waitForCompletion(true)) { LOG.info("Summary Generation Completed.."); return 0; } return -1; }
HalyardSummary extends AbstractHalyardTool { @Override public int run(CommandLine cmd) throws Exception { String source = cmd.getOptionValue('s'); String target = cmd.getOptionValue('t'); TableMapReduceUtil.addDependencyJars(getConf(), HalyardExport.class, Rio.class, AbstractRDFHandler.class, RDFFormat.class, RDFParser.class, HTable.class, HBaseConfiguration.class, AuthenticationProtos.class, Trace.class, Gauge.class); HBaseConfiguration.addHbaseResources(getConf()); Job job = Job.getInstance(getConf(), "HalyardSummary " + source + (target == null ? " update" : " -> " + target)); job.getConfiguration().set(SOURCE, source); if (target != null) job.getConfiguration().set(TARGET, target); if (cmd.hasOption('g')) job.getConfiguration().set(TARGET_GRAPH, cmd.getOptionValue('g')); if (cmd.hasOption('d')) job.getConfiguration().setInt(DECIMATION_FACTOR, Integer.parseInt(cmd.getOptionValue('d'))); job.setJarByClass(HalyardSummary.class); TableMapReduceUtil.initCredentials(job); Scan scan = HalyardTableUtils.scan(new byte[]{HalyardTableUtils.POS_PREFIX}, new byte[]{HalyardTableUtils.POS_PREFIX + 1}); TableMapReduceUtil.initTableMapperJob(source, scan, SummaryMapper.class, ImmutableBytesWritable.class, LongWritable.class, job); job.setNumReduceTasks(1); job.setCombinerClass(SummaryCombiner.class); job.setReducerClass(SummaryReducer.class); job.setOutputFormatClass(NullOutputFormat.class); if (job.waitForCompletion(true)) { LOG.info("Summary Generation Completed.."); return 0; } return -1; } }
HalyardSummary extends AbstractHalyardTool { @Override public int run(CommandLine cmd) throws Exception { String source = cmd.getOptionValue('s'); String target = cmd.getOptionValue('t'); TableMapReduceUtil.addDependencyJars(getConf(), HalyardExport.class, Rio.class, AbstractRDFHandler.class, RDFFormat.class, RDFParser.class, HTable.class, HBaseConfiguration.class, AuthenticationProtos.class, Trace.class, Gauge.class); HBaseConfiguration.addHbaseResources(getConf()); Job job = Job.getInstance(getConf(), "HalyardSummary " + source + (target == null ? " update" : " -> " + target)); job.getConfiguration().set(SOURCE, source); if (target != null) job.getConfiguration().set(TARGET, target); if (cmd.hasOption('g')) job.getConfiguration().set(TARGET_GRAPH, cmd.getOptionValue('g')); if (cmd.hasOption('d')) job.getConfiguration().setInt(DECIMATION_FACTOR, Integer.parseInt(cmd.getOptionValue('d'))); job.setJarByClass(HalyardSummary.class); TableMapReduceUtil.initCredentials(job); Scan scan = HalyardTableUtils.scan(new byte[]{HalyardTableUtils.POS_PREFIX}, new byte[]{HalyardTableUtils.POS_PREFIX + 1}); TableMapReduceUtil.initTableMapperJob(source, scan, SummaryMapper.class, ImmutableBytesWritable.class, LongWritable.class, job); job.setNumReduceTasks(1); job.setCombinerClass(SummaryCombiner.class); job.setReducerClass(SummaryReducer.class); job.setOutputFormatClass(NullOutputFormat.class); if (job.waitForCompletion(true)) { LOG.info("Summary Generation Completed.."); return 0; } return -1; } HalyardSummary(); }
HalyardSummary extends AbstractHalyardTool { @Override public int run(CommandLine cmd) throws Exception { String source = cmd.getOptionValue('s'); String target = cmd.getOptionValue('t'); TableMapReduceUtil.addDependencyJars(getConf(), HalyardExport.class, Rio.class, AbstractRDFHandler.class, RDFFormat.class, RDFParser.class, HTable.class, HBaseConfiguration.class, AuthenticationProtos.class, Trace.class, Gauge.class); HBaseConfiguration.addHbaseResources(getConf()); Job job = Job.getInstance(getConf(), "HalyardSummary " + source + (target == null ? " update" : " -> " + target)); job.getConfiguration().set(SOURCE, source); if (target != null) job.getConfiguration().set(TARGET, target); if (cmd.hasOption('g')) job.getConfiguration().set(TARGET_GRAPH, cmd.getOptionValue('g')); if (cmd.hasOption('d')) job.getConfiguration().setInt(DECIMATION_FACTOR, Integer.parseInt(cmd.getOptionValue('d'))); job.setJarByClass(HalyardSummary.class); TableMapReduceUtil.initCredentials(job); Scan scan = HalyardTableUtils.scan(new byte[]{HalyardTableUtils.POS_PREFIX}, new byte[]{HalyardTableUtils.POS_PREFIX + 1}); TableMapReduceUtil.initTableMapperJob(source, scan, SummaryMapper.class, ImmutableBytesWritable.class, LongWritable.class, job); job.setNumReduceTasks(1); job.setCombinerClass(SummaryCombiner.class); job.setReducerClass(SummaryReducer.class); job.setOutputFormatClass(NullOutputFormat.class); if (job.waitForCompletion(true)) { LOG.info("Summary Generation Completed.."); return 0; } return -1; } HalyardSummary(); @Override int run(CommandLine cmd); }
HalyardSummary extends AbstractHalyardTool { @Override public int run(CommandLine cmd) throws Exception { String source = cmd.getOptionValue('s'); String target = cmd.getOptionValue('t'); TableMapReduceUtil.addDependencyJars(getConf(), HalyardExport.class, Rio.class, AbstractRDFHandler.class, RDFFormat.class, RDFParser.class, HTable.class, HBaseConfiguration.class, AuthenticationProtos.class, Trace.class, Gauge.class); HBaseConfiguration.addHbaseResources(getConf()); Job job = Job.getInstance(getConf(), "HalyardSummary " + source + (target == null ? " update" : " -> " + target)); job.getConfiguration().set(SOURCE, source); if (target != null) job.getConfiguration().set(TARGET, target); if (cmd.hasOption('g')) job.getConfiguration().set(TARGET_GRAPH, cmd.getOptionValue('g')); if (cmd.hasOption('d')) job.getConfiguration().setInt(DECIMATION_FACTOR, Integer.parseInt(cmd.getOptionValue('d'))); job.setJarByClass(HalyardSummary.class); TableMapReduceUtil.initCredentials(job); Scan scan = HalyardTableUtils.scan(new byte[]{HalyardTableUtils.POS_PREFIX}, new byte[]{HalyardTableUtils.POS_PREFIX + 1}); TableMapReduceUtil.initTableMapperJob(source, scan, SummaryMapper.class, ImmutableBytesWritable.class, LongWritable.class, job); job.setNumReduceTasks(1); job.setCombinerClass(SummaryCombiner.class); job.setReducerClass(SummaryReducer.class); job.setOutputFormatClass(NullOutputFormat.class); if (job.waitForCompletion(true)) { LOG.info("Summary Generation Completed.."); return 0; } return -1; } HalyardSummary(); @Override int run(CommandLine cmd);  }