findingrish commented on code in PR #13365:
URL: https://github.com/apache/druid/pull/13365#discussion_r1030017311


##########
examples/bin/start-druid-main:
##########
@@ -0,0 +1,436 @@
+#!/usr/bin/env python3
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import sys
+import os
+import psutil
+import pathlib
+import multiprocessing
+import argparse
+
+QUICKSTART_ROOT_CONFIG_PATH = "conf/druid/single-server/quickstart"
+
+MEMORY_GIGABYTES_IDENTIFIER = "g"
+MEMORY_MEGABYTES_IDENTIFIER = "m"
+SERVICE_SEPARATOR = ","
+
+MM_TASK_JAVAOPTS_ARRAY = ["-server", 
"-Duser.timezone=UTC","-Dfile.encoding=UTF-8","-XX:+ExitOnOutOfMemoryError","-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager"]
+MM_TASK_MEMORY_TYPE_LOW = "low"
+MM_TASK_MEMORY_TYPE_HIGH = "high"
+MM_TASK_MEM_MAP = {
+    MM_TASK_MEMORY_TYPE_LOW: ["-Xms256m", "-Xmx256m", 
"-XX:MaxDirectMemorySize=256g"],
+    MM_TASK_MEMORY_TYPE_HIGH: ["-Xms1g", "-Xmx1g", 
"-XX:MaxDirectMemorySize=1g"]
+}
+
+MM_TASK_JAVAOPTS_PROP = "-Ddruid.indexer.runner.javaOptsArray"
+MM_TASK_WORKER_CAPACITY_PROP = "-Ddruid.worker.capacity"
+
+BROKER = "broker"
+ROUTER = "router"
+COORDINATOR = "coordinator-overlord"
+HISTORICAL = "historical"
+MM = "middleManager"
+MM_TASK = "middleManager-task"
+MM_TASK_COUNT = "task-count"
+
+DEFAULT_SERVICES = [
+    BROKER,
+    ROUTER,
+    COORDINATOR,
+    HISTORICAL,
+    MM
+]
+
+SERVICE_MEMORY_DISTRIBUTION_WEIGHT = {
+    MM: 0.5,
+    ROUTER: 1,
+    COORDINATOR: 15,
+    BROKER: 23,
+    HISTORICAL: 40,
+    MM_TASK: 15
+}
+
+SERVICE_MEMORY_LOWER_BOUND = {
+    MM: 64,
+    ROUTER: 128,
+    MM_TASK: 1024,
+    BROKER: 900,
+    COORDINATOR: 256,
+    HISTORICAL: 900
+}
+
+SERVICE_MEMORY_HEAP_PERCENTAGE = {
+    MM: 1,
+    ROUTER: 1,
+    COORDINATOR: 1,
+    BROKER: 0.60,
+    HISTORICAL: 0.40,
+    MM_TASK: 0.50
+}
+
+LOGGING_ENABLED = False
+
+def custom_print(message):
+    if LOGGING_ENABLED:
+        print(message)
+
+def error_and_exit(message):
+    sys.stderr.write(message + '\n')
+    sys.exit(1)
+
+def configure_parser():
+    parser = argparse.ArgumentParser(
+        prog='Druid quickstart',
+        formatter_class=argparse.RawTextHelpFormatter,
+        epilog=
+"""
+sample usage:
+    start-druid
+            Start up all the services (including zk).
+            50 - 80 percent of system memory is used.
+    start-druid -m=100g
+            Start up all the services (including zk)
+            using the given memory.
+    start-druid -m=100g --compute_only
+            Compute memory distribution and validate
+            arguments.
+    start-druid -m=100g -sl=broker,router
+            Start broker & router service, using 100g of memory.
+            Read config from conf/druid/single-server/quickstart.
+    start-druid -m=100g --sl=broker,router \\
+    -cp=conf/druid/single-server/custom
+            Start broker & router service, using 100g of memory.
+            Read config from <config_path>.
+            Since <memory> is specified, exception is thrown if
+            jvm.config is present for any of the services.
+    start-druid -sl=broker,router \\
+    -cp=conf/druid/single-server/custom
+            Start broker & router service, using system memory.
+            If jvm.config is specified for both the
+            services within <config_path>/<service>,
+            memory distribution is not calculated.
+            If jvm.config is present for either of the services,
+            exception is thrown.
+            If jvm.config is not present for both of the services,
+            memory distribution is calculated.
+    start-druid -m=100g \\
+    -cp=conf/druid/single-server/custom \\
+    -sl=broker,router \\
+    --run_zk
+            Start broker, router and zookeeper.
+            zk config is read from conf/zk.
+"""
+    )
+    parser.add_argument('--memory', '-m', type=str, required=False,
+                        help='Total memory for all processes (services and 
tasks, if any). \n'
+                             'This parameter is ignored if each service 
already has a jvm.config \n'
+                             'in the given conf directory. e.g. 500m, 4g, 
6g\n')
+    parser.add_argument('--service_list', '-sl', type=str, required=False,
+                        help='List of services to be started, subset of \n'
+                             '{broker, router, middleManager, historical, 
coordinator-overlord}. \n'
+                             'If the argument is not given, all services \n'
+                             'and zookeeper is started. e.g. 
-sl=broker,historical')
+    parser.add_argument('--config_path', '-cp', type=str, required=False,

Review Comment:
   I am using `--config`.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to