<commit_before>#!/bin/bash


function start {
  if [ "$RUN_NEWRELIC" == "TRUE" ]; then
    NEW_RELIC_CONFIG_FILE="./newrelic.ini" newrelic-admin run-program /usr/local/bin/uwsgi --ini-paste shavar.ini --paste-logger --uid 10001 --gid 10001
  else
     exec /usr/local/bin/uwsgi --ini-paste shavar.ini --paste-logger --uid 10001 --gid 10001
  fi
}


function deploy {
  if [ "$RUN_NEWRELIC" == "TRUE" ]; then
    HASH=$(cat version.json | cut -d":" -f2|cut -d"," -f1 | tr -d "\"")
    REPO=$(cat version.json | cut -d"\"" -f12)
    newrelic-admin record-deploy ./newrelic.ini ${HASH:7} ${REPO} svcops
  else
    /bin/false
  fi
}


if [ -n "$1" ]; then
  COMMAND=$(echo $1 | tr [a-z] [A-Z])
else
  exit 1
fi

if env | grep -q "ENABLE_NEWRELIC"; then
  declare -x "RUN_NEWRELIC=TRUE"
  if [ -e newrelic.ini ]; then
    /bin/true
  else
    newrelic-admin generate-config ${NEWRELIC_LIC_KEY} newrelic.ini
    sed -i -e 's@app_name = Python Application@app_name = Shavar@' newrelic.ini
  fi
fi

if [ -x /usr/local/bin/uwsgi ]; then
  case "$COMMAND" in
    START)
      start
      exit 0
      ;;
    DEPLOY)
      deploy
      exit 0
      ;;
    *)
      echo "Invalid option specified: ARG=$COMMAND"
      exit 1
      ;;
  esac
else
  echo "uwsgi is not installed"
  exit 1
fi<commit_msg>move some logic around move the check for uwsgi to a more logical place, requiring the binary to exist in order to start the container (the default operation of the container anyway)<commit_after>#!/bin/bash


function start {
  if [ "$RUN_NEWRELIC" == "TRUE" ]; then
    NEW_RELIC_CONFIG_FILE="./newrelic.ini" newrelic-admin run-program /usr/local/bin/uwsgi --ini-paste shavar.ini --paste-logger --uid 10001 --gid 10001
  else
     exec /usr/local/bin/uwsgi --ini-paste shavar.ini --paste-logger --uid 10001 --gid 10001
  fi
}


function deploy {
  if [ "$RUN_NEWRELIC" == "TRUE" ]; then
    HASH=$(cat version.json | cut -d":" -f2|cut -d"," -f1 | tr -d "\"")
    REPO=$(cat version.json | cut -d"\"" -f12)
    newrelic-admin record-deploy ./newrelic.ini ${HASH:7} ${REPO} svcops
  else
    /bin/false
  fi
}


if [ -n "$1" ]; then
  COMMAND=$(echo $1 | tr [a-z] [A-Z])
else
  exit 1
fi

if env | grep -q "ENABLE_NEWRELIC"; then
  declare -x "RUN_NEWRELIC=TRUE"
  if [ -e newrelic.ini ]; then
    /bin/true
  else
    newrelic-admin generate-config ${NEWRELIC_LIC_KEY} newrelic.ini
    sed -i -e 's@app_name = Python Application@app_name = Shavar@' newrelic.ini
  fi
fi

case "$COMMAND" in
  START)
    if [ -x /usr/local/bin/uwsgi ]; then
      start
      exit 0
    else
      echo "uwsgi is not installed"
      exit 1
    fi
    ;;
  DEPLOY)
    deploy
    exit 0
    ;;
  *)
    echo "Invalid option specified: ARG=$COMMAND"
    exit 1
    ;;
esac
{'fraction_non_alphanumeric': 0.14473204520597885, 'fraction_numerical': 0.023332118118847976, 'mean_word_length': 2.5089514066496164, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1393590', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1046, 'n_words': 294}