# 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.
# ---------------------------------------------------------------------------
# Configuration for the Drill-on-YARN feature.
# See drill-on-yarn-example.conf for details.
# Some properties are private; the are meant for use by the Drill
# developers. Those are marked as private here, and are explained here
# rather than in the example config.

drill.yarn: {
  app-name: "Drill-on-YARN"

  # Settings here support a default single-node cluster on the local host,
  # using the default HDFS connection obtained from the Hadoop config files.

  dfs: {
    connection: ""
    app-dir: "/user/drill"
  }

  drill-install: {
    site-dir: ""
    client-path: ""
    dir-name: "<base>"

    # Drill-on-YARN uses localization by default; it is the simplest and
    # most reliable for production systems. However, localization can be
    # disabled for development, testing or other special needs.

    localize: true

    # Localized runs typically provide a site directory. For various reasons,
    # some users may wish to avoid using a site directory and instead just
    # use their own $DRILL_HOME/conf directory as the site directory. In
    # this case, $DRILL_HOME/conf must contain all site-specific content,
    # including jars. This setting says to treat $DRILL_HOME/conf as the
    # site directory. Disable this option if the Drill archive is rebuilt
    # to contain the $DRILL_HOME/conf files. This flag is also automatically
    # assumed if the Drill archive is *inside* $DRILL_HOME.

    conf-as-site: true

    # When localization is disabled, the path to Drill software defaults
    # to the same location as on the client node. However, if the path
    # on worker nodes is different, set the actual path here.

    drill-home: ""

    # Drill provides the option to store site-specific configuration outside
    # of the Drill home directory. The site directory contains configuration
    # files and custom Java code (in the jars subdirectory.) The site dir
    # normally is localized by the client. However, in a non-localized
    # run, use this setting to identify the location of the site directory
    # on each worker node if the location is different than the node
    # that runs the client.

    site-dir: ""

    # Key used for the Drill archive file in the AM launch config.
    # Not usually changed by users.

    drill-key: "drill"
    site-key: "site"

    # Set the Java java.library.path option to files that pre-exist on
    # each Drillbit node. (This is not for libraries that are distributed
    # by YARN.)

    library-path: ""
  }

  yarn: {
    queue: "default"
    priority: 1
    user: ""
  }

  hadoop: {
    home: ""
    class-path: ""
    hbase-class-path: ""
  }

  client: {

    # Time (in secs) between poll attempts on start and stop.

    poll-sec: 1

    # Maximum time to wait when starting the AM before asking the
    # user to check status later.

    start-wait-sec: 60

    # Maximum time to wait when stopping the AM before skipping
    # the confirmation step.

    stop-wait-sec: 60
  }

  am: {
    memory-mb: 512

    # The AM is CPU-light, a single core will do.

    vcores: 1

    # The AM uses no disk. Available on selected YARN distributions.

    disks: 0

    # Heap memory for the AM. Estimate based on observation.

    heap: "450M"

    # Arguments passed to the AM JVM. (Private)

    vm-args: ""

    # AM-to-RM period in ms. (Private)

    poll-ms: 1000

    # AM clock tick period in ms. (Private)

    tick-ms: 2000

    # Set to true to dump launch variables and command to log.

    debug-launch: false

    # Extra class path for AM. The path must be valid on all nodes.
    # Not normally used; provided only for special cases to avoid editing
    # the launch script. This is a class path prefix to allow overrides
    # of Drill classes.
    # Analogous to DRILL_CLASSPATH_PREFIX in drill-config.sh
    # Multiple entries should be separated by colons.

    prefix-class-path: ""

    # Extra class path for AM. The path must be valid on all nodes on which
    # the AM may run.
    # Not normally used; provided only for special cases to avoid editing
    # the launch script.

    class-path: ""

    # Enables/disables auto shutdown when no Drillbits can run. Disable
    # this when required for single-node testing.

    auto-shutdown: true

    # Specify nodes that can run the AM via a YARN node label expression.
    # Blank means that node labele expression will be applied.

    node-label-expr: ""
  }

  drillbit: {

    # Default memory: 4096 (heap) + 8192 (direct) +  1024 (code cache) + 1024 overhead.

    memory-mb: 14336
    vcores: 4
    disks: 1

    heap: "4G"
    max-direct-memory: "8G"
    code-cache: "1G"

    # Additional JVM arguments for the drillbit (Private)
    # The value here is appended to any set in the launch script.
    # Separate multiple arguments by spaces.

    vm-args: ""

    # Set to true to turn on garbage collection logging.
    # Similar to SERVER_GC_OPTS in drillbit.sh. However under YARN
    # all logging goes to YARN's log directory and the GC log is
    # always called "gc.log".

    log-gc: false

    # Extra class path for Drill-bit. The path must be valid on all nodes.
    # Not normally used; provided only for special cases to avoid editing
    # the launch script. This is a class path prefix to allow overrides
    # of Drill classes.
    # Equivalent to DRILL_CLASSPATH_PREFIX in drill-config.sh
    # Multiple entries should be separated by colons.

    prefix-class-path: ""

    # Extra class path for Drill extensions such as Hadoop or HBase.
    # The path must be valid on all nodes. Inserted into Drill's
    # class path before Drill's own third-party extensions; allows
    # overriding of Drill's own included jars.
    # Equivalent to HADOOP_CLASSPATH and HBASE_CLASSPATH
    # in drill-config.sh

    extn-class-path: ""

    # Normal class path specification for jars added to Drill's own.
    # Appears in the class path after Drill's jars. Useful for dependencies
    # on custom data source implementations.
    # The path must be valid on all nodes.
    # Equivalent to DRILL_CLASSPATH in drill-config.sh

    class-path: ""

    # Maximum number of retries of each Drillbit before blacklisting the node.

    max-retries: 3

    # Set to true to dump launch variables and command to log.

    debug-launch: false

    # Disable normal YARN log location. Allows Drill to write to
    # it's own log location as when running outside of YARN. However,
    # under YARN, log aggregation is generally considered a "good thing."

    disable-yarn-logs: false

    # DoY maintains an approximate count of free nodes available under YARN.
    # A common error is to ask for far more Drillbits than can be run given
    # the available nodes. This setting limits the number of "extra" requests
    # beyond the known free nodes. The reason this number is not zero is that
    # the DoY count is approximate, so we want to provide so "wiggle room."

    max-extra-nodes: 2

    # Maximum time that the AM will wait when requesting a container to run
    # the Drillbit. After this time, the request will timeout and the AM will
    # decrease the desired cluster size to match the fact that no additional
    # node appears to be available. The timeout is in seconds. 0 means no
    # timeout

    request-timeout-secs: 600
  }

  http: {
    enabled: true
    port: 8048
    ssl-enabled: false
    auth-type: "none"
    # Default of one hour, as in the Drillbit
    session-max-idle-secs: 3600
    rest-key="secret"
    docs-link: "http://drill.apache.org/docs/"
    refresh-secs: 5
  }

  cluster: [

    # Defined to support a demo single-node cluster.

    {
      name: "default"
      type: "basic"
      count: 1
    }
  ]
}