From cee15bb88a7d5ec59c62c4dfa6ca8f142aced0b6 Mon Sep 17 00:00:00 2001 From: cheddar Date: Mon, 29 Apr 2013 12:05:59 -0500 Subject: [PATCH] Adjust passing of nodeType to ExecutorMain to be via a system property instead of via a command line argument. --- .../main/java/com/metamx/druid/QueryableNode.java | 3 ++- .../druid/merger/coordinator/ForkingTaskRunner.java | 12 +++++------- .../druid/merger/worker/executor/ExecutorMain.java | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/src/main/java/com/metamx/druid/QueryableNode.java b/client/src/main/java/com/metamx/druid/QueryableNode.java index 20fb6bc4610..5989da6725a 100644 --- a/client/src/main/java/com/metamx/druid/QueryableNode.java +++ b/client/src/main/java/com/metamx/druid/QueryableNode.java @@ -306,7 +306,8 @@ public abstract class QueryableNode extends Registering serverConfig.getServerName(), serverConfig.getHost(), serverConfig.getMaxSize(), - nodeType, serverConfig.getTier() + nodeType, + serverConfig.getTier() ) ); } diff --git a/merger/src/main/java/com/metamx/druid/merger/coordinator/ForkingTaskRunner.java b/merger/src/main/java/com/metamx/druid/merger/coordinator/ForkingTaskRunner.java index 08998345d04..7071c7e50f0 100644 --- a/merger/src/main/java/com/metamx/druid/merger/coordinator/ForkingTaskRunner.java +++ b/merger/src/main/java/com/metamx/druid/merger/coordinator/ForkingTaskRunner.java @@ -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.port=%d", childPort)); command.add(config.getMainClass()); - command.add(defaultNodeType(task)); command.add(taskFile.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 public void stop() { diff --git a/merger/src/main/java/com/metamx/druid/merger/worker/executor/ExecutorMain.java b/merger/src/main/java/com/metamx/druid/merger/worker/executor/ExecutorMain.java index a43cd2671a9..b55060b3f1a 100644 --- a/merger/src/main/java/com/metamx/druid/merger/worker/executor/ExecutorMain.java +++ b/merger/src/main/java/com/metamx/druid/merger/worker/executor/ExecutorMain.java @@ -38,18 +38,17 @@ public class ExecutorMain LogLevelAdjuster.register(); if (args.length != 3) { - log.info("Usage: ExecutorMain "); + log.info("Usage: ExecutorMain "); System.exit(2); } Iterator arguments = Arrays.asList(args).iterator(); - final String nodeType = arguments.next(); final String taskJsonFile = arguments.next(); final String statusJsonFile = arguments.next(); final ExecutorNode node = ExecutorNode.builder() .build( - nodeType, + System.getProperty("druid.executor.nodeType", "indexer-executor"), new ExecutorLifecycleFactory( new File(taskJsonFile), new File(statusJsonFile),