File:  [Local Repository] / badi / public_scripts / parallelstarter / biogeme / parallelstarter.prepare_process_start
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 18 11:49:04 2011 UTC (12 years, 10 months ago) by adi
Branches: ik, MAIN
CVS tags: main, HEAD
from IVT CVS

# prepare to execute a single biogeme run

# prepare environment
STARTMSG="Starting $RUN_BIN with arguments $RUN_ARGS"
id="$(($RUN_COUNT+1+$RUN_COUNT_OFFSET))"
myargs="$(sed -n "${id}p" "$BIOGEME_ARGS_FILE")"
RUN_NAME="`echo $(echo "$myargs" | awk -F ':' '{print $1}')`"
MODEL_NAME="`echo $(echo "$myargs" | awk -F ':' '{print $2}')`"
DATA_FILENAME="`echo $(echo "$myargs" | awk -F ':' '{print $3}')`"
mydir="$RUN_NAME""$RUN_DIR_PREFIX"

# move old dirs out of the way
if [ -e "$mydir" ]; then
	$SPEAK && echo "$RUN_BIN directory exists: $mydir. Renaming directory."
	mv "$mydir" "$mydir.$(basename `mktemp -u`)"
fi

# create process home
mkdir "$mydir"

# create links
ln -s "../$MODEL_DIRNAME/$MODEL_NAME.mod" "$mydir/$RUN_NAME.mod"
ln -s "../$DATA_DIRNAME/$DATA_FILENAME" "$mydir/$RUN_NAME.dat"
# check for special parameter file
if [ -e "../$MODEL_DIRNAME/$MODEL_NAME.par" ]; then
	ln -s "../$MODEL_DIRNAME/$MODEL_NAME.par" "$mydir/$RUN_NAME.par"
elif [ -e "$MODEL_DIRNAME/default.par" ]; then
	ln -s "../$MODEL_DIRNAME/default.par" "$mydir/default.par"
fi

cd "$mydir"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>