/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_submit_svante
ViewVC logotype

Diff of /MITgcm_contrib/test_scripts/svante/test_submit_svante

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.16 by jmc, Sun Feb 4 21:03:20 2018 UTC revision 1.21 by jmc, Mon Feb 26 21:28:39 2018 UTC
# Line 23  dNam='svante' Line 23  dNam='svante'
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=$HERE  #srcDIR=$TST_DIR
29  srcDIR=$TST_DIR  srcDIR=$HERE
30  srcCode="MITgcm_today"  srcCode="MITgcm_today"
31    
32  logPfix='test_submit'  logPfix='test_submit'
# Line 65  if test -f /etc/profile.d/zz_modules.sh Line 66  if test -f /etc/profile.d/zz_modules.sh
66  module add slurm  module add slurm
67  module list                                             >> $LOG_FIL 2>&1  module list                                             >> $LOG_FIL 2>&1
68    
69  #- method to acces CVS:  #- method to access CVS:
70  cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'    cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
71    #- which GitHub repository to use and how to access it:
72      git_repo='MITgcm';  git_code='MITgcm'
73     #git_repo='altMITgcm'; #git_code='MITgcm66h'
74    #--
75      git_repo="https://github.com/$git_repo"
76     #git_repo="git://github.com/$git_repo"
77     #git_repo="git@github.com:$git_repo"
78    
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  
 #-- Download/Update reference version of MITgcm code:  
79  checkOut=1  checkOut=1
80  exp2add=''  addExp=''
81  updFile='updated_code'  updFile='updated_code'
82    
83  if test $srcDIR = $TST_DIR ; then  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
84    echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL  if [ $checkOut -ge 1 ] ; then
85    cd $TST_DISK  | tee -a $LOG_FIL 2>&1  #-- Download/Update reference version of MITgcm code:
   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  
86    
87  #- remove date/lock-file:    if test $srcDIR = $TST_DIR ; then
88  if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi      echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
89        cd $TST_DISK        | tee -a $LOG_FIL 2>&1
90        pwd                 | tee -a $LOG_FIL
91      fi
92      if test ! -d $srcDIR ; then
93         echo -n "Creating a working dir: $srcDIR ..."      | tee -a $LOG_FIL
94        #/bin/rm -rf $srcDIR
95         mkdir $srcDIR
96         retVal=$?
97         if test "x$retVal" != x0 ; then
98           echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
99           exit 1
100         fi
101      fi
102      cd $srcDIR
103      pwd           | tee -a $LOG_FIL
104    
105  if [ $checkOut -eq 1 ] ; then    #- remove date/lock-file and old copy:
106    if test -d $srcCode/CVS ; then    if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
107      echo -n "Update dir $srcCode using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL    test -e $srcCode && rm -rf $srcCode
108      echo '' >> $LOG_FIL  
109      ( cd $srcCode ; $cmdCVS update -P -d )              >> $LOG_FIL 2>&1    if [ $checkOut -eq 1 ] ; then
110      RETVAL=$?      if test -e $git_code/.git/config ; then
111      if test "x$RETVAL" != x0 ; then echo ''        ( cd $git_code ; git checkout master )                    | tee -a $LOG_FIL
112         echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL        echo -n "Updating current clone ( $git_code ) ..."        | tee -a $LOG_FIL
113         exit        echo '' >> $LOG_FIL
114      else echo "  done"                                  | tee -a $LOG_FIL        ( cd $git_code ; git pull )                               >> $LOG_FIL 2>&1
115          retVal=$?
116          if test "x$retVal" != x0 ; then echo ''
117             echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL
118             exit
119          else echo "  done"                                        | tee -a $LOG_FIL
120          fi
121        else
122          echo "missing file: $git_code/.git/config => try a new clone"     | tee -a $LOG_FIL
123          checkOut=2
124      fi      fi
  else  
     echo "no dir: $srcCode/CVS => try a fresh check-out"        | tee -a $LOG_FIL  
     checkOut=2  
