mirror of
https://github.com/apache/druid.git
synced 2025-02-20 00:47:40 +00:00
fix things up according to code review comments
This commit is contained in:
parent
0461e4688f
commit
8bc56daa66
@ -97,27 +97,6 @@ public class HadoopDruidIndexerConfig
|
|||||||
|
|
||||||
public static HadoopDruidIndexerConfig fromMap(Map<String, Object> argSpec)
|
public static HadoopDruidIndexerConfig fromMap(Map<String, Object> argSpec)
|
||||||
{
|
{
|
||||||
//List<Registererer> registererers = Lists.transform(
|
|
||||||
// MapUtils.getList(argSpec, "registererers", ImmutableList.of()),
|
|
||||||
// new Function<Object, Registererer>()
|
|
||||||
// {
|
|
||||||
// @Override
|
|
||||||
// public Registererer apply(@Nullable Object input)
|
|
||||||
// {
|
|
||||||
// try {
|
|
||||||
// return (Registererer) Class.forName((String) input).newInstance();
|
|
||||||
// }
|
|
||||||
// catch (Exception e) {
|
|
||||||
// throw Throwables.propagate(e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//);
|
|
||||||
|
|
||||||
//if (!registererers.isEmpty()) {
|
|
||||||
// Registererers.registerHandlers(registererers, Arrays.asList(jsonMapper));
|
|
||||||
//}
|
|
||||||
|
|
||||||
return jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class);
|
return jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +158,6 @@ public class HadoopDruidIndexerConfig
|
|||||||
private volatile DataRollupSpec rollupSpec;
|
private volatile DataRollupSpec rollupSpec;
|
||||||
private volatile DbUpdaterJobSpec updaterJobSpec;
|
private volatile DbUpdaterJobSpec updaterJobSpec;
|
||||||
private volatile boolean ignoreInvalidRows = false;
|
private volatile boolean ignoreInvalidRows = false;
|
||||||
//private volatile List<String> registererers = Lists.newArrayList();
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public HadoopDruidIndexerConfig(
|
public HadoopDruidIndexerConfig(
|
||||||
@ -204,7 +182,6 @@ public class HadoopDruidIndexerConfig
|
|||||||
final @JsonProperty("rollupSpec") DataRollupSpec rollupSpec,
|
final @JsonProperty("rollupSpec") DataRollupSpec rollupSpec,
|
||||||
final @JsonProperty("updaterJobSpec") DbUpdaterJobSpec updaterJobSpec,
|
final @JsonProperty("updaterJobSpec") DbUpdaterJobSpec updaterJobSpec,
|
||||||
final @JsonProperty("ignoreInvalidRows") boolean ignoreInvalidRows
|
final @JsonProperty("ignoreInvalidRows") boolean ignoreInvalidRows
|
||||||
//final @JsonProperty("registererers") List<String> registererers
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
@ -224,7 +201,6 @@ public class HadoopDruidIndexerConfig
|
|||||||
this.rollupSpec = rollupSpec;
|
this.rollupSpec = rollupSpec;
|
||||||
this.updaterJobSpec = updaterJobSpec;
|
this.updaterJobSpec = updaterJobSpec;
|
||||||
this.ignoreInvalidRows = ignoreInvalidRows;
|
this.ignoreInvalidRows = ignoreInvalidRows;
|
||||||
//this.registererers = registererers;
|
|
||||||
|
|
||||||
if(partitionsSpec != null) {
|
if(partitionsSpec != null) {
|
||||||
Preconditions.checkArgument(
|
Preconditions.checkArgument(
|
||||||
@ -517,17 +493,6 @@ public class HadoopDruidIndexerConfig
|
|||||||
this.ignoreInvalidRows = ignoreInvalidRows;
|
this.ignoreInvalidRows = ignoreInvalidRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@JsonProperty
|
|
||||||
//public List<String> getRegistererers()
|
|
||||||
//{
|
|
||||||
// return registererers;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//public void setRegistererers(List<String> registererers)
|
|
||||||
//{
|
|
||||||
// this.registererers = registererers;
|
|
||||||
//}
|
|
||||||
|
|
||||||
/********************************************
|
/********************************************
|
||||||
Granularity/Bucket Helper Methods
|
Granularity/Bucket Helper Methods
|
||||||
********************************************/
|
********************************************/
|
||||||
|
@ -360,7 +360,6 @@ public class TaskSerdeTest
|
|||||||
new DataRollupSpec(ImmutableList.<AggregatorFactory>of(), QueryGranularity.NONE),
|
new DataRollupSpec(ImmutableList.<AggregatorFactory>of(), QueryGranularity.NONE),
|
||||||
null,
|
null,
|
||||||
false
|
false
|
||||||
//ImmutableList.<String>of()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -120,6 +120,7 @@ public class DiscoveryModule implements Module
|
|||||||
*/
|
*/
|
||||||
public static void registerKey(Binder binder, Key<DruidNode> key)
|
public static void registerKey(Binder binder, Key<DruidNode> key)
|
||||||
{
|
{
|
||||||
|
DruidBinders.discoveryAnnouncementBinder(binder).addBinding().toInstance(new KeyHolder<>(key));
|
||||||
LifecycleModule.registerKey(binder, key);
|
LifecycleModule.registerKey(binder, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,8 @@
|
|||||||
|
|
||||||
package io.druid.cli;
|
package io.druid.cli;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.google.api.client.repackaged.com.google.common.base.Throwables;
|
import com.google.api.client.repackaged.com.google.common.base.Throwables;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import com.google.common.io.InputSupplier;
|
import com.google.common.io.InputSupplier;
|
||||||
@ -32,16 +30,11 @@ import com.google.inject.Module;
|
|||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.metamx.common.lifecycle.Lifecycle;
|
import com.metamx.common.lifecycle.Lifecycle;
|
||||||
import com.metamx.common.logger.Logger;
|
import com.metamx.common.logger.Logger;
|
||||||
import com.metamx.emitter.core.LoggingEmitter;
|
|
||||||
import com.metamx.emitter.core.LoggingEmitterConfig;
|
|
||||||
import com.metamx.emitter.service.ServiceEmitter;
|
|
||||||
import io.airlift.command.Arguments;
|
import io.airlift.command.Arguments;
|
||||||
import io.airlift.command.Command;
|
import io.airlift.command.Command;
|
||||||
import io.druid.guice.LazySingleton;
|
import io.druid.guice.LazySingleton;
|
||||||
import io.druid.guice.ManageLifecycle;
|
|
||||||
import io.druid.indexer.HadoopDruidIndexerConfig;
|
import io.druid.indexer.HadoopDruidIndexerConfig;
|
||||||
import io.druid.indexer.HadoopDruidIndexerJob;
|
import io.druid.indexer.HadoopDruidIndexerJob;
|
||||||
import io.druid.initialization.LogLevelAdjuster;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
@ -55,7 +48,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Command(
|
@Command(
|
||||||
name = "hadoop",
|
name = "hadoop",
|
||||||
description = "Runs the batch Hadoop Druid Indexer, see LINK GOES HERE for a description."
|
description = "Runs the batch Hadoop Druid Indexer, see https://github.com/metamx/druid/wiki/Batch-ingestion for a description."
|
||||||
)
|
)
|
||||||
public class CliHadoopIndexer extends GuiceRunnable
|
public class CliHadoopIndexer extends GuiceRunnable
|
||||||
{
|
{
|
||||||
@ -122,21 +115,10 @@ public class CliHadoopIndexer extends GuiceRunnable
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
LogLevelAdjuster.register();
|
Injector injector = makeInjector();
|
||||||
|
|
||||||
final Injector injector = Initialization.makeInjectorWithModules(
|
|
||||||
getBaseInjector(), getModules()
|
|
||||||
);
|
|
||||||
final Lifecycle lifecycle = injector.getInstance(Lifecycle.class);
|
|
||||||
final HadoopDruidIndexerJob job = injector.getInstance(HadoopDruidIndexerJob.class);
|
final HadoopDruidIndexerJob job = injector.getInstance(HadoopDruidIndexerJob.class);
|
||||||
|
|
||||||
try {
|
Lifecycle lifecycle = initLifecycle(injector);
|
||||||
lifecycle.start();
|
|
||||||
}
|
|
||||||
catch (Throwable t) {
|
|
||||||
log.error(t, "Error when starting up. Failing.");
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
job.run();
|
job.run();
|
||||||
|
|
||||||
@ -150,7 +132,7 @@ public class CliHadoopIndexer extends GuiceRunnable
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw com.google.common.base.Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,11 +28,6 @@ public abstract class GuiceRunnable implements Runnable
|
|||||||
this.baseInjector = injector;
|
this.baseInjector = injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Injector getBaseInjector()
|
|
||||||
{
|
|
||||||
return baseInjector;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract List<Object> getModules();
|
protected abstract List<Object> getModules();
|
||||||
|
|
||||||
public Injector makeInjector()
|
public Injector makeInjector()
|
||||||
@ -67,10 +62,4 @@ public abstract class GuiceRunnable implements Runnable
|
|||||||
throw Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
initLifecycle(makeInjector());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user