<commit_before># this script must be invoked inside of bash, not plain sh

infosection() {
	echo >>"$INFO"
	echo "_____________________________________________________________________________" >>"$INFO"
	echo >>"$INFO"
	echo "        $1" >>"$INFO" 
	echo "_____________________________________________________________________________" >>"$INFO"
	echo >>"$INFO"
}

info() {
	infosection "uname -a"
	uname -a 2>&1 >>"$INFO"
	infosection "id"
	id 2>&1 >>"$INFO"
	infosection "env"
	env 2>&1 >>"$INFO"
	infosection "df"
	df 2>&1 >>"$INFO"
	infosection "/proc/cpuinfo"
	cat /proc/cpuinfo 2>&1 >>"$INFO"
	infosection "/proc/meminfo"
	cat /proc/meminfo 2>&1 >>"$INFO"
}

logstate() {
	echo "Progress " `date +"%Y-%m-%e %H:%M:%S%z"` " $@" >>"$INFO"
}

log() {
	echo "$@" >>"$INFO"
}

fail() {
	EC=$1
	shift
	echo $@ >"$WFDIR/status/$JOBDIR/${ID}-error"
	log $@
	info
	#exit $EC
	#let vdl-int.k handle the issues
	exit 0
}

checkError() {
	if [ "$?" != "0" ]; then
		fail $@
	fi
}

checkEmpty() {
	if [ "$1" == "" ]; then
		shift
		fail 254 $@
	fi
}

getarg() {<commit_msg>fix incorrect date formatting in wrapper logging - was padding single digit day-of-month with space rather than 0, which makes logs harder to parse.<commit_after># this script must be invoked inside of bash, not plain sh

infosection() {
	echo >>"$INFO"
	echo "_____________________________________________________________________________" >>"$INFO"
	echo >>"$INFO"
	echo "        $1" >>"$INFO" 
	echo "_____________________________________________________________________________" >>"$INFO"
	echo >>"$INFO"
}

info() {
	infosection "uname -a"
	uname -a 2>&1 >>"$INFO"
	infosection "id"
	id 2>&1 >>"$INFO"
	infosection "env"
	env 2>&1 >>"$INFO"
	infosection "df"
	df 2>&1 >>"$INFO"
	infosection "/proc/cpuinfo"
	cat /proc/cpuinfo 2>&1 >>"$INFO"
	infosection "/proc/meminfo"
	cat /proc/meminfo 2>&1 >>"$INFO"
}

logstate() {
	echo "Progress " `date +"%Y-%m-%d %H:%M:%S%z"` " $@" >>"$INFO"
}

log() {
	echo "$@" >>"$INFO"
}

fail() {
	EC=$1
	shift
	echo $@ >"$WFDIR/status/$JOBDIR/${ID}-error"
	log $@
	info
	#exit $EC
	#let vdl-int.k handle the issues
	exit 0
}

checkError() {
	if [ "$?" != "0" ]; then
		fail $@
	fi
}

checkEmpty() {
	if [ "$1" == "" ]; then
		shift
		fail 254 $@
	fi
}

getarg() {
{'fraction_non_alphanumeric': 0.19752540874944763, 'fraction_numerical': 0.018117543084401236, 'mean_word_length': 4.122171945701357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 73, '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': '6094072', 'n_tokens_mistral': 903, 'n_tokens_neox': 864, 'n_words': 226}