125    fi    fi
126  fi    if [ $checkOut -eq 2 ] ; then
127  if [ $checkOut -eq 2 ] ; then      if test -e $git_code ; then
128      test -e $srcCode && rm -rf $srcCode         echo -n " removing dir: $git_code ..."           | tee -a $LOG_FIL
129      echo -n "Downloading using '$cmdCVS co -P -d $srcCode MITgcm' ..."  | tee -a $LOG_FIL         rm -rf $git_code
130      $cmdCVS co -P -d $srcCode MITgcm > /dev/null         echo "  done"                                    | tee -a $LOG_FIL
     RETVAL=$?  
     if test "x$RETVAL" != x0 ; then echo ''             | tee -a $LOG_FIL  
       echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL  
       exit  
     else echo "  done"                                  | tee -a $LOG_FIL  
131      fi      fi
132      if test -d $srcCode/verification ; then      echo -n "Make a clone of $git_code from repo: $git_repo ..."        | tee -a $LOG_FIL
133        for exp2add in $addExp ; do      git clone $git_repo/${git_code}.git 2> $tmpFil
134          echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL      retVal=$?
135          ( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \      if test $retVal = 0 ; then
136                         MITgcm_contrib/verification_other/$exp2add > /dev/null )         echo ' --> done!'                                | tee -a $LOG_FIL
137        done         rm -f $tmpFil
138        else echo ''                                        | tee -a $LOG_FIL
139           echo " Error: 'git clone' returned: $retVal"     | tee -a $LOG_FIL
140           cat $tmpFil ; rm -f $tmpFil
141           exit 2
142      fi      fi
143      /usr/bin/find $srcCode -type d | xargs chmod g+rxs    fi
144      /usr/bin/find $srcCode -type f | xargs chmod g+r    #---- making a new working copy: MITgcm_today
145  fi    rsync -a $git_code/ $srcCode --exclude '.git'
146      ls -ld $srcCode                                       | tee -a $LOG_FIL
147      if test -d $srcCode/verification ; then
148        for exp2add in $addExp ; do
149          echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
150          ( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \
151                        MITgcm_contrib/verification_other/$exp2add > /dev/null )
152        done
153      fi
154      /usr/bin/find $srcCode -type d | xargs chmod g+rxs
155      /usr/bin/find $srcCode -type f | xargs chmod g+r
156      #- update date/lock-file:
157      if test -d $srcCode/verification ; then
158        echo $today > $updFile ; sleep 2
159        ls -l $updFile                                      | tee -a $LOG_FIL
160        echo ''                                             | tee -a $LOG_FIL
161      fi
162    
163  #- update date/lock-file:  #-- Done with Download/Update of MITgcm code
 if test -d $srcCode/verification ; then  
   echo $today > $updFile ; sleep 2  
   ls -l $updFile                                        | tee -a $LOG_FIL  
164  fi  fi
165    #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
166    
167  #-- leave TST Dir and go back to output dir  #-- leave srcDIR and go back to output dir
168  cd $OUT_DIR  cd $OUT_DIR
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  
169  #-- now really do something:  #-- now really do something:
170    
171    JOB_LIST=$TEST_LIST    JOB_LIST=$TEST_LIST
# Line 182  cd $OUT_DIR Line 207  cd $OUT_DIR
207            echo -n "--> $JOB : "                         | tee -a $LOG_FIL            echo -n "--> $JOB : "                         | tee -a $LOG_FIL
208            $QSUB $SUB_DIR/$BATCH_SCRIPT                  | tee -a $LOG_FIL            $QSUB $SUB_DIR/$BATCH_SCRIPT                  | tee -a $LOG_FIL
209            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
210              sleep 1
211        else        else
212            echo "--> $JOB :"                             | tee -a $LOG_FIL            echo "--> $JOB :"                             | tee -a $LOG_FIL
213            #$QSTAT | grep $JOB                           | tee -a $LOG_FIL            #$QSTAT | grep $JOB                           | tee -a $LOG_FIL

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.22