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

Annotation of /MITgcm_contrib/test_scripts/engaging/test_submit_engag

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


Revision 1.3 - (hide annotations) (download)
Sat Nov 7 18:35:41 2015 UTC (9 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.2: +25 -19 lines
minor adjustments

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_submit_engag,v 1.2 2015/10/21 14:01:55 jmc Exp $
4 jmc 1.1 # $Name: $
5    
6     today=`date +%Y%m%d`
7     dInWeek=`date +%a`
8    
9     if test $# = 0
10     then
11     TEST_LIST='o64Adm gfoTlm'
12     #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi
13     else
14     TEST_LIST=$*
15     fi
16    
17     QSUB="/usr/bin/sbatch"
18     QSTAT="/usr/bin/qstat"
19     dNam='engaging'
20     HERE="$HOME/test_$dNam"
21     TST_DIR="/pool001/jm_c/test_$dNam"
22     logPfix='test_submit'
23    
24     SUB_DIR="$HERE/engaging"
25     OUT_DIR="$HERE/output"
26     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
27 jmc 1.2 #SUB_DIR="$HERE/temp"
28 jmc 1.1
29     #-- clean up old log files and start a new one:
30     cd $OUT_DIR
31    
32     rm -f $logPfix.*.log_bak
33     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
34 jmc 1.3 echo -n '-- Starting: ' | tee -a $LOG_FIL
35     date | tee -a $LOG_FIL
36 jmc 1.1
37     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
38     if test $n -gt 0 ; then
39 jmc 1.3 echo ' remove old log files:' | tee -a $LOG_FIL
40     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
41 jmc 1.1 ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
42     fi
43    
44 jmc 1.3 if test -f /etc/profile.d/modules.sh ; then
45     . /etc/profile.d/modules.sh
46     fi
47     module list >> $LOG_FIL 2>&1
48 jmc 1.1
49 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
50 jmc 1.1 #-- now really do something:
51    
52     JOB_LIST=$TEST_LIST
53     NB_SUB_JOBS=0
54     for i in $JOB_LIST
55     do
56     case $i in
57     'o64Adm') sfx='op64_adm' ;;
58     'gfoTlm') sfx='gfo_tlm' ;;
59     *) sfx=${i}'_mpi' ;;
60     esac
61     BATCH_SCRIPT="test_engag_$sfx"
62     if test -f $SUB_DIR/$BATCH_SCRIPT ; then
63     JOB="tst_"$i
64     job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`
65     if test "x_$job_exist" = x_0 ; then
66     #-- move previous output file
67     outList=`ls $JOB.std??? 2> /dev/null`
68     if test "x$outList" != x ; then
69 jmc 1.3 echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
70 jmc 1.1 if test -d $OUT_DIR/prev ; then
71     for xx in $outList ; do
72 jmc 1.3 pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL
73     test -f $pp.sav && mv -f $pp.sav $pp.old
74     test -f $pp && mv -f $pp $pp.sav
75     chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
76 jmc 1.1 done
77 jmc 1.3 echo " to dir ./prev" | tee -a $LOG_FIL
78 jmc 1.1 else
79 jmc 1.3 echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
80 jmc 1.1 fi
81 jmc 1.2 else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
82 jmc 1.1 fi
83     #-- submit job
84 jmc 1.3 echo -n "--> $JOB : " | tee -a $LOG_FIL
85     $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
86 jmc 1.1 NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
87     else
88 jmc 1.3 echo "--> $JOB :" | tee -a $LOG_FIL
89     $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
90     echo ' job already exist => skip this test' | tee -a $LOG_FIL
91 jmc 1.1 fi
92     else
93 jmc 1.3 echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
94 jmc 1.1 fi
95     done
96 jmc 1.3 echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
97     echo -n '-- Finished at: ' | tee -a $LOG_FIL
98     date | tee -a $LOG_FIL
99 jmc 1.1
100     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
101     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22