Adjust passing of nodeType to ExecutorMain to be via a system property instead of via a command line argument.

This commit is contained in:
cheddar 2013-04-29 12:05:59 -05:00
parent 405eed7c60
commit cee15bb88a
3 changed files with 9 additions and 11 deletions

View File

@ -306,7 +306,8 @@ public abstract class QueryableNode<T extends QueryableNode> extends Registering
serverConfig.getServerName(), serverConfig.getServerName(),
serverConfig.getHost(), serverConfig.getHost(),
serverConfig.getMaxSize(), serverConfig.getMaxSize(),
nodeType, serverConfig.getTier() nodeType,
serverConfig.getTier()
) )
); );
} }

View File

@ -166,11 +166,15 @@ public class ForkingTaskRunner implements TaskRunner, TaskLogProvider
} }
} }
String nodeType = task.getNodeType();
if (nodeType != null) {
command.add(String.format("-Ddruid.executor.nodeType=%s", nodeType));
}
command.add(String.format("-Ddruid.host=%s", childHost)); command.add(String.format("-Ddruid.host=%s", childHost));
command.add(String.format("-Ddruid.port=%d", childPort)); command.add(String.format("-Ddruid.port=%d", childPort));
command.add(config.getMainClass()); command.add(config.getMainClass());
command.add(defaultNodeType(task));
command.add(taskFile.toString()); command.add(taskFile.toString());
command.add(statusFile.toString()); command.add(statusFile.toString());
@ -260,12 +264,6 @@ public class ForkingTaskRunner implements TaskRunner, TaskLogProvider
} }
} }
private String defaultNodeType(Task task)
{
final String nodeType = task.getNodeType();
return nodeType == null ? "indexer-executor" : nodeType;
}
@LifecycleStop @LifecycleStop
public void stop() public void stop()
{ {

View File

@ -38,18 +38,17 @@ public class ExecutorMain
LogLevelAdjuster.register(); LogLevelAdjuster.register();
if (args.length != 3) { if (args.length != 3) {
log.info("Usage: ExecutorMain <nodeType> <task.json> <status.json>"); log.info("Usage: ExecutorMain <task.json> <status.json>");
System.exit(2); System.exit(2);
} }
Iterator<String> arguments = Arrays.asList(args).iterator(); Iterator<String> arguments = Arrays.asList(args).iterator();
final String nodeType = arguments.next();
final String taskJsonFile = arguments.next(); final String taskJsonFile = arguments.next();
final String statusJsonFile = arguments.next(); final String statusJsonFile = arguments.next();
final ExecutorNode node = ExecutorNode.builder() final ExecutorNode node = ExecutorNode.builder()
.build( .build(
nodeType, System.getProperty("druid.executor.nodeType", "indexer-executor"),
new ExecutorLifecycleFactory( new ExecutorLifecycleFactory(
new File(taskJsonFile), new File(taskJsonFile),
new File(statusJsonFile), new File(statusJsonFile),