Commit 84106ab3 authored by Juve, Gideon's avatar Juve, Gideon
Browse files

Update scripts for new directory structure

parent 85be8191
...@@ -2,8 +2,42 @@ ...@@ -2,8 +2,42 @@
set -e set -e
if [ $# -ne 1 ]; then function usage () {
echo "Usage: $0 diag140804.csh" echo "Usage: $0 -case CASENAME -script diag140804.csh"
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
while [ "$#" -ne 0 ]; do
case "$1" in
-case)
shift
CASENAME=$1
;;
-script)
shift
SCRIPT=$1
;;
*)
usage
exit 1
;;
esac
shift
done
if [ -z "$CASENAME" ]; then
usage
echo "ERROR: Specify CASENAME"
exit 1
fi
if [ -z "$SCRIPT" ]; then
usage
echo "ERROR: Specify SCRIPT"
exit 1 exit 1
fi fi
...@@ -20,9 +54,7 @@ fi ...@@ -20,9 +54,7 @@ fi
module load ncl module load ncl
module load nco module load nco
# Chmod the templated script for this stage /bin/csh $PWD/$SCRIPT || true
chmod 755 $1
# Run the script on the service node exit 0
./$1 || true
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
set -e set -e
function usage () { function usage () {
echo "Usage: $0 -stage N" echo "Usage: $0 -case CASENAME -stage N"
} }
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
...@@ -13,6 +13,10 @@ fi ...@@ -13,6 +13,10 @@ fi
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case "$1" in case "$1" in
-case)
shift
CASENAME=$1
;;
-stage) -stage)
shift shift
STAGE=$1 STAGE=$1
...@@ -25,36 +29,41 @@ while [ $# -ne 0 ]; do ...@@ -25,36 +29,41 @@ while [ $# -ne 0 ]; do
shift shift
done done
if [ -z "$CASENAME" ]; then
echo "ERROR: Specify -casename"
usage
exit 1
fi
if [ -z "$STAGE" ]; then if [ -z "$STAGE" ]; then
echo "ERROR: Specify -stage" echo "ERROR: Specify -stage"
usage usage
exit 1 exit 1
fi fi
# Get the case name CASEROOT=$PWD/$CASENAME
CASE=$(./xmlquery CASE -valonly -silent)
# Get the full path to the run directory
RUNDIR=$(./xmlquery RUNDIR -valonly -silent)
RUNDIR=$(cd $RUNDIR && pwd)
# Get the workflow scratch directory # Get the workflow scratch directory
DIR=$(pwd) DIR=$(pwd)
# Make the stage output dir # Make the stage output dir
STAGEDIR=$DIR/${CASE}-stage${STAGE} STAGEDIR=$DIR/${CASENAME}-stage${STAGE}
mkdir $STAGEDIR mkdir $STAGEDIR
# Get the full path to the run directory
RUNDIR=$(cd $CASEROOT && ./xmlquery RUNDIR -valonly -silent)
RUNDIR=$(cd $RUNDIR && pwd)
# Touch this file here so that it will always exist, even if it is empty # Touch this file here so that it will always exist, even if it is empty
# for the first stage # for the first stage
touch outputs_to_ignore touch outputs_to_ignore
# For each of the new files # For each of the new files
for f in $(ls ${RUNDIR}/${CASE}.* ${RUNDIR}/*.log.*.gz ${RUNDIR}/rpointer.* | grep -v -f outputs_to_ignore); do for f in $(ls ${RUNDIR}/${CASENAME}.* ${RUNDIR}/*.log.*.gz ${RUNDIR}/rpointer.* | grep -v -f outputs_to_ignore); do
# Symlink it to the output dir # Symlink it to the output dir
ln -s $f ${STAGEDIR}/$(basename $f) ln -s $f ${STAGEDIR}/$(basename $f)
done done
# Update the ignore file to ignore outputs from the current stage # Update the ignore file to ignore outputs from the current stage
ls ${RUNDIR}/${CASE}.* ${RUNDIR}/*.log.* > outputs_to_ignore ls ${RUNDIR}/${CASENAME}.* ${RUNDIR}/*.log.* > outputs_to_ignore
#!/bin/bash #!/bin/bash -l
set -e set -e
function usage () { function usage () {
echo "Usage: $0 [-continue] -stage N -stop STOP_OPTION -n STOP_N" echo "Usage: $0 [-continue] -case CASENAME -stage N -stop STOP_OPTION -n STOP_N"
} }
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
...@@ -14,6 +14,10 @@ fi ...@@ -14,6 +14,10 @@ fi
CONTINUE_RUN=FALSE CONTINUE_RUN=FALSE
while [ "$#" -ne 0 ]; do while [ "$#" -ne 0 ]; do
case "$1" in case "$1" in
-case)
shift
CASENAME=$1
;;
-continue) -continue)
CONTINUE_RUN=TRUE CONTINUE_RUN=TRUE
;; ;;
...@@ -37,11 +41,18 @@ while [ "$#" -ne 0 ]; do ...@@ -37,11 +41,18 @@ while [ "$#" -ne 0 ]; do
shift shift
done done
echo CASENAME $CASENAME
echo STOP_N $STOP_N echo STOP_N $STOP_N
echo STOP_OPTION $STOP_OPTION echo STOP_OPTION $STOP_OPTION
echo CONTINUE_RUN $CONTINUE_RUN echo CONTINUE_RUN $CONTINUE_RUN
echo STAGE $STAGE echo STAGE $STAGE
if [ -z "$CASENAME" ]; then
echo "ERROR: Specify -case"
usage
exit 1
fi
if [ -z "$STAGE" ]; then if [ -z "$STAGE" ]; then
echo "ERROR: Specify -stage" echo "ERROR: Specify -stage"
usage usage
...@@ -60,6 +71,14 @@ if [ -z "$STOP_OPTION" ]; then ...@@ -60,6 +71,14 @@ if [ -z "$STOP_OPTION" ]; then
exit 1 exit 1
fi fi
export CASENAME
export CASEROOT=$PWD/$CASENAME
cd $CASENAME
# Make sure that the run directory is correct
./xmlchange -file env_run.xml -id RUNDIR -val $CASEROOT/run
# We never want to resubmit the jobs in the Pegasus workflow # We never want to resubmit the jobs in the Pegasus workflow
./xmlchange -file env_run.xml -id RESUBMIT -val 0 ./xmlchange -file env_run.xml -id RESUBMIT -val 0
...@@ -78,12 +97,9 @@ fi ...@@ -78,12 +97,9 @@ fi
./xmlchange -file env_run.xml -id CHECK_TIMING -val FALSE ./xmlchange -file env_run.xml -id CHECK_TIMING -val FALSE
./xmlchange -file env_run.xml -id SAVE_TIMING -val FALSE ./xmlchange -file env_run.xml -id SAVE_TIMING -val FALSE
# Get the case name
CASE=$(./xmlquery CASE -valonly -silent)
# This script often returns non-zero, so we need to mask the failure # This script often returns non-zero, so we need to mask the failure
# We use exitcode.successmessage to detect failures # We use exitcode.successmessage to detect failures
./$CASE.run || true /bin/csh ./$CASENAME.run || true
exit 0 exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment