Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/ksh
############################## standard interface to /sw tools
# Input:
# Environment variables
# SW_BLDDIR current directory (PWD) minus /autofs/na1_ stuff
# SW_ENVFILE file to be sourced which has alternate prog environment
# only to be used in special circumstances
# SW_WORKDIR work dir that local script can use
# Output:
# Return code of 0=success or 1=failure or 2=job submitted
#
# Notes:
# If this script is called from swtest, then swtest requires
# SW_WORKDIR to be set. Then swtest adds a unique path to what
# user gave swtest (action+timestamp+build) and provides this
# script with a uniquely valued SW_WORKDIR. swtest will
# automatically remove this unique workspace when retest is done.
##################################################################
# exit 3 is a signal to the sw infrastructure that this template has not
# been updated; please delete it when ready
if [ -z $SW_BLDDIR ]; then
echo "Error: SW_BLDDIR not set!"
exit 1
else
cd $SW_BLDDIR
fi
if [ -z $SW_ENVFILE ]; then
### Set Environment (do not remove this line only change what is in between)
. ${MODULESHOME}/init/ksh
. ${SW_BLDDIR}/remodule
### End Environment (do not remove this line only change what is in between)
else
. $SW_ENVFILE
fi
############################## app specific section
#
set -o verbose
#clear out status file since re-testing
rm -f status
cd $SW_WORKDIR
#-- Four things are required in the PBS script such that it can be followed
# correctly by jenkins:
# 1. The PBS_JOBID (given upon submission with 'qsub') needs to be written
# to the ${SW_BLDDIR}/.running file on submission
# 2. The main output of the test (i.e. typically "aprun" command output)
# needs to be appended to ${SW_BLDDIR}/.running as the test runs
# 3. If the test succeed, the first line of $SW_BLDDIR/status file must be
# the string "verified"
# 4. ${SW_BLDDIR}/.running must be removed after the test completes
cat > ${PACKAGE}.pbs << EOF
#!/bin/bash
#PBS -N ${PACKAGE}
#PBS -j oe
#PBS -l nodes=1:ppn=32,walltime=30:00
set -o verbose
cd \$PBS_O_WORKDIR
TIME="/usr/bin/time -f 'elapsed %e'"
UPTIME=/usr/bin/uptime
Reuben D. Budiardja
committed
module load xalt/0.7.1
export W_APRUN=\$(which aprun)
export R_APRUN=/usr/bin/aprun
Reuben D. Budiardja
committed
#-- directdb
export XALT_TRANSMISSION_STYLE=directdb
echo "W_APRUN: \$W_APRUN" | tee -a ${SW_BLDDIR}/.running
echo "XALT_TRANSMISSION_STYLE: \$XALT_TRANSMISSION_STYLE" | tee -a ${SW_BLDDIR}/.running
eval \$TIME \$W_APRUN -n 1 \$UPTIME 2>&1 | tee x_aprun_directdb.log | tee -a ${SW_BLDDIR}/.running
#-- file
export XALT_TRANSMISSION_STYLE=file
echo "W_APRUN: \$W_APRUN" | tee -a ${SW_BLDDIR}/.running
echo "XALT_TRANSMISSION_STYLE: \$XALT_TRANSMISSION_STYLE" | tee -a ${SW_BLDDIR}/.running
eval \$TIME \$W_APRUN -n 1 \$UPTIME 2>&1 | tee x_aprun_file.log | tee -a ${SW_BLDDIR}/.running
#-- syslog
export XALT_TRANSMISSION_STYLE=syslog
echo "W_APRUN: \$W_APRUN" | tee -a ${SW_BLDDIR}/.running
Reuben D. Budiardja
committed
echo "XALT_TRANSMISSION_STYLE: \$XALT_TRANSMISSION_STYLE" | tee -a ${SW_BLDDIR}/.running
eval \$TIME \$W_APRUN -n 1 \$UPTIME 2>&1 | tee x_aprun_syslog.log | tee -a ${SW_BLDDIR}/.running
echo "R_APRUN: \$R_APRUN" | tee -a ${SW_BLDDIR}/.running
eval \$TIME \$R_APRUN -n 1 \$UPTIME 2>&1 | tee r_aprun.log | tee -a ${SW_BLDDIR}/.running
echo "verified" > ${SW_BLDDIR}/status
Reuben D. Budiardja
committed
grep elapsed x_aprun_directdb.log | grep -v time | awk '{print "YVALUE=",\$2}' \
| sed 's/ //g' > ${SW_BLDDIR}/x_aprun_directdb
grep elapsed x_aprun_file.log | grep -v time | awk '{print "YVALUE=",\$2}' \
| sed 's/ //g' > ${SW_BLDDIR}/x_aprun_file
grep elapsed x_aprun_syslog.log | grep -v time | awk '{print "YVALUE=",\$2}' \
| sed 's/ //g' > ${SW_BLDDIR}/x_aprun_syslog
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
grep elapsed r_aprun.log | grep -v time | awk '{print "YVALUE=",\$2}' \
| sed 's/ //g' > ${SW_BLDDIR}/r_aprun
JOBID=\`echo \$PBS_JOBID | cut -d "." -f1 \`
chmod 775 ${SW_BLDDIR}/status
rm ${SW_BLDDIR}/.running
cat \${JOBID}.OU >> ${SW_BLDDIR}/test.log
cat ${PACKAGE}.log >> ${SW_BLDDIR}/test.log
chmod 664 ${SW_BLDDIR}/test.log
EOF
#submit job and touch .running file - marker to infrastructure that
qsub ${PACKAGE}.pbs > ${SW_BLDDIR}/.running
# qsub returns 0 on successful job launch, so if failure return 1
if [ $? -ne 0 ]; then
echo "Error submitting job"
rm -f .running
exit 1
else
echo "Job submitted"
cat ${SW_BLDDIR}/.running
exit 2
fi
cd ../
cd ../../
############################### if this far, return 0
exit 0