/[MITgcm]/MITgcm_contrib/test_scripts/engaging/test_submit_engag
ViewVC logotype

Diff of /MITgcm_contrib/test_scripts/engaging/test_submit_engag

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

revision 1.1 by jmc, Mon Oct 19 18:23:42 2015 UTC revision 1.6 by jmc, Tue Apr 3 00:29:40 2018 UTC
# Line 8  dInWeek=`date +%a` Line 8  dInWeek=`date +%a`
8    
9  if test $# = 0  if test $# = 0
10  then  then
11    TEST_LIST='gnu mp2 adm pgi path mth op64 tuv'    TEST_LIST='o64Adm gfoTlm ifcMp2 ifcMpi'
   TEST_LIST='o64Adm gfoTlm'  
  #if test "x$dInWeek" = xSat ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi  
12   #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi   #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi
13  else  else
14    TEST_LIST=$*    TEST_LIST=$*
15  fi  fi
16    
17  QSUB="/usr/bin/sbatch"  QSUB="/usr/bin/sbatch"
18  QSTAT="/usr/bin/qstat"  #QSTAT="/usr/bin/qstat -u $USER"
19    QLIST="/usr/bin/squeue -u $USER"
20  dNam='engaging'  dNam='engaging'
21  HERE="$HOME/test_$dNam"  HERE="$HOME/test_$dNam"
22  TST_DIR="/pool001/jm_c/test_$dNam"  TST_DIR="/pool001/jm_c/test_$dNam"
# Line 26  logPfix='test_submit' Line 25  logPfix='test_submit'
25  SUB_DIR="$HERE/engaging"  SUB_DIR="$HERE/engaging"
26  OUT_DIR="$HERE/output"  OUT_DIR="$HERE/output"
27  LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"  LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
28    #SUB_DIR="$HERE/temp"
29    
30  #-- clean up old log files and start a new one:  #-- clean up old log files and start a new one:
31  cd $OUT_DIR  cd $OUT_DIR
32    
33  rm -f $logPfix.*.log_bak  rm -f $logPfix.*.log_bak
34  if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi  if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
35  echo -n '-- Starting: ' | tee -a $LOG_FIL  echo -n '-- Starting: '                                 | tee -a $LOG_FIL
36  date | tee -a $LOG_FIL  date                                                    | tee -a $LOG_FIL
37    
38  n=$(( `ls $logPfix.*.log | wc -l` - 10 ))  n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
39  if test $n -gt 0 ; then  if test $n -gt 0 ; then
40    echo ' remove old log files:' | tee -a $LOG_FIL    echo ' remove old log files:'                         | tee -a $LOG_FIL
41      ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL      ls -lt $logPfix.*.log | tail -"$n"                  | tee -a $LOG_FIL
42      ls -t  $logPfix.*.log | tail -"$n" | xargs rm -f      ls -t  $logPfix.*.log | tail -"$n" | xargs rm -f
43  fi  fi
44    
45  . /etc/profile.d/modules.sh  if test -f /etc/profile.d/modules.sh ; then
46  module list >> $LOG_FIL 2>&1    . /etc/profile.d/modules.sh
47    fi
48    module list                                             >> $LOG_FIL 2>&1
49    
 #-- now really do something:  
 #cd $HERE  
50  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
51    #-- now really do something:
52    
53    JOB_LIST=$TEST_LIST    JOB_LIST=$TEST_LIST
54    NB_SUB_JOBS=0    NB_SUB_JOBS=0
# Line 56  module list >> $LOG_FIL 2>&1 Line 57  module list >> $LOG_FIL 2>&1
57      case $i in      case $i in
58        'o64Adm') sfx='op64_adm' ;;        'o64Adm') sfx='op64_adm' ;;
59        'gfoTlm') sfx='gfo_tlm' ;;        'gfoTlm') sfx='gfo_tlm' ;;
60               *) sfx=${i}'_mpi'  ;;        *) sfx=`echo ${i} | sed '/Mp.$/s/Mp/_mp/'` ;;
61      esac      esac
62      BATCH_SCRIPT="test_engag_$sfx"      BATCH_SCRIPT="test_engag_$sfx"
63      if test -f $SUB_DIR/$BATCH_SCRIPT ; then      if test -f $SUB_DIR/$BATCH_SCRIPT ; then
64        JOB="tst_"$i        #- job name ( $JOB ) & output-file name ( $JOB.std??? ) must match
65        job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`        #  definition within $BATCH_SCRIPT slurm script
66          JOB="${i}_tst"
67          sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c
68          #job_exist=`$QSTAT | grep $JOB | wc -l`
69          job_exist=`$QLIST | grep $sJob | wc -l`
70        if test "x_$job_exist" = x_0 ; then        if test "x_$job_exist" = x_0 ; then
71          #-- move previous output file          #-- move previous output file
72          outList=`ls $JOB.std??? 2> /dev/null`          outList=`ls $JOB.std??? 2> /dev/null`
73          if test "x$outList" != x ; then          if test "x$outList" != x ; then
74            echo -n " moving job $JOB old output files:"            echo -n " moving job $JOB old output files:"  | tee -a $LOG_FIL
75            if test -d $OUT_DIR/prev ; then            if test -d $OUT_DIR/prev ; then
76              for xx in $outList ; do              for xx in $outList ; do
77                echo -n " $xx"                pp=$OUT_DIR/prev/$xx ; echo -n " $xx"     | tee -a $LOG_FIL
78                mv -f $xx $OUT_DIR/prev                test -f $pp.sav && mv -f $pp.sav $pp.old
79                  test -f $pp     && mv -f $pp     $pp.sav
80                  chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
81              done              done
82              echo " to dir $OUT_DIR/prev"              echo " to dir ./prev"                       | tee -a $LOG_FIL
83            else            else
84              echo " <-- missing dir $OUT_DIR/prev"              echo " <-- missing dir $OUT_DIR/prev"       | tee -a $LOG_FIL
85            fi            fi
86          else echo " no old output files from job '$JOB'"          else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
87          fi          fi
88          #-- submit job          #-- submit job
89            echo -n " $JOB : " | tee -a $LOG_FIL            echo -n "--> $JOB : "                         | tee -a $LOG_FIL
90            $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL            $QSUB $SUB_DIR/$BATCH_SCRIPT                  | tee -a $LOG_FIL
          #eval M_$i='submitted'  
91            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
92        else        else
93            echo $JOB | tee -a $LOG_FIL            echo "--> $JOB :"                             | tee -a $LOG_FIL
94            $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL            $QSTAT -a | grep $USER | grep $JOB            | tee -a $LOG_FIL
95            echo 'job already exist => skip this test' | tee -a $LOG_FIL            echo ' job already exist => skip this test'   | tee -a $LOG_FIL
          #eval M_$i='skipped'  
96        fi        fi
97      else      else
98         echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL         echo 'no file:' $BATCH_SCRIPT 'to submit'        | tee -a $LOG_FIL
       #eval M_$i='skipped'  
99      fi      fi
100    done    done
101    echo " info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL    echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'"      >> $LOG_FIL
102      echo -n '-- Finished at: '                            | tee -a $LOG_FIL
103      date                                                  | tee -a $LOG_FIL
104    
105  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
106  exit 0  exit 0

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.22