1
0

[HUDI-82] Adds Presto integration in Docker demo (#847)

This commit is contained in:
Bhavani Sudha Saktheeswaran
2019-08-22 19:40:36 -07:00
committed by vinoth chandar
parent 1b79ef7672
commit 92eed6aca8
17 changed files with 590 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
#!/bin/bash
set -eo pipefail
wait_until() {
local hostname=${1?}
local port=${2?}
local retry=${3:-100}
local sleep_secs=${4:-2}
local address_up=0
while [ ${retry} -gt 0 ] ; do
echo "Waiting until ${hostname}:${port} is up ... with retry count: ${retry}"
if nc -z ${hostname} ${port}; then
address_up=1
break
fi
retry=$((retry-1))
sleep ${sleep_secs}
done
if [ $address_up -eq 0 ]; then
echo "GIVE UP waiting until ${hostname}:${port} is up! "
exit 1
fi
}
if [ ! -e ${PRESTO_LOG_DIR}/node.id ]; then
cat /proc/sys/kernel/random/uuid > ${PRESTO_LOG_DIR}/node.id
fi
export PRESTO_NODE_ID=$(cat ${PRESTO_LOG_DIR}/node.id)
# apply template
for template in $(ls ${PRESTO_CONF_DIR}/*.mustache)
do
conf_file=${template%.mustache}
cat ${conf_file}.mustache | mustache.sh > ${conf_file}
done
case "$1" in
"coordinator" | "worker" )
server_role="$1"
shift
exec gosu presto launcher --config=${PRESTO_CONF_DIR}/${server_role}.properties "$@" run
;;
*)
;;
esac
exec "$@"

View File

@@ -0,0 +1,15 @@
#!/bin/sh
# `mustache.sh`, Mustache in POSIX shell.
set -e
# Load the `mustache` function and its friends. These are assumed to be
# in the `lib` directory in the same tree as this `bin` directory.
. "$(dirname "$(dirname "$0")")/lib/mustache.sh"
# Call `mustache` to make this behave somewhat like `mustache`(1).
# Because it doesn't accept the `--compile` or `--tokens` command-line
# options and does not accept input file(s) as arguments, this program
# is called `mustache.sh`(1), not `mustache`(1).
mustache