CE-cms-remotestageout 2.31 KB
Newer Older
Andrea Sciaba's avatar
Andrea Sciaba committed
1
2
3
#!/bin/bash

# Source the CMS environment
4
#export SCRAM_ARCH=slc6_amd64_gcc493
Andrea Sciaba's avatar
Andrea Sciaba committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
         echo "ERROR: Cannot find CMS software in OSG node"
	 echo "summary: SW_DIR_UNDEF"
         exit $SAME_ERROR
    fi
elif [ -n "$VO_CMS_SW_DIR" ] ; then
    SW_DIR=$VO_CMS_SW_DIR
else
21
    SW_DIR=/cvmfs/cms.cern.ch
Andrea Sciaba's avatar
Andrea Sciaba committed
22
23
24
25
26
fi

tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
source $SW_DIR/cmsset_default.sh > $tmpfile 2>&1
result=$?
27
export BUILD_ARCH=$SCRAM_ARCH
Andrea Sciaba's avatar
Andrea Sciaba committed
28
29
30
31
32
33
34
35
36
if [ $result != 0 ]; then
    cat $tmpfile
    rm -f $tmpfile
    echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
    echo "summary: NO_SETUP_SCRIPT"
    exit $SAME_ERROR
fi
rm -f $tmpfile

37
38
39
arch=`cmsos`
echo "arch: $arch"

Andrea Sciaba's avatar
Andrea Sciaba committed
40
# Source libraries required by WMCore
41
42
43
44
45
if [[ $arch == slc6* ]]; then
    if [ -e $SW_DIR/COMP/slc6_amd64_gcc493/external/python/2.7.6/etc/profile.d/init.sh ] ; then
        source $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.1p/lib:$SW_DIR/COMP/slc6_amd64_gcc493/external/bz2lib/1.0.6/lib
    fi
Andrea Sciaba's avatar
Andrea Sciaba committed
46
47
fi

48
command -v python2.7 > /dev/null
Andrea Sciaba's avatar
Andrea Sciaba committed
49
50
rc=$?
if [ $rc != 0 ] ; then
51
52
    echo "ERROR: Python2.7 isn't available on this worker node."
    echo "summary: PYTHON_27_NOT_FOUND"
Andrea Sciaba's avatar
Andrea Sciaba committed
53
54
    exit $SAME_ERROR  
else
55
56
    echo -n "Python2.7: "
    echo `which python2.7`
Andrea Sciaba's avatar
Andrea Sciaba committed
57
58
59
60
61
    echo
fi

export PYTHONPATH=$SAME_SENSOR_HOME/cms-MC-test/lib/python2.6/site-packages:$PYTHONPATH

62
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
$SAME_SENSOR_HOME/tests/RuntimeSAMRemoteStageOut.py
rc=$?
69
if [ $rc == 1 ] ; then
Andrea Sciaba's avatar
Andrea Sciaba committed
70
71
72
    echo "ERROR: remote stageout failed"
    echo "summary: REMOTE_STAGEOUT_FAILED"
    exit $SAME_ERROR
73
elif [ $rc == 2 ] ; then
74
75
    echo "WARNING: remote stageout clenaup failed"
    echo "summary: REMOTE_STAGEOUT_CLEANUP_FAILED"
76
    exit $SAME_WARNING
Andrea Sciaba's avatar
Andrea Sciaba committed
77
78
79
else
    echo "Remote stageout successful"
    echo "summary: OK"
Andrea Sciaba's avatar
Andrea Sciaba committed
80
    exit $SAME_OK
Andrea Sciaba's avatar
Andrea Sciaba committed
81
fi