| 23 |
HERE="$HOME/test_${dNam}" |
HERE="$HOME/test_${dNam}" |
| 24 |
TST_DISK="/net/fs09/d1/jm_c" |
TST_DISK="/net/fs09/d1/jm_c" |
| 25 |
TST_DIR="$TST_DISK/test_${dNam}" |
TST_DIR="$TST_DISK/test_${dNam}" |
| 26 |
|
tmpFil="/tmp/"`basename $0`".$$" |
| 27 |
#- where local copy of code is (need to be consistent with run-job scripts): |
#- where local copy of code is (need to be consistent with run-job scripts): |
| 28 |
#srcDIR=$TST_DIR |
#srcDIR=$TST_DIR |
| 29 |
srcDIR=$HERE |
srcDIR=$HERE |
| 67 |
module list >> $LOG_FIL 2>&1 |
module list >> $LOG_FIL 2>&1 |
| 68 |
|
|
| 69 |
#- method to acces CVS: |
#- method to acces CVS: |
| 70 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
| 71 |
|
#- and which GitHub repository to use: |
| 72 |
|
git_repo='MITgcm'; git_code='MITgcm' |
| 73 |
|
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
| 74 |
|
|
|
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
|
|
#-- Download/Update reference version of MITgcm code: |
|
| 75 |
checkOut=1 |
checkOut=1 |
| 76 |
exp2add='' |
addExp='' |
| 77 |
updFile='updated_code' |
updFile='updated_code' |
| 78 |
|
|
| 79 |
if test $srcDIR = $TST_DIR ; then |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 80 |
echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL |
#-- Download/Update reference version of MITgcm code: |
| 81 |
cd $TST_DISK | tee -a $LOG_FIL 2>&1 |
if [ $checkOut -ge 1 ] ; then |
|
pwd | tee -a $LOG_FIL |
|
|
fi |
|
|
if test ! -d $srcDIR ; then |
|
|
echo -n "Creating a working dir: $srcDIR ..." | tee -a $LOG_FIL |
|
|
#/bin/rm -rf $srcDIR |
|
|
mkdir $srcDIR |
|
|
retVal=$? |
|
|
if test "x$retVal" != x0 ; then |
|
|
echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
cd $srcDIR |
|
|
pwd | tee -a $LOG_FIL |
|
| 82 |
|
|
| 83 |
#- remove date/lock-file: |
if test $srcDIR = $TST_DIR ; then |
| 84 |
if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi |
echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL |
| 85 |
|
cd $TST_DISK | tee -a $LOG_FIL 2>&1 |
| 86 |
|
pwd | tee -a $LOG_FIL |
| 87 |
|
fi |
| 88 |
|
if test ! -d $srcDIR ; then |
| 89 |
|
echo -n "Creating a working dir: $srcDIR ..." | tee -a $LOG_FIL |
| 90 |
|
#/bin/rm -rf $srcDIR |
| 91 |
|
mkdir $srcDIR |
| 92 |
|
retVal=$? |
| 93 |
|
if test "x$retVal" != x0 ; then |
| 94 |
|
echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL |
| 95 |
|
exit 1 |
| 96 |
|
fi |
| 97 |
|
fi |
| 98 |
|
cd $srcDIR |
| 99 |
|
pwd | tee -a $LOG_FIL |
| 100 |
|
|
| 101 |
if [ $checkOut -eq 1 ] ; then |
#- remove date/lock-file and old copy: |
| 102 |
if test -d $srcCode/CVS ; then |
if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi |
| 103 |
echo -n "Update dir $srcCode using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL |
test -e $srcCode && rm -rf $srcCode |
| 104 |
echo '' >> $LOG_FIL |
|
| 105 |
( cd $srcCode ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1 |
if [ $checkOut -eq 1 ] ; then |
| 106 |
RETVAL=$? |
if test -e $git_code/.git/config ; then |
| 107 |
if test "x$RETVAL" != x0 ; then echo '' |
echo -n "Updating current clone ( $git_code ) ..." | tee -a $LOG_FIL |
| 108 |
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
echo '' >> $LOG_FIL |
| 109 |
exit |
( cd $git_code ; git pull ) >> $LOG_FIL 2>&1 |
| 110 |
else echo " done" | tee -a $LOG_FIL |
retVal=$? |
| 111 |
|
if test "x$retVal" != x0 ; then echo '' |
| 112 |
|
echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL |
| 113 |
|
exit |
| 114 |
|
else echo " done" | tee -a $LOG_FIL |
| 115 |
|
fi |
| 116 |
|
else |
| 117 |
|
echo "missing file: $git_code/.git/config => try a new clone" | tee -a $LOG_FIL |
| 118 |
|
checkOut=2 |
| 119 |
fi |
fi |
|
else |
|
|
echo "no dir: $srcCode/CVS => try a fresh check-out" | tee -a $LOG_FIL |
|
|
checkOut=2 |
|
| 120 |
fi |
fi |
| 121 |
fi |
if [ $checkOut -eq 2 ] ; then |
| 122 |
if [ $checkOut -eq 2 ] ; then |
echo -n "Make a clone of $git_code from repo: $git_repo ..." | tee -a $LOG_FIL |
| 123 |
test -e $srcCode && rm -rf $srcCode |
git clone https://github.com/$git_repo/${git_code}.git 2> $tmpFil |
| 124 |
echo -n "Downloading using '$cmdCVS co -P -d $srcCode MITgcm' ..." | tee -a $LOG_FIL |
retVal=$? |
| 125 |
$cmdCVS co -P -d $srcCode MITgcm > /dev/null |
if test $retVal = 0 ; then |
| 126 |
RETVAL=$? |
echo ' --> done!' | tee -a $LOG_FIL |
| 127 |
if test "x$RETVAL" != x0 ; then echo '' | tee -a $LOG_FIL |
rm -f $tmpFil |
| 128 |
echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
else echo '' | tee -a $LOG_FIL |
| 129 |
exit |
echo " Error: 'git clone' returned: $retVal" | tee -a $LOG_FIL |
| 130 |
else echo " done" | tee -a $LOG_FIL |
cat $tmpFil ; rm -f $tmpFil |
| 131 |
fi |
exit 2 |
|
if test -d $srcCode/verification ; then |
|
|
for exp2add in $addExp ; do |
|
|
echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL |
|
|
( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \ |
|
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
|
|
done |
|
| 132 |
fi |
fi |
| 133 |
/usr/bin/find $srcCode -type d | xargs chmod g+rxs |
fi |
| 134 |
/usr/bin/find $srcCode -type f | xargs chmod g+r |
#---- making a new working copy: MITgcm_today |
| 135 |
fi |
( cd $git_code ; git checkout master ) |
| 136 |
|
rsync -a $git_code/ $srcCode --exclude '.git' |
| 137 |
|
if test -d $srcCode/verification ; then |
| 138 |
|
for exp2add in $addExp ; do |
| 139 |
|
echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL |
| 140 |
|
( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \ |
| 141 |
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
| 142 |
|
done |
| 143 |
|
fi |
| 144 |
|
/usr/bin/find $srcCode -type d | xargs chmod g+rxs |
| 145 |
|
/usr/bin/find $srcCode -type f | xargs chmod g+r |
| 146 |
|
#- update date/lock-file: |
| 147 |
|
if test -d $srcCode/verification ; then |
| 148 |
|
echo $today > $updFile ; sleep 2 |
| 149 |
|
ls -l $updFile | tee -a $LOG_FIL |
| 150 |
|
fi |
| 151 |
|
|
| 152 |
#- update date/lock-file: |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 153 |
if test -d $srcCode/verification ; then |
#-- Done with Download/Update of MITgcm code |
|
echo $today > $updFile ; sleep 2 |
|
|
ls -l $updFile | tee -a $LOG_FIL |
|
| 154 |
fi |
fi |
| 155 |
|
|
| 156 |
#-- leave TST Dir and go back to output dir |
#-- leave srcDIR and go back to output dir |
| 157 |
cd $OUT_DIR |
cd $OUT_DIR |
|
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
|
| 158 |
#-- now really do something: |
#-- now really do something: |
| 159 |
|
|
| 160 |
JOB_LIST=$TEST_LIST |
JOB_LIST=$TEST_LIST |
| 196 |
echo -n "--> $JOB : " | tee -a $LOG_FIL |
echo -n "--> $JOB : " | tee -a $LOG_FIL |
| 197 |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
| 198 |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
| 199 |
|
sleep 1 |
| 200 |
else |
else |
| 201 |
echo "--> $JOB :" | tee -a $LOG_FIL |
echo "--> $JOB :" | tee -a $LOG_FIL |
| 202 |
#$QSTAT | grep $JOB | tee -a $LOG_FIL |
#$QSTAT | grep $JOB | tee -a $LOG_FIL |