<commit_before>#!/bin/bash
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"

wait_forever=true

while (( "$#" )); do
    if [ "$1" == "--no-wait" ]; then
         wait_forever=false
        shift 1
    else
        if [ "$1" != "-h" ]; then
            echo "ERROR: invalid argument '$1'"
        fi
        echo "USAGE: startMockAgents.sh [--no-wait]"
        echo ""
        echo "where"
        echo "    --no-wait    do not wait"
        exit 1
    fi

done

HOSTNAME=`hostname -s`

set -e

set -x
cd ${DIR}
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/default/hosts.json --host defaultHost --address ${HOSTNAME} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/default/hosts.json --host host2 --address ${HOSTNAME} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/default/hosts.json --host host3 --address ${HOSTNAME} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/default/hosts.json --host host4 --address ${HOSTNAME} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/default/hosts.json --host host5 --address ${HOSTNAME} &
set +x

WAIT=0
while [ $WAIT -lt 5 ]; do
  echo "."
  sleep 1s
  let WAIT=WAIT+1
done

if jobs -l | grep -q "Done";
  then
    jobs 1>&2
    echo "Mock agent(s) failed, closing" 1>&2
    pkill mockAgent<commit_msg>Fix startMockAgents to allow different datasets<commit_after>#!/bin/bash
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"

wait_forever=true
DATASET=default

while (( "$#" )); do
    if [ "$1" == "--no-wait" ]; then
         wait_forever=false
        shift 1
    elif [ "$1" == "--dataset" ]; then
        DATASET="${2}"
        shift 2
    else
        if [ "$1" != "-h" ]; then
            echo "ERROR: invalid argument '$1'"
        fi
        echo "USAGE: startMockAgents.sh [--no-wait] [--dataset setName]"
        echo ""
        echo "where"
        echo "    --no-wait             do not wait"
        echo "    --dataset setName     identifies the dataset to use"
        exit 1
    fi

done

if [ ! -d ${DIR}/ui/features/data/${DATASET} ]; then
    echo "ERROR: directory '${DIR}/ui/features/data/${DATASET}' does not exist"
    exit 1
fi

HOST_IP=`hostname -i`

set -e

set -x
cd ${DIR}
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/${DATASET}/hosts.json --host defaultHost --address ${HOST_IP} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/${DATASET}/hosts.json --host host2 --address ${HOST_IP} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/${DATASET}/hosts.json --host host3 --address ${HOST_IP} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/${DATASET}/hosts.json --host host4 --address ${HOST_IP} &
${DIR}/mockAgent/mockAgent --config-file ${DIR}/ui/features/data/${DATASET}/hosts.json --host host5 --address ${HOST_IP} &
set +x

WAIT=0
while [ $WAIT -lt 5 ]; do
  echo "."
  sleep 1s
  let WAIT=WAIT+1
done

if jobs -l | grep -q "Done";
  then
    jobs 1>&2
    echo "Mock agent(s) failed, closing" 1>&2
    pkill mockAgent
{'fraction_non_alphanumeric': 0.18442489410231347, 'fraction_numerical': 0.013033561420658195, 'mean_word_length': 2.6504161712247325, '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': '1335825', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1058, 'n_words': 268}