7 # $ALICE_ROOT/TPC/macros/testTPC/agent.sh /afs/cern.ch/user/m/miranov/public/test2008/reckr191xx
9 # Or submit as many agents you want on batch machines:
10 # bsub -q 1nd $ALICE_ROOT/TPC/macros/testTPC/agent.sh /afs/cern.ch/user/m/miranov/public/test2008/reckr191xx
13 # AGENT to run some action:
14 # 3 components to be present
17 # 0. CREATE ACTION LIST ( see $ALICE_ROOT/TPC/macros/testTPC/AlienToolkit.cxx)
20 # 1. WORKING DIRECTORY SETUP (in prev. example /afs/cern.ch/user/m/miranov/public/test2008/reckr191xx)
22 # 1.b empty out directory
23 # 1.c macros directory -with <action>.C - e.g rec.C FindKrClustersRaw.C
26 # 2. ENVIRONMENT SETUP:
28 # 2.a Copy the script to setup aliroot root to the ~/.bagentsetup
29 # 2.b Export envirnment variables needed OCDB_PATH, AGENTINPUTTYPE, AGENTSE in the .bagentsetup script
30 # 2.c Get a valid token: alien-token-init
31 # 2.d Copy certificates to default place - ~/.agentauth/
32 # cp /tmp/*$UID* ~/.agentauth/
40 echo xxxxxxxxxxxxxxxxxxxxxxxxx
41 echo xxxxxxxxxxxxxxxxxxxxxxxxx
42 echo xxxxxxxxxxxxxxxxxxxxxxxxx
45 echo GSHELL_ROOT - $GSHELL_ROOT
47 echo ALIROOT =`which aliroot`
48 echo ROOT =`which root`
49 echo xxxxxxxxxxxxxxxxxxxxxxxxx
50 echo xxxxxxxxxxxxxxxxxxxxxxxxx
51 echo xxxxxxxxxxxxxxxxxxxxxxxxx
52 cp ~/.agentauth/* /tmp/
53 source /tmp/gclient_env_$UID
54 export PATH=.:${GSHELL_ROOT}/bin:${PATH}.
58 # test if ~/.bagentsetup exists
59 if [ ! -f ~/.bagentsetup ]; then
60 echo "ERROR: '~/.bagentsetup' init script not found\!"
65 echo xxxxxxxxxxxxxxxxxxxxxxxxx
67 echo ALIROOT =`which aliroot`
68 echo ROOT =`which root`
69 echo xxxxxxxxxxxxxxxxxxxxxxxxx
73 if [ "x$AGENTINPUTTYPE" == "x" ]; then
74 echo "WARNING: environment variable 'AGENTINPUTTYPE' falling back to default (castor)\!\!"
75 export AGENTINPUTTYPE=2
77 if [ "x$OCDB_PATH" == "x" ]; then
78 echo "WARNING: environment variable 'OCDB_PATH' falling back to default (local:///afs/cern.ch/alice/tpctest/OCDB)\!\!"
79 export OCDB_PATH=local:///afs/cern.ch/alice/tpctest/OCDB
81 if [ "x$AGENTSE" == "x" ]; then
82 echo "WARNUNG: environment variable 'AGENTSE' falling back to default (ALICE::CERN::SE)\!\!"
83 export AGENTSE=ALICE::CERN::SE
93 #cd to workdir and check for 'macros' and 'out' dir
95 if [ ! -d macros ]; then
96 echo "ERROR: no 'macros' dir in '$1'. Does it exist?"
100 echo "ERROR: no 'out' dir in '$1'. Does it exist?"
104 # check if we are able to write to this dir, the alien SE, can readback from the alien SE and delete stuff
105 touch agend_alien_tst$HOSTNAME.txt || exit 1
106 date >> agend_alien_tst$HOSTNAME.txt
108 alien_cp -dn agend_alien_tst$HOSTNAME.txt alien:${alien_HOME}agend_alien_tst$HOSTNAME.txt@$AGENTSE
111 res=`alien_ls ${alien_HOME}agend_alien_tst$HOSTNAME.txt | grep agend_alien_tst`
112 if [ "x$res" == "x" ]; then
113 echo "ERROR: could not write on storage element '$AGENTSE'"
118 alien_cp -n alien:${alien_HOME}agend_alien_tst$HOSTNAME.txt agend_alien_tst_back.txt
119 res=`diff agend_alien_tst$HOSTNAME.txt agend_alien_tst_back.txt`
120 if [ "x$res" != "x" ]; then
121 echo "ERROR: problems reading from storage element '$AGENTSE'"
125 #try to delete from alien
126 res=`alien_rm -d ${alien_HOME}agend_alien_tst$HOSTNAME.txt`
127 if [ "x$res" != "x" ]; then
128 echo "ERROR: cannot delete from storage element '$AGENTSE'"
132 #try to delete local files
133 res=`rm agend_alien_tst*`
134 if [ "x$res" != "x" ]; then
135 echo "ERROR: cannot delete local files"
142 aliroot -b -q $ALICE_ROOT/TPC/macros/testTPC/AliTPCjobs.cxx+
144 #alien_cp -d job.list alien:${alien_HOME}job.list@$AGENTSE