<commit_before>#!/bin/bash

# Check if we have root powers
if [ `whoami` != root ]; then
    echo "Please run this script as root or using sudo"
    exit 1
fi


TAG="drupal/testbot-pgsql"
NAME="drupaltestbot-db-pgsql"
STALLED=$(docker ps -a | grep ${TAG} | grep Exit | awk '{print $1}')
RUNNING=$(docker ps | grep ${TAG} | grep 5432)
if [[ $RUNNING != "" ]]
  then 
    echo "Found database container:" 
    echo "$RUNNING already running..."
    exit 0
  elif [[ $STALLED != "" ]]
    then
    echo "Found old container $STALLED. Removing..."
    docker rm $STALLED
    if [ -d "/tmp/tmp.*" ]; then
      rm -fr /tmp/tmp.* || /bin/true
      umount -f /tmp/tmp.* || /bin/true
      rm -fr /tmp/tmp.* || /bin/true
    fi
fi
  
TMPDIR=$(mktemp -d)
mount -t tmpfs -o size=16000M tmpfs $TMPDIR

docker run -d -p=5432 --name=${NAME} -v="$TMPDIR":/var/lib/postgresql ${TAG}
CONTAINER_ID=$(docker ps | grep ${TAG} | awk '{print $1}')

#PORT=$(docker port $MYSQL_ID 5432 | cut -d":" -f2)
#TAG="drupal/testbot-pgsql"

echo "CONTAINER STARTED: $CONTAINER_ID"

docker ps | grep "drupal/testbot-pgsql"

<commit_msg>Run without tmpfs for now... we'll fix it later<commit_after>#!/bin/bash

# Check if we have root powers
if [ `whoami` != root ]; then
    echo "Please run this script as root or using sudo"
    exit 1
fi


TAG="drupal/testbot-pgsql"
NAME="drupaltestbot-db-pgsql"
STALLED=$(docker ps -a | grep ${TAG} | grep Exit | awk '{print $1}')
echo jsmith Stalled $STALLED
RUNNING=$(docker ps | grep ${TAG} | grep 5432)
echo jsmith Running $RUNNING
if [[ $RUNNING != "" ]]
  then 
    echo "Found database container:" 
    echo "$RUNNING already running..."
    exit 0
  elif [[ $STALLED != "" ]]
    then
    echo "Found old container $STALLED. Removing..."
    docker rm $STALLED
    if [ -d "/tmp/tmp.*" ]; then
      rm -fr /tmp/tmp.* || /bin/true
      umount -f /tmp/tmp.* || /bin/true
      rm -fr /tmp/tmp.* || /bin/true
    fi
fi
  
TMPDIR=$(mktemp -d)
mount -t tmpfs -o size=16000M tmpfs $TMPDIR

# TODO: Make this work with /var/lib/postgresql (and perhaps /etc/postgresql?) 
# mounted on tmpfs.  

#docker run -d -p=5432 --name=${NAME} -v="$TMPDIR":/var/lib/postgresql ${TAG}
docker run -d -p=5432 --name=${NAME} ${TAG}
CONTAINER_ID=$(docker ps | grep ${TAG} | awk '{print $1}')

#PORT=$(docker port $MYSQL_ID 5432 | cut -d":" -f2)
#TAG="drupal/testbot-pgsql"

echo "CONTAINER STARTED: $CONTAINER_ID"

docker ps | grep "drupal/testbot-pgsql"


{'fraction_non_alphanumeric': 0.17197712418300654, 'fraction_numerical': 0.0196078431372549, 'mean_word_length': 3.0147540983606556, 'pattern_counts': {'":': 4, '<': 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': '3617140', 'n_tokens_mistral': 997, 'n_tokens_neox': 930, 'n_words': 282}