1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/nasa_ames/test_submit_pleiades,v 1.1 2017/04/20 22:14:26 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='ieee fast' |
12 |
else |
13 |
TEST_LIST=$* |
14 |
fi |
15 |
|
16 |
headNode=`hostname -s` |
17 |
QSUB="/PBS/bin/qsub" |
18 |
QSTAT="/PBS/bin/qstat -u $USER" |
19 |
#dNam=$headNode |
20 |
#QSUB="/usr/bin/sbatch" |
21 |
#QLIST="/usr/bin/squeue -u $USER" |
22 |
dNam='pleiades' |
23 |
HERE="$HOME/test_${dNam}" |
24 |
TST_DISK="/nobackupp2/$USER" |
25 |
TST_DIR="$TST_DISK/test_${dNam}" |
26 |
logPfix='test_clean' |
27 |
|
28 |
SUB_DIR="$HERE/nasa_ames" |
29 |
OUT_DIR="$HERE/output" |
30 |
LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log" |
31 |
SUB_DIR="$HERE/temp" |
32 |
|
33 |
#-- clean up old log files and start a new one: |
34 |
cd $OUT_DIR |
35 |
|
36 |
rm -f $logPfix.*.log_bak |
37 |
if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi |
38 |
echo -n '-- Starting: ' | tee -a $LOG_FIL |
39 |
date | tee -a $LOG_FIL |
40 |
|
41 |
n=$(( `ls $logPfix.*.log | wc -l` - 10 )) |
42 |
if test $n -gt 0 ; then |
43 |
echo ' remove old log files:' | tee -a $LOG_FIL |
44 |
ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL |
45 |
ls -t $logPfix.*.log | tail -"$n" | xargs rm -f |
46 |
fi |
47 |
|
48 |
#------------------------------------------------------------- |
49 |
# defaults |
50 |
#export PATH="$PATH:/usr/local/bin" |
51 |
if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi |
52 |
#- to get case insensitive "ls" (and order of tested experiments) |
53 |
export LC_ALL="en_US.UTF-8" |
54 |
# Turn off stack limit for FIZHI & AD-tests |
55 |
#ulimit -s unlimited |
56 |
|
57 |
if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi |
58 |
#- load standard modules: |
59 |
#module add fedora slurm maui svante |
60 |
#module add slurm |
61 |
module list >> $LOG_FIL 2>&1 |
62 |
|
63 |
#- method to acces CVS: |
64 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
65 |
|
66 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
67 |
|
68 |
echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL |
69 |
cd $TST_DISK | tee -a $LOG_FIL 2>&1 |
70 |
pwd | tee -a $LOG_FIL |
71 |
if test ! -d $TST_DIR ; then |
72 |
echo -n "Missing working dir: $TST_DIR ..." | tee -a $LOG_FIL |
73 |
echo " --> exit" | tee -a $LOG_FIL |
74 |
fi |
75 |
cd $TST_DIR |
76 |
pwd | tee -a $LOG_FIL |
77 |
|
78 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
79 |
#-- now really do something: |
80 |
|
81 |
for sfx in $TEST_LIST |
82 |
do |
83 |
gcmDIR="MITgcm_$sfx" |
84 |
echo " " | tee -a $LOG_FIL |
85 |
if test -d $gcmDIR/verification ; then |
86 |
echo "==>> Cleaning testing dir $gcmDIR" | tee -a $LOG_FIL |
87 |
( cd $gcmDIR/verification |
88 |
echo " run: ../tools/do_tst_2+2 -clean" | tee -a $LOG_FIL |
89 |
../tools/do_tst_2+2 -clean >> $LOG_FIL |
90 |
echo " running: clean_exp_fast mnc" | tee -a $LOG_FIL |
91 |
clean_exp_fast mnc >> $LOG_FIL |
92 |
echo " running: clean_exp_fast outp" | tee -a $LOG_FIL |
93 |
clean_exp_fast outp >> $LOG_FIL |
94 |
echo " running: clean_exp_fast Obj" | tee -a $LOG_FIL |
95 |
clean_exp_fast Obj >> $LOG_FIL |
96 |
) |
97 |
echo " <== cleaning $gcmDIR : Done" | tee -a $LOG_FIL |
98 |
else |
99 |
echo "Missing testing dir $gcmDIR" | tee -a $LOG_FIL |
100 |
fi |
101 |
done |
102 |
date | tee -a $LOG_FIL |
103 |
|
104 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
105 |
exit 0 |