-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
208 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
#PBS -N jobname | ||
#PBS -q casper | ||
#PBS -l walltime=12:00:00 | ||
#PBS -A P93300641 | ||
#PBS -j oe | ||
#PBS -k eod | ||
#PBS -l select=1:ncpus=1 | ||
#PBS -W depend=afterok:JOB_ID | ||
|
||
#tether submits thiscase (affixing finidat), | ||
#and presubmits nextcase with afterok:thiscase | ||
JOBDIR='/glade/u/home/djk2120/clm5ppe/jobscripts/' | ||
bash $JOBDIR"tether.sh" prevcase scratch thiscase joblist template | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
#PBS -N jobname | ||
#PBS -q premium | ||
#PBS -l walltime=12:00:00 | ||
#PBS -A P93300641 | ||
#PBS -j oe | ||
#PBS -k eod | ||
#PBS -l select=1:ncpus=1 | ||
#PBS -W depend=afterok:JOB_ID | ||
|
||
#tether submits thiscase (affixing finidat), | ||
#and presubmits nextcase with afterok:thiscase | ||
JOBDIR='/glade/u/home/djk2120/clm5ppe/jobscripts/' | ||
bash $JOBDIR"tether.sh" prevcase scratch thiscase joblist template | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
prevcase=$1 | ||
scratch=$2 | ||
thiscase=$3 | ||
joblist=$4 | ||
template=$5 | ||
|
||
cd $thiscase | ||
|
||
|
||
|
||
#handle finidat | ||
if [ $prevcase != 'none' ]; then | ||
#comment out any finidat from user_nl_clm | ||
:> user_nl_clm.tmp | ||
while read line; do | ||
if [[ $line != *"finidat"* ]]; then | ||
echo $line>>user_nl_clm.tmp | ||
else | ||
echo '!'$line>>user_nl_clm.tmp | ||
fi | ||
done<user_nl_clm | ||
mv user_nl_clm.tmp user_nl_clm | ||
|
||
#find the appropirate restart file | ||
casename=${prevcase##*/} | ||
restart=$scratch$casename'/run/'$casename".clm2.r."*".nc" | ||
restart=$(echo $restart) #expands wildcard | ||
|
||
#append to user_nl_clm | ||
echo -e 'finidat="'$restart'"'>>user_nl_clm | ||
fi | ||
|
||
#submit case, capturing JOB_ID | ||
./case.submit > submit_out | ||
JOB_ID=$(grep "Submitted job id is" submit_out | tail -1 | cut -f 5 -d' ') | ||
|
||
#presubmit next case, if any are left | ||
njobs=$(wc -l < $joblist) | ||
if (( $njobs > 0 ));then | ||
#read next job from joblist | ||
nextcase=$(head -n 1 $joblist) | ||
echo "nextcase="$nextcase | ||
|
||
#cp joblist to nextcase, removing nextcase | ||
tail -n +2 $joblist > file.tmp | ||
mv file.tmp $nextcase'/'$joblist | ||
|
||
#prepare the next job submission | ||
casename=${nextcase##*/} | ||
nextjob=$nextcase"/"$casename".presubmission" | ||
cp $template $nextjob | ||
|
||
sed -i -e 's:JOB_ID:'$JOB_ID':g' $nextjob | ||
sed -i -e 's:jobname:pre_'$casename':g' $nextjob | ||
sed -i -e 's:prevcase:'$thiscase':g' $nextjob | ||
sed -i -e 's:scratch:'$scratch':g' $nextjob | ||
sed -i -e 's:thiscase:'$nextcase':g' $nextjob | ||
sed -i -e 's:joblist:'$joblist':g' $nextjob | ||
sed -i -e 's:template:'$template':g' $nextjob | ||
|
||
#presubmit the next job | ||
qsub $nextjob | ||
|
||
|
||
fi |