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

Update scripts for new directory structure

parent 85be8191
......@@ -2,8 +2,42 @@
set -e
if [ $# -ne 1 ]; then
echo "Usage: $0 diag140804.csh"
function usage () {
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
fi
......@@ -20,9 +54,7 @@ fi
module load ncl
module load nco
# Chmod the templated script for this stage
chmod 755 $1
/bin/csh $PWD/$SCRIPT || true
# Run the script on the service node
./$1 || true
exit 0
......@@ -3,7 +3,7 @@
set -e
function usage () {
echo "Usage: $0 -stage N"
echo "Usage: $0 -case CASENAME -stage N"
}
if [ $# -eq 0 ]; then
......@@ -13,6 +13,10 @@ fi
while [ $# -ne 0 ]; do
case "$1" in
-case)
shift
CASENAME=$1
;;
-stage)
shift
STAGE=$1
......@@ -25,36 +29,41 @@ while [ $# -ne 0 ]; do
shift
done
if [ -z "$CASENAME" ]; then
echo "ERROR: Specify -casename"
usage
exit 1
fi
if [ -z "$STAGE" ]; then
echo "ERROR: Specify -stage"
usage
exit 1
fi
# Get the case name
CASE=$(./xmlquery CASE -valonly -silent)
# Get the full path to the run directory
RUNDIR=$(./xmlquery RUNDIR -valonly -silent)
RUNDIR=$(cd $RUNDIR && pwd)
CASEROOT=$PWD/$CASENAME
# Get the workflow scratch directory
DIR=$(pwd)
# Make the stage output dir
STAGEDIR=$DIR/${CASE}-stage${STAGE}
STAGEDIR=$DIR/${CASENAME}-stage${STAGE}
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
# for the first stage
touch outputs_to_ignore
# 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
ln -s $f ${STAGEDIR}/$(basename $f)
done
# 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
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
......@@ -14,6 +14,10 @@ fi
CONTINUE_RUN=FALSE
while [ "$#" -ne 0 ]; do
case "$1" in
-case)
shift
CASENAME=$1
;;
-continue)
CONTINUE_RUN=TRUE
;;
......@@ -37,11 +41,18 @@ while [ "$#" -ne 0 ]; do
shift
done
echo CASENAME $CASENAME
echo STOP_N $STOP_N
echo STOP_OPTION $STOP_OPTION
echo CONTINUE_RUN $CONTINUE_RUN
echo STAGE $STAGE
if [ -z "$CASENAME" ]; then
echo "ERROR: Specify -case"
usage
exit 1
fi
if [ -z "$STAGE" ]; then
echo "ERROR: Specify -stage"
usage
......@@ -60,6 +71,14 @@ if [ -z "$STOP_OPTION" ]; then
exit 1
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
./xmlchange -file env_run.xml -id RESUBMIT -val 0
......@@ -78,12 +97,9 @@ fi
./xmlchange -file env_run.xml -id CHECK_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
# We use exitcode.successmessage to detect failures
./$CASE.run || true
/bin/csh ./$CASENAME.run || true
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