CE-cms-mc 2.65 KB
Newer Older
Andrea Sciaba's avatar
Andrea Sciaba committed
1
2
#!/bin/bash

Andrea Sciaba's avatar
Andrea Sciaba committed
3
4
/usr/bin/id

Andrea Sciaba's avatar
Andrea Sciaba committed
5
# Source the CMS environment
6
7
8
9
10
11
12
13
14
if [ -n "$OSG_GRID" ] ; then
    [ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
    if [ -d $OSG_APP/cmssoft/cms ] ;then
         SW_DIR=$OSG_APP/cmssoft/cms
    elif [ -d $CVMFS/cms.cern.ch ] ; then
         SW_DIR=$CVMFS/cms.cern.ch
    elif [ -d /cvmfs/cms.cern.ch ] ; then
         SW_DIR=/cvmfs/cms.cern.ch
    else
Andrea Sciaba's avatar
Andrea Sciaba committed
15
16
         echo "ERROR: Cannot find CMS software in OSG node"
	 echo "summary: SW_DIR_UNDEF"
17
18
         exit $SAME_ERROR
    fi
19
20
elif [ -n "$VO_CMS_SW_DIR" ] ; then
    SW_DIR=$VO_CMS_SW_DIR
Andrea Sciaba's avatar
Andrea Sciaba committed
21
else
22
    SW_DIR=/cvmfs/cms.cern.ch
Andrea Sciaba's avatar
Andrea Sciaba committed
23
fi
Andrea Sciaba's avatar
Andrea Sciaba committed
24
25
tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
source $SW_DIR/cmsset_default.sh > $tmpfile 2>&1
26
27
export BUILD_ARCH=$SCRAM_ARCH
echo "SCRAM_ARCH: $SCRAM_ARCH"
Andrea Sciaba's avatar
Andrea Sciaba committed
28
result=$?
Andrea Sciaba's avatar
Andrea Sciaba committed
29
30
31
32
33
if [ $result != 0 ]; then
    cat $tmpfile
    rm -f $tmpfile
    echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
    echo "summary: NO_SETUP_SCRIPT"
Andrea Sciaba's avatar
Andrea Sciaba committed
34
35
    exit $SAME_ERROR
fi
Andrea Sciaba's avatar
Andrea Sciaba committed
36
rm -f $tmpfile
Andrea Sciaba's avatar
Andrea Sciaba committed
37

38
39
40
41
42
43
44
arch=`cmsos`
echo "arch: $arch"
if [[ $arch == slc6* ]]; then
    ls -l $SW_DIR/COMP/slc6_amd64_gcc493/external/python/2.7.6/etc/profile.d/init.sh
    . $SW_DIR/COMP/slc6_amd64_gcc493/external/python/2.7.6/etc/profile.d/init.sh
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SW_DIR/COMP/slc6_amd64_gcc493/external/openssl/1.0.1r/lib:$SW_DIR/COMP/slc6_amd64_gcc493/external/bz2lib/1.0.6/lib
fi
Andrea Sciaba's avatar
Andrea Sciaba committed
45
46
47

echo $LD_LIBRARY_PATH

Andrea Sciaba's avatar
Andrea Sciaba committed
48
command -v python2.7 > /dev/null
Andrea Sciaba's avatar
Andrea Sciaba committed
49
50
51
rc=$?
if [[ $rc != 0 ]]
then
Andrea Sciaba's avatar
Andrea Sciaba committed
52
53
54
    echo "ERROR: Python2.7 isn't available on this worker node." >&2
    echo "ERROR: WMCore/WMAgent REQUIRES python2.7" >&2
    echo "summary: PYTHON_27_NOT_FOUND"
Andrea Sciaba's avatar
Andrea Sciaba committed
55
    exit $SAME_ERROR  
Andrea Sciaba's avatar
Andrea Sciaba committed
56
else
Andrea Sciaba's avatar
Andrea Sciaba committed
57
58
    echo "WMAgent found python2.7 at..."
    echo `which python2.7`
Andrea Sciaba's avatar
Andrea Sciaba committed
59
    echo
Andrea Sciaba's avatar
Andrea Sciaba committed
60
61
fi
export PYTHONPATH=$SAME_SENSOR_HOME/cms-MC-test/lib/python2.6/site-packages:$PYTHONPATH
Andrea Sciaba's avatar
Andrea Sciaba committed
62

Andrea Sciaba's avatar
Andrea Sciaba committed
63
64
65
66
set > startup_environment.sh
sed -e 's/^/export /' startup_environment.sh > tmp_env.sh
mv -f tmp_env.sh startup_environment.sh
export JOBSTARTDIR=$PWD
Andrea Sciaba's avatar
Andrea Sciaba committed
67
68
69

cd $SAME_SENSOR_HOME/cms-MC-test/
if [ $? -ne 0 ]; then
Andrea Sciaba's avatar
Andrea Sciaba committed
70
71
   echo "ERROR: Could not access the cms-MC-test directory"
   echo "summary: TEST_CODE_DIR_NOT_FOUND"
Andrea Sciaba's avatar
Andrea Sciaba committed
72
73
74
   exit $SAME_ERROR
else
  chmod u+x RuntimeSAMStageOut.py 
75
  ./RuntimeSAMStageOut.py > RuntimeSAMStageOut.out 2>&1
Andrea Sciaba's avatar
Andrea Sciaba committed
76
  EXIT_STATUS=$?
Andrea Sciaba's avatar
Andrea Sciaba committed
77
  cat RuntimeSAMStageOut.out
Andrea Sciaba's avatar
Andrea Sciaba committed
78
fi
Andrea Sciaba's avatar
Andrea Sciaba committed
79

80
if [ $EXIT_STATUS -ne 0 -a $EXIT_STATUS -ne 4 ] ; then
Andrea Sciaba's avatar
Andrea Sciaba committed
81
82
   echo "ERROR: Stage Out Test failed: $EXIT_STATUS"
   echo "summary: STAGEOUT_FAILED"
Andrea Sciaba's avatar
Andrea Sciaba committed
83
   exit $SAME_ERROR
84
elif [ $EXIT_STATUS -eq 4 ]; then
Andrea Sciaba's avatar
Andrea Sciaba committed
85
86
   echo "WARNING: Stage Out Test failed to cleanup the test file: $EXIT_STATUS"
   exit "summary: CLEANUP_FAILED"
87
   exit $SAME_WARNING 
Andrea Sciaba's avatar
Andrea Sciaba committed
88
else
Andrea Sciaba's avatar
Andrea Sciaba committed
89
90
   echo "Stage Out Test successful"
   echo "summary: OK"
Andrea Sciaba's avatar
Andrea Sciaba committed
91
92
   exit $SAME_OK
fi