<commit_before>#!/bin/bash

PUP_VERSION='0.4.0'
PUP_PATH='/usr/local/bin'
if ! [ -x "$(command -v pup)" ]
then
  sudo wget -O "${PUP_PATH}/pup.zip" "https://github.com/ericchiang/pup/releases/download/v${PUP_VERSION}/pup_v${PUP_VERSION}_linux_amd64.zip"
  sudo unzip "${PUP_PATH}/pup.zip" -d "${PUP_PATH}"
  sudo chmod +x "${PUP_PATH}/pup"
  sudo rm -f "${PUP_PATH}/pup.zip"
fi


# wait for
#
wait_for_graphite() {

  echo "wait for graphite web"

  # now wait for ssh port
  RETRY=40
  until [[ ${RETRY} -le 0 ]]
  do
    timeout 1 bash -c "cat < /dev/null > /dev/tcp/127.0.0.1/8080" 2> /dev/null
    if [ $? -eq 0 ]
    then
      break
    else
      sleep 3s
      RETRY=$(expr ${RETRY} - 1)
    fi
  done

  if [[ $RETRY -le 0 ]]
  then
    echo "could not connect to the graphite instance"
    exit 1
  fi
}


send_request() {

  echo ""

  curl --silent --head localhost:9001 > /dev/null

  result=${?}

  if [[ ${result} -eq 0 ]]
  then

    running=$(curl --silent -u supervisor:supervisor  http://localhost:9001 | grep -c statusrunning)

    if [[ ${running} -eq 3 ]]
    then
      echo -e "${running} processes are running in the container.\n"

      data=$(curl --silent -u supervisor:supervisor  http://localhost:9001)

      for (( c=0; c<=((running-1)); c++ ))
      do
        echo "${data}" | \
          "${PUP_PATH}/pup" 'table tbody json{}' | \
          jq ".[] | {
            \"name\": .children[${c}].children[2].children[0].text,
            \"state\": .children[${c}].children[0].children[0].text,
            \"pip / uptime\": .children[${c}].children[1].children[0].text
          }"

      done

      echo ""

      curl --head localhost:8080
    else
      echo "ERROR: no running processes"
    fi
  fi
}

<commit_msg>debug integration test<commit_after>#!/bin/bash

PUP_VERSION='0.4.0'
PUP_PATH='/usr/local/bin'
if ! [ -x "$(command -v pup)" ]
then
  sudo wget -O "${PUP_PATH}/pup.zip" "https://github.com/ericchiang/pup/releases/download/v${PUP_VERSION}/pup_v${PUP_VERSION}_linux_amd64.zip"
  sudo unzip "${PUP_PATH}/pup.zip" -d "${PUP_PATH}"
  sudo chmod +x "${PUP_PATH}/pup"
  sudo rm -f "${PUP_PATH}/pup.zip"
fi


# wait for
#
wait_for_graphite() {

  echo "wait for graphite web"

  # now wait for ssh port
  RETRY=40
  until [[ ${RETRY} -le 0 ]]
  do
    timeout 1 bash -c "cat < /dev/null > /dev/tcp/127.0.0.1/8080" 2> /dev/null
    if [ $? -eq 0 ]
    then
      break
    else
      sleep 3s
      RETRY=$(expr ${RETRY} - 1)
    fi
  done

  if [[ $RETRY -le 0 ]]
  then
    echo "could not connect to the graphite instance"
    exit 1
  fi
}


send_request() {
set -x
  echo ""

#  curl --silent --head localhost:9001 > /dev/null
#
#  result=${?}
#
#  if [[ ${result} -eq 0 ]]
#  then
    curl --head localhost:8080

    echo ""

    running=$(curl --silent -u supervisor:supervisor  http://localhost:9001 | grep -c statusrunning)

    if [[ ${running} -eq 3 ]]
    then
      echo -e "${running} processes are running in the container.\n"

      data=$(curl --silent -u supervisor:supervisor  http://localhost:9001)

      for (( c=0; c<=((running-1)); c++ ))
      do
        echo "${data}" | \
          "${PUP_PATH}/pup" 'table tbody json{}' | \
          jq ".[] | {
            \"name\": .children[${c}].children[2].children[0].text,
            \"state\": .children[${c}].children[0].children[0].text,
            \"pip / uptime\": .children[${c}].children[1].children[0].text
          }"

      done

      echo ""

    else
      echo "ERROR: no running processes"
    fi
#  fi
set +x
}


{'fraction_non_alphanumeric': 0.18153585544889891, 'fraction_numerical': 0.028797289666854884, 'mean_word_length': 2.2624309392265194, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '632186', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1305, 'n_words': 321}