<commit_before>#!/bin/bash

## Load includes
if [ "x$CBF_HOME" = "x" ]; then DIRNAME=`dirname $0`; CBF_HOME=`cd $DIRNAME/..; pwd` ; fi; export CBF_HOME
. ${CBF_HOME}/bin/includes.sh

CONFIG=./conf/benchmark.xml
SLAVE_COUNT_ARG=""
TAILF=false
CBF_MASTER_PID=""

master_pid() {
   CBF_MASTER_PID=`ps -ef | grep "org.cachebench.LaunchMaster" | grep -v "grep" | awk '{print $2}'`
   return 
}

help_and_exit() {
  wrappedecho "Usage: "
  wrappedecho '  $ master.sh [-c CONFIG] [-s SLAVE_COUNT] [-status] [-stop]'
  wrappedecho ""
  wrappedecho "   -c       Path to the framework configuration XML file. Optional - if not supplied benchmark will load ./conf/benchmark.xml"
  wrappedecho ""
  wrappedecho "   -s       Number of slaves.  Defaults to maxSize attribute in framework configuration XML file."
  wrappedecho ""
  wrappedecho "   -t       After starting the benchmark it will run 'tail -f' on the master node's log file."
  wrappedecho ""
  wrappedecho "   -m       MASTER host[:port]. An optional override to override the host/port defaults that the master listens on."
  wrappedecho ""
  wrappedecho "   -h       Displays this help screen"
  wrappedecho ""

  exit 0
}


### read in any command-line params
while ! [ -z $1 ]
do
  case "$1" in
    "-status")
      master_pid;
      if [ -z "${CBF_MASTER_PID}" ] 
      then
        echo "Master not running." 
      else
        echo "Master is running, pid is ${CBF_MASTER_PID}." 
      fi 
      exit 0
      ;;
     "-stop")
      master_pid;
      if [ -z "${CBF_MASTER_PID}" ] 
      then
        echo "Master not running." 
      else
        kill -9 ${CBF_MASTER_PID}
        if [ $? ]
        then 
          echo "Successfully stopped master (pid=${CBF_MASTER_PID})"
        else 
          echo "Problems stopping master(pid=${CBF_MASTER_PID})";
        fi  
      fi 
      exit 0
      ;;
     "-s")<commit_msg>use SIGINT rather than SIGKILL<commit_after>#!/bin/bash

## Load includes
if [ "x$CBF_HOME" = "x" ]; then DIRNAME=`dirname $0`; CBF_HOME=`cd $DIRNAME/..; pwd` ; fi; export CBF_HOME
. ${CBF_HOME}/bin/includes.sh

CONFIG=./conf/benchmark.xml
SLAVE_COUNT_ARG=""
TAILF=false
CBF_MASTER_PID=""

master_pid() {
   CBF_MASTER_PID=`ps -ef | grep "org.cachebench.LaunchMaster" | grep -v "grep" | awk '{print $2}'`
   return 
}

help_and_exit() {
  wrappedecho "Usage: "
  wrappedecho '  $ master.sh [-c CONFIG] [-s SLAVE_COUNT] [-status] [-stop]'
  wrappedecho ""
  wrappedecho "   -c       Path to the framework configuration XML file. Optional - if not supplied benchmark will load ./conf/benchmark.xml"
  wrappedecho ""
  wrappedecho "   -s       Number of slaves.  Defaults to maxSize attribute in framework configuration XML file."
  wrappedecho ""
  wrappedecho "   -t       After starting the benchmark it will run 'tail -f' on the master node's log file."
  wrappedecho ""
  wrappedecho "   -m       MASTER host[:port]. An optional override to override the host/port defaults that the master listens on."
  wrappedecho ""
  wrappedecho "   -h       Displays this help screen"
  wrappedecho ""

  exit 0
}


### read in any command-line params
while ! [ -z $1 ]
do
  case "$1" in
    "-status")
      master_pid;
      if [ -z "${CBF_MASTER_PID}" ] 
      then
        echo "Master not running." 
      else
        echo "Master is running, pid is ${CBF_MASTER_PID}." 
      fi 
      exit 0
      ;;
     "-stop")
      master_pid;
      if [ -z "${CBF_MASTER_PID}" ] 
      then
        echo "Master not running." 
      else
        kill -15 ${CBF_MASTER_PID}
        if [ $? ]
        then 
          echo "Successfully stopped master (pid=${CBF_MASTER_PID})"
        else 
          echo "Problems stopping master(pid=${CBF_MASTER_PID})";
        fi  
      fi 
      exit 0
      ;;
     "-s")
{'fraction_non_alphanumeric': 0.12076271186440678, 'fraction_numerical': 0.004502118644067797, 'mean_word_length': 2.3813786929274845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3001114', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1251, 'n_words': 375}