<commit_before>#!/bin/bash
# pick a java
JAVA=/usr/bin/java
NAME=databridge

# Gets the directory of the script
SCRIPT_HOME="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_HOME}" ]) then
  while([ -h "${SCRIPT_HOME}" ]) do SCRIPT_HOME=`readlink "${SCRIPT_HOME}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_HOME}` > /dev/null
SCRIPT_HOME=`pwd`;
popd  > /dev/null

# DATABRIDGE_HOME is the next directory above this script
DATABRIDGE_HOME="${SCRIPT_HOME%/*}"

# The Databridge bin directory
DATABRIDGE_BIN=${DATABRIDGE_HOME}/bin/

# System jars have to be here
DATABRIDGE_SYSTEM_JARS=${DATABRIDGE_HOME}/bin/system

# Contributed jars have to be here
DATABRIDGE_CONTRIBUTED_JARS=${DATABRIDGE_HOME}/bin/contrib

# Get the DATABRIDGE config dir
DATABRIDGE_CONFIG_DIR=${DATABRIDGE_HOME}/config

# Get the DATABRIDGE run dir
DATABRIDGE_RUN_DIR=${DATABRIDGE_HOME}/run

# Get the DATABRIDGE log dir
DATABRIDGE_LOG_DIR=${DATABRIDGE_HOME}/log

batch_pid_file=${DATABRIDGE_RUN_DIR}/batch.pid

batch_stdout_file=${DATABRIDGE_LOG_DIR}/batch.log

batch_stderr_file=${DATABRIDGE_LOG_DIR}/batch.log

get_batch_pid() {
   cat ${batch_pid_file}
}

is_batch_running() {
    [ -f "$batch_pid_file" ] && ps `get_batch_pid` > /dev/null 2>&1
}


is_running() {
    is_batch_running
}
# Find the config file<commit_msg>Actually does the correct process checking now.<commit_after>#!/bin/bash
# pick a java
JAVA=/usr/bin/java
NAME=databridge

# Gets the directory of the script
SCRIPT_HOME="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_HOME}" ]) then
  while([ -h "${SCRIPT_HOME}" ]) do SCRIPT_HOME=`readlink "${SCRIPT_HOME}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_HOME}` > /dev/null
SCRIPT_HOME=`pwd`;
popd  > /dev/null

# DATABRIDGE_HOME is the next directory above this script
DATABRIDGE_HOME="${SCRIPT_HOME%/*}"

# The Databridge bin directory
DATABRIDGE_BIN=${DATABRIDGE_HOME}/bin/

# System jars have to be here
DATABRIDGE_SYSTEM_JARS=${DATABRIDGE_HOME}/bin/system

# Contributed jars have to be here
DATABRIDGE_CONTRIBUTED_JARS=${DATABRIDGE_HOME}/bin/contrib

# Get the DATABRIDGE config dir
DATABRIDGE_CONFIG_DIR=${DATABRIDGE_HOME}/config

# Get the DATABRIDGE run dir
DATABRIDGE_RUN_DIR=${DATABRIDGE_HOME}/run

# Get the DATABRIDGE log dir
DATABRIDGE_LOG_DIR=${DATABRIDGE_HOME}/log

batch_pid_file=${DATABRIDGE_RUN_DIR}/batch.pid

batch_stdout_file=${DATABRIDGE_LOG_DIR}/batch.log

batch_stderr_file=${DATABRIDGE_LOG_DIR}/batch.log

get_batch_pid() {
   cat ${batch_pid_file}
}

log() {
    printf '%s\n' "$@" >> debug.log
}

is_batch_running_orig() {
    [ -f "$batch_pid_file" ] && ps `get_batch_pid` > /dev/null 2>&1
}

test_pid() {
    ps_out=`ps -ef | grep $1 | grep -v 'grep'`
    #result=$(echo $ps_out | grep "$1")
    if [[ !  -z  $ps_out ]];then
        return 0
    else
        return 1
    fi
}

is_batch_running() {
    [ -f "$batch_pid_file" ] && test_pid `get_batch_pid` > /dev/null 2>&1
}

is_running() {
    is_batch_running
}
# Find the config file
{'fraction_non_alphanumeric': 0.13705583756345177, 'fraction_numerical': 0.0040609137055837565, 'mean_word_length': 5.057377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2327397', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1182, 'n_words': 236}