fix cli hadoop indexer

* run determine partitions job using CLI
This commit is contained in:
nishantmonu51 2014-03-11 16:36:13 +05:30
parent 34957ee471
commit 04f3d0a13a
2 changed files with 14 additions and 5 deletions

View File

@ -281,7 +281,7 @@ public class HadoopIndexTask extends AbstractTask
Jobby job = new HadoopDruidDetermineConfigurationJob(config);
log.info("Starting a hadoop index generator job...");
log.info("Starting a hadoop determine configuration job...");
if (job.run()) {
return HadoopDruidIndexerConfig.jsonMapper.writeValueAsString(HadoopDruidIndexerConfigBuilder.toSchema(config));
}

View File

@ -20,14 +20,20 @@
package io.druid.cli;
import com.google.api.client.repackaged.com.google.common.base.Throwables;
import com.google.api.client.util.Lists;
import com.metamx.common.logger.Logger;
import io.airlift.command.Arguments;
import io.airlift.command.Command;
import io.druid.indexer.HadoopDruidDetermineConfigurationJob;
import io.druid.indexer.HadoopDruidIndexerConfig;
import io.druid.indexer.HadoopDruidIndexerConfigBuilder;
import io.druid.indexer.HadoopDruidIndexerJob;
import io.druid.indexer.JobHelper;
import io.druid.indexer.Jobby;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
*/
@ -37,17 +43,20 @@ import java.io.File;
)
public class CliInternalHadoopIndexer implements Runnable
{
private static final Logger log = new Logger(CliHadoopIndexer.class);
@Arguments(description = "A JSON object or the path to a file that contains a JSON object", required = true)
private String argumentSpec;
private static final Logger log = new Logger(CliHadoopIndexer.class);
@Override
public void run()
{
try {
final HadoopDruidIndexerJob job = new HadoopDruidIndexerJob(getHadoopDruidIndexerConfig());
job.run();
HadoopDruidIndexerConfig config = getHadoopDruidIndexerConfig();
List<Jobby> jobs = Lists.newArrayList();
jobs.add(new HadoopDruidDetermineConfigurationJob(config));
jobs.add(new HadoopDruidIndexerJob(config));
JobHelper.runJobs(jobs, config);
}
catch (Exception e) {
throw Throwables.propagate(e);