Commit 23a06941 authored by Stefano Belforte's avatar Stefano Belforte
Browse files

test gLite JobWrapper

parent 370bfeaa
#!/bin/sh
info=0
note=0
warning=0
error=0
cat $SAME_SENSOR_HOME/tests/CMS-SAM-Banner.html
echo '<h1><a href="#summary">Jump to test summary</a></h1>'
echo "<h2>Preliminary checks</h2>"
echo "<pre>"
echo "version 2-11 13:00"
set -x
uname -a
date
voms-proxy-info -identity -fqan
id
cp -v $SAME_SENSOR_HOME/tests/fetch-from-web .
#ls -l fetch-from-web
cp -v $SAME_SENSOR_HOME/tests/CMS-SAM-Banner.html .
env|grep SAME
set +x
echo "</pre>"
echo "<h2>Checking software directory for CMS VO</h2>"
if [ -n "$OSG_APP" ] ; then
SW_DIR=$OSG_APP/cmssoft/cms
[ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
echo "Checking variable: \$OSG_APP/cmssoft/cms=$OSG_APP/cmssoft/cms"
elif [ -n "$VO_CMS_SW_DIR" ] ; then
SW_DIR=$VO_CMS_SW_DIR
echo "Checking variable: \$VO_CMS_SW_DIR=$VO_CMS_SW_DIR"
else
echo "ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined"
echo "summary: SW_DIR_UNDEF"
exit $SAME_ERROR
fi
echo "<pre>"
set -x
ls -ld $SW_DIR
result=$?
set +x
echo "</pre>"
echo
if [ $result != 0 ]
then
echo "ERROR: software directory non existent or non readable"
echo "summary: NO_SW_DIR"
exit $SAME_ERROR
fi
if [ ! -f $SW_DIR/cmsset_default.sh ] ; then
echo "<h3>"
echo "ERROR: cmssw setup file $SW_DIR/cmsset_default.sh not existing"
echo "</h3>"
echo "summary: NO_SETUP_SCRIPT"
exit $SAME_ERROR
fi
echo "<h2>Sourcing the CMS environment</h2>"
export SCRAM_ARCH=slc4_ia32_gcc345
echo "<pre>"
source $SW_DIR/cmsset_default.sh
result=$?
echo "</pre>"
if [ $result != 0 ]
then
echo "<h3>"
echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
echo "summary: NO_SETUP_SCRIPT"
echo "</h3>"
exit $SAME_ERROR
fi
echo "<h2>Make sure configuration directory is there</h2>"
echo "Checking variable: \$CMS_PATH=$CMS_PATH"
echo "<p>"
if [ -z $CMS_PATH ]; then
echo "<h3>"
echo "ERROR: CMS_PATH not defined"
echo "summary: CMS_PATH_UNDEF"
echo "</h3>"
exit $SAME_ERROR
fi
if [ ! -d $CMS_PATH ] ; then
echo "<h3>"
echo "ERROR: CMS_PATH directory $CMS_PATH not existing"
echo "summary: NO_CMS_PATH"
echo "</h3>"
exit $SAME_ERROR
fi
if [ ! -d $CMS_PATH/SITECONF/local/JobConfig ] ; then
echo "<h3>"
echo "ERROR: JobConfig directory $CMS_PATH/SITECONF/local/JobConfig not existing"
echo "summary: NO_JOBCONFIG_DIR"
echo "</h3>"
exit $SAME_ERROR
fi
pid=$$;
ppid=`ps -oppid --no-headers -p ${pid}`
echo "<p>"
echo "OK"
pid=${ppid}
ppid=`ps -oppid --no-headers -p ${pid}`
command=`ps -ocommand --no-headers -p ${pid}`
while ! echo ${command} | grep 'UI=000000'; do
pid=${ppid}
[ ${pid} -ne 0 ] || break;
ppid=`ps -oppid --no-headers -p ${pid}`
command=`ps -ocommand --no-headers -p ${pid}`
done
echo "<h2>Make sure configuration file exists</h2>"
jw_file=`echo ${command} | awk '{print $2}'`
ConfigFile=${CMS_PATH}/SITECONF/local/JobConfig/site-local-config.xml
echo "Configuration file: $ConfigFile"
echo "<p>"
echo \$jw_file = $jw_file
ls -l $jw_file
#cat $jw_file
if [ ! -f $ConfigFile ] ; then
echo "<h3>"
echo "ERROR: Local Configuration file site-local-config.xml not existing"
echo "summary: NO_SITELOCALCONFIG"
echo "</h3>"
exit $SAME_ERROR
fi
echo "<p>"
echo "OK"
echo "dump of Local Configuration file is <a href=\"#CfgDump\">here</a>"
cp $jw_file ./JobWrapper
echo "<h2>Make sure local configuration file has entries for TriviaFileCatalog,
local stage, site name and Squid</h2>"
grep jobid_to_filename JobWrapper|head -1
grep maradona= JobWrapper
grep ce_application_dir JobWrapper |head -1
grep -q "trivialcatalog" $ConfigFile
status=$?
if [ $status != 0 ] ; then
echo "ERROR: TrivialFileCatlog string missing"
errorSummary="summary: NO_TFC"
error=1
fi
jobid_to_filename=`grep jobid_to_filename JobWrapper|head -1|cut -d= -f2|tr -d \"`
maradonaFile=${jobid_to_filename}.output
ls -l ${maradonaFile}
ce_application_dir=`grep ce_application_dir JobWrapper |head -1|cut -d= -f2|tr -d \"`
grep -q "local-stage-out" $ConfigFile
status=$?
if [ $status != 0 ] ; then
echo "ERROR: LocalStageOut string missing"
errorSummary="summary: NO_LOCALSTAGEOUT"
error=1
fi
echo " "
echo "================================================="
echo " "
grep -q "site name" $ConfigFile
status=$?
if [ $status != 0 ] ; then
echo "ERROR: site name string missing"
errorSummary="summary: NO_SiteName"
error=1
fi
echo \$ce_application_dir = $ce_application_dir
echo \$maradonaFile = $maradonaFile
echo \$VO_CMS_SW_DIR = $VO_CMS_SW_DIR
ls -ld ${ce_application_dir}/
ls -ld ${ce_application_dir}/cms
ls -l ${ce_application_dir}/lcg-jobwrapper-hook.sh
ls -l ${ce_application_dir}/cms/lcg-jobwrapper-hook.sh
grep -q "frontier-connect" $ConfigFile
status=$?
if [ $status != 0 ] ; then
echo "ERROR: Frontier Configuration string missing"
errorSummary="summary: NO_FRONTIER_CONFIG"
error=1
fi
if [ $error == 0 ] ; then
echo "<p>"
echo "OK"
fi
echo "<p>"
echo "<h2>Make sure TFC file is where config file says it should be</h2>"
TFCfile=`grep "trivialcatalog" $ConfigFile | cut -d':' -f2| cut -d'?' -f1|head -1`
echo "Checking file: $TFCfile"
if [ ! -f $TFCfile ] ; then
echo "ERROR: TrivialFileCatalg $TFCfile not existing"
errorSummary="summary: NO_TFC file"
error=1
fi
#if [ $err == 1 ] ; then
# exit $SAME_ERROR
#fi
echo "<p>"
echo "OK"
echo "<p>"
if [ $error == 1 ] ; then
echo "<h3>"
echo "ERROR: invalid local configuration file $ConfigFile"
echo $errorSummary
echo "</h3>"
fi
echo "<h2>Compare local configuration file and TFC with CVS</h2>"
siteName=`grep "site name" $ConfigFile | grep -v "subsite name" | cut -d'"' -f2`
echo "<pre>"
let seconds=`date +%s`-`stat -c%Y $ConfigFile`
let localConfigFileAgeInHours=$seconds/3600
echo local configuration file ${ConfigFile} is ${localConfigFileAgeInHours} hours old
echo siteName = $siteName
subSiteName=`grep "subsite name" $ConfigFile | cut -d'"' -f2`
_subSiteName=
if [ "x$subSiteName" == "x" ] ; then
echo "subSiteName =" $subSiteName
else
echo "subSiteName =" $subSiteName
_subSiteName=_`echo $subSiteName`
fi
echo "<br>"
asCvs=1
cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/JobConfig/site-local-config${_subSiteName}.xml?rev=HEAD&content-type=text/plain\""
ConfigFileFromCVS=`mktemp /tmp/site-local-config-from-CVS.xml.XXX`
echo "Fetch CVS copy of local config from $cvsUrl<br>"
./fetch-from-web $cvsUrl $ConfigFileFromCVS
rc=$?
echo "rc = $rc <br>"
[ $rc == $SAME_INFO ] && info=1
[ $rc == $SAME_WARNING ] && warning=1
#if [ $rc == $SAME_WARNING ] || [ $rc == $SAME_ERROR ] ; then
# echo "<br>INFO: failed to access CVS Web repository<bre>"
#else
echo "</pre>"
if [ $rc == $SAME_OK ] || [ $rc == $SAME_INFO ] ; then
diff -q -w -B $ConfigFile $ConfigFileFromCVS
if [ $? == 1 ] ; then asCvs=0; fi
echo "<br>"
if [ $asCvs == 0 ] ; then
if [ $localConfigFileAgeInHours -gt 72 ] ; then
error=1
echo "<strong>ERROR: local site configuration file differ from CVS</strong>"
else
warning=1
echo "<strong>WARNING: local site configuration file differ from CVS</strong>"
echo "<br>will become error if this difference lasts more then 72h"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $ConfigFile $ConfigFileFromCVS > $diffList
echo "<pre>"
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
rm -f $diffList
else
echo "OK local site configuration file agrees with CVS copy"
echo "<br>"
fi
rm -f $ConfigFileFromCVS
else
echo "<br>INFO: failed to access CVS Web repository<bre>"
info=1
fi
echo "<br>"
echo "dump of Local Configuration file is <a href=\"#CfgDump\">here</a>"
echo "<br>"
TFCfileName=`echo $TFCfile | awk -F'/' '{print $NF}'`
echo "<pre>"
let seconds=`date +%s`-`stat -c%Y $ConfigFile`
let localTFCfileAgeInHours=$seconds/3600
echo local configuration file ${TFCfile} is ${localTFCfileAgeInHours} hours old
#cat $maradonaFile
asCvs=1
#cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/storage${_subSiteName}.xml?rev=HEAD&content-type=text/plain\""
cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/${TFCfileName}?rev=HEAD&content-type=text/plain\""
tar czf tutto.tgz . --exclude test.out
echo TFCfileName: $TFCfileName
echo cvsUrl $cvsUrl
echo "</pre>"
TfcFileFromCVS=`mktemp /tmp/storage-from-CVS.xml.XXXX`
echo "Fetch CVS copy of TFC from $cvsUrl<br>"
./fetch-from-web $cvsUrl $TfcFileFromCVS
rc=$?
echo "rc = $rc <br>"
[ $rc == $SAME_INFO ] && info=1
[ $rc == $SAME_WARNING ] && warning=1
#if [ $rc == $SAME_WARNING ] || [ $rc == $SAME_ERROR ] ; then
# echo "<br>INFO: failed to access CVS Web repository<bre>"
#else
echo "</pre>"
if [ $rc == $SAME_OK ] || [ $rc == $SAME_INFO ] ; then
diff -q -w -B $TFCfile $TfcFileFromCVS
if [ $? == 1 ] ; then asCvs=0; fi
echo "<br>"
if [ $asCvs == 0 ] ; then
if [ $localTFCfileAgeInHours -gt 72 ] ; then
error=1
echo "<strong>ERROR: local Trivial Catalog File file differ from CVS</strong>"
else
echo "<strong>WARNING: local Trivial Catalog File differ from CVS</strong>"
echo "<br>will become error if this difference lasts more then 72h"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $TFCfile $TfcFileFromCVS > $diffList
echo "<pre>"
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
rm -f $diffList
else
echo "OK local Trivial File Catalog file agrees with CVS copy"
echo "<br>"
fi
rm -f $TfcFileFromCVS
else
echo "<br>INFO: failed to access CVS Web repository<bre>"
info=1
fi
echo "<p>dump of TFC file is <a href=\"#TFCDump\">here</a>"
echo "<p>"
echo "<h2>Verify presence of commands needed for remote stageout</h2>"
echo "Needs at least ( lcg_utils 1.6.7 and gfal 1.10.8 ) or ( srmcp 2.0 ) "
echo "<p>"
echo "<pre>"
stageOutError=1
which lcg-cp
rc=$?
if [ $rc == 0 ] ; then
lcg-cp --version
lcgVersion=`lcg-cp --version|grep "lcg_util"|cut -d'-' -f2`
gfalVersion=`lcg-cp --version|grep GFAL|cut -d'-' -f3`
lcgV1=`echo $lcgVersion|cut -d. -f1`
lcgV2=`echo $lcgVersion|cut -d. -f2`
lcgV3=`echo $lcgVersion|cut -d. -f3`
gfalV1=`echo $gfalVersion|cut -d. -f1`
gfalV2=`echo $gfalVersion|cut -d. -f2`
gfalV3=`echo $gfalVersion|cut -d. -f3`
lcgOK=0
if [ $lcgV1 -gt 1 ] ; then
lcgOK=1
else
if [ $lcgV1 -eq 1 ] && [ $lcgV2 -gt 6 ] ; then
lcgOK=1
else
if [ $lcgV2 -eq 6 ] && [ $lcgV3 -ge 7 ] ; then
lcgOK=1
fi
fi
fi
gfalOK=0
if [ $gfalV1 -gt 1 ] ; then
gfalOK=1
else
if [ $gfalV1 -eq 1 ] && [ $gfalV2 -gt 10 ] ; then
gfalOK=1
else
if [ $gfalV2 -eq 10 ] && [ $gfalV3 -ge 8 ] ; then
gfalOK=1
fi
fi
fi
if [ $lcgOK == 1 ] ; then
if [ $gfalOK == 1 ] ; then
stageOutError=0
fi
fi
fi
echo "</pre><p><pre>"
which srmcp
rc=$?
if [ $rc == 0 ] ; then
srmcp -version | grep -v WARNING
srmcpVersion=`srmcp -version 2>&1|egrep "Client version"|awk '{print $(NF)'}`
srmcpV1=`echo $srmcpVersion|cut -d. -f1`
srmcpV2=`echo $srmcpVersion|cut -d. -f2`
# srmcpV3=`echo $srmcpVersion|cut -d. -f3`
if [ $srmcpV1 -ge 2 ] ; then
stageOutError=0
fi
fi
echo "</pre>"
if [ $stageOutError == 1 ] ; then
echo "ERROR: No validated command for remote stageout available"
error=1
else
echo "OK"
fi
echo "<p>"
echo "<p>"
echo "<hr>"
echo "<p>"
echo "<h2>Dump of local configuration files</h2><br>"
echo "<h3><a name="CfgDump"></a>Configuration File Dump</h3><pre>"
cat $ConfigFile | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
set +x
echo "<h3><a name="TFCDump"></a>TFC file Dump</h3><pre>"
cat $TFCfile | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
echo '<h1><a name="summary"> Test Summary</a></h1><p>'
if [ $error == 1 ]
then
echo "<p><strong> ERROR </strong></p>"
exit $SAME_ERROR
fi
if [ $warning == 1 ]
then
echo "<p><strong> WARNING </strong></p>"
exit $SAME_WARNING
fi
if [ $note == 1 ]
then
echo "<p><strong> NOTE </strong></p>"
exit $SAME_NOTE
fi
if [ $info == 1 ]
then
echo "<p><strong> INFO </strong></p>"
exit $SAME_INFO
fi
echo "<p><strong> OK </strong></p>"
exit $SAME_OK
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment