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

Contents of /MITgcm_contrib/test_scripts/engaging/test_submit_engag

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


Revision 1.2 - (show annotations) (download)
Wed Oct 21 14:01:55 2015 UTC (9 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.1: +12 -17 lines
minor adjustments

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_submit_engag,v 1.1 2015/10/19 18:23:42 jmc Exp $
4 # $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 #SUB_DIR="$HERE/temp"
28
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 echo -n '-- Starting: ' | tee -a $LOG_FIL
35 date | tee -a $LOG_FIL
36
37 n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
38 if test $n -gt 0 ; then
39 echo ' remove old log files:' | tee -a $LOG_FIL
40 ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
41 ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
42 fi
43
44 . /etc/profile.d/modules.sh
45 module list >> $LOG_FIL 2>&1
46
47 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
48 #-- now really do something:
49
50 JOB_LIST=$TEST_LIST
51 NB_SUB_JOBS=0
52 for i in $JOB_LIST
53 do
54 case $i in
55 'o64Adm') sfx='op64_adm' ;;
56 'gfoTlm') sfx='gfo_tlm' ;;
57 *) sfx=${i}'_mpi' ;;
58 esac
59 BATCH_SCRIPT="test_engag_$sfx"
60 if test -f $SUB_DIR/$BATCH_SCRIPT ; then
61 JOB="tst_"$i
62 job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`
63 if test "x_$job_exist" = x_0 ; then
64 #-- move previous output file
65 outList=`ls $JOB.std??? 2> /dev/null`
66 if test "x$outList" != x ; then
67 echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
68 if test -d $OUT_DIR/prev ; then
69 for xx in $outList ; do
70 echo -n " $xx" | tee -a $LOG_FIL
71 mv -f $xx $OUT_DIR/prev
72 done
73 echo " to dir ./prev" | tee -a $LOG_FIL
74 else
75 echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
76 fi
77 else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
78 fi
79 #-- submit job
80 echo -n "--> $JOB : " | tee -a $LOG_FIL
81 $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
82 NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
83 else
84 echo "--> $JOB :" | tee -a $LOG_FIL
85 $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
86 echo ' job already exist => skip this test' | tee -a $LOG_FIL
87 fi
88 else
89 echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
90 fi
91 done
92 echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
93
94 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
95 exit 0

  ViewVC Help
Powered by ViewVC 1.1.22