<commit_before>#!/usr/bin/env bash
set -eo pipefail

# default variables
: "${PORT:=5000}"
: "${SLEEP:=1}"
: "${TRIES:=60}"

function wait_for_check {(
  tries=0
  echo "Waiting for $1 to respond..."
  while true; do
    [[ $tries -lt $TRIES ]] || return
    flask check $1 >/dev/null 2>&1
    [[ $? -eq 0 ]] && return
    sleep $SLEEP
    tries=$((tries + 1))
  done
)}

# first wait for the database
wait_for_check redis & wait_for_check postgres

# then run the database migrations
flask db upgrade

# then build the assets
flask assets build

exec "$@"<commit_msg>Stop this.<commit_after>#!/usr/bin/env bash
set -eo pipefail

# default variables
: "${PORT:=5000}"
: "${SLEEP:=1}"
: "${TRIES:=60}"

function wait_for_check {(
  tries=0
  echo "Waiting for $1 to respond..."
  while true; do
    [[ $tries -lt $TRIES ]] || return
    flask check $1 >/dev/null 2>&1
    [[ $? -eq 0 ]] && return
    sleep $SLEEP
    tries=$((tries + 1))
  done
)}

# first wait for the database
# wait_for_check redis & wait_for_check postgres

# then run the database migrations
# flask db upgrade

# then build the assets
flask assets build

exec "$@"
{'fraction_non_alphanumeric': 0.15391380826737028, 'fraction_numerical': 0.024626209322779244, 'mean_word_length': 3.393822393822394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2807346', 'n_tokens_mistral': 436, 'n_tokens_neox': 412, 'n_words': 129}