<commit_before>#!/bin/bash

##################################################################################
# Start Zookeeper and the Splice HBase servers
# See usage() below.
##################################################################################

usage() {
    # $1 is an error, if any
    if [[ -n "${1}" ]]; then
        echo "Error: ${1}"
    fi
    echo "Usage: $0 [true|false] [<hbase_profile>] -h[elp]"
    echo "Where: "
    echo "  true|false is an optional flag determining random task failures. Default is false."
    echo "  <hbase_profile> is the optional splice hbase platform to run.  One of:"
    echo "    cloudera-cdh4.3.0, hdp1.3, apache-hbase-0.94.5, mapr-0.94.5. Default is cloudera-cdh4.3.0."
    echo "  -h => print this message"
}

if [[ ${1} == -h* ]]; then
    usage
    exit 0 # This is not an error, User asked help. Don't do "exit 1"
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
pushd "${SCRIPT_DIR}/structured_derby" &>/dev/null
ROOT_DIR="$( pwd )"

CHAOS=${1}
shopt -s nocasematch
if [[ -z "${CHAOS}" || "${CHAOS}" != "true" ]]; then
    # default is NOT to run chaos monkey
    CHAOS="FALSE"
else
    CHAOS="TRUE"
fi
shopt -u nocasematch

PROFILE=${2}
if [[ -z "${PROFILE}" ]]; then
    # default profile
    PROFILE="cloudera-cdh4.3.0"
fi

SPLICE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|Download)')
TARBALL="${ROOT_DIR}"/target/splice_machine-${SPLICE_VERSION}-${PROFILE}_simple.tar.gz
# fail if wrong profile was provided
if [[ ! -e ${TARBALL} ]]; then
    usage "Cannot find ${TARBALL}. An unexpected profile was provided \\"${PROFILE}\\" or the project needs to be built."
    exit 1
fi

# Extract package libs for classpath and bin scripts to call
tar xvf ${TARBALL} -C "${ROOT_DIR}"/target splicemachine/lib &>/dev/null
tar xvf ${TARBALL} -C "${ROOT_DIR}"/target splicemachine/bin &>/dev/null

# Config<commit_msg>Added trimming of whitespace to splice version returned from maven.<commit_after>#!/bin/bash

##################################################################################
# Start Zookeeper and the Splice HBase servers
# See usage() below.
##################################################################################

usage() {
    # $1 is an error, if any
    if [[ -n "${1}" ]]; then
        echo "Error: ${1}"
    fi
    echo "Usage: $0 [true|false] [<hbase_profile>] -h[elp]"
    echo "Where: "
    echo "  true|false is an optional flag determining random task failures. Default is false."
    echo "  <hbase_profile> is the optional splice hbase platform to run.  One of:"
    echo "    cloudera-cdh4.3.0, hdp1.3, apache-hbase-0.94.5, mapr-0.94.5. Default is cloudera-cdh4.3.0."
    echo "  -h => print this message"
}

if [[ ${1} == -h* ]]; then
    usage
    exit 0 # This is not an error, User asked help. Don't do "exit 1"
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
pushd "${SCRIPT_DIR}/structured_derby" &>/dev/null
ROOT_DIR="$( pwd )"

CHAOS=${1}
shopt -s nocasematch
if [[ -z "${CHAOS}" || "${CHAOS}" != "true" ]]; then
    # default is NOT to run chaos monkey
    CHAOS="FALSE"
else
    CHAOS="TRUE"
fi
shopt -u nocasematch

PROFILE=${2}
if [[ -z "${PROFILE}" ]]; then
    # default profile
    PROFILE="cloudera-cdh4.3.0"
fi

SPLICE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|Download)' | tr -d [[:space:]])
TARBALL="${ROOT_DIR}"/target/splice_machine-${SPLICE_VERSION}-${PROFILE}_simple.tar.gz
# fail if wrong profile was provided
if [[ ! -e ${TARBALL} ]]; then
    usage "Cannot find ${TARBALL}. An unexpected profile was provided \\"${PROFILE}\\" or the project needs to be built."
    exit 1
fi

# Extract package libs for classpath and bin scripts to call
tar xvf ${TARBALL} -C "${ROOT_DIR}"/target splicemachine/lib &>/dev/null
tar xvf ${TARBALL} -C "${ROOT_DIR}"/target splicemachine/bin &>/dev/null

# Config
{'fraction_non_alphanumeric': 0.23665835411471323, 'fraction_numerical': 0.016458852867830425, 'mean_word_length': 3.8795620437956204, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '298329', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1362, 'n_words': 407}