All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
run_job.sh
Go to the documentation of this file.
1 #!/bin/bash
2 set -x
3 echo Start `date`
4 echo Site:${GLIDEIN_ResourceName}
5 echo "the worker node is " `hostname` "OS: " `uname -a`
6 whoami
7 id
8 
9 cd $_CONDOR_SCRATCH_DIR
10 
11 IFDH_OPTION=""
12 
13 if [ -z $GROUP ]; then
14 
15 # try to figure out what group the user is in
16 GROUP=`id -gn`
17 
18 fi
19 
20 export IFDH_DEBUG=1
21 
22 case $GROUP in
23 
24 sbnd)
25 SCRATCH_DIR="/pnfs/sbnd/scratch/users"
26 ;;
27 lar1nd)
28 SCRATCH_DIR="/pnfs/sbnd/scratch/users"
29 ;;
30 esac
31 
32 voms-proxy-info --all
33 
34 
35 source /grid/fermiapp/products/common/etc/setups.sh
36 source /cvmfs/oasis.opensciencegrid.org/fermilab/products/larsoft/setup
37 
39 
40 echo "Here is the your environment in this job: " > job_output_${CLUSTER}.${PROCESS}.log
41 env >> job_output_${CLUSTER}.${PROCESS}.log
42 
43 echo "group = $GROUP"
44 
45 if [ -z ${GRID_USER} ]; then
46 GRID_USER=`basename $X509_USER_PROXY | cut -d "_" -f 2`
47 fi
48 
49 echo "GRID_USER = `echo $GRID_USER`"
50 
51 sleep $[ ( $RANDOM % 10 ) + 1 ]m
52 
53 umask 002
54 
55 cd $_CONDOR_SCRATCH_DIR
56 
57 
58 ####################################
59 ###### setup your needed products here, e.g. geant4 etc...
60 ####################################
61 
62 # source /grid/fermiapp/products/larsoft/setup
63 # setup geant4 v4_9_6_p03e -q debug:e6
64 # setup geant4 v4_9_6_p03e -q e6:prof #no debug information, faster.
65 
66 
67 
68 ####################################
69 #### This is where you copy all of your executable/necessary files to the worker node
70 #### ( If applicable )
71 ####################################
72 
73  ifdh cp /pnfs/sbnd/persistent/users/andrzejs/hello.out .
74 
75 #######
76 ####### ifdh cp does not preserve permissions, so need to add executable. #########
77 #######
78  chmod u+x hello.out
79 
80 #######
81 ####### launch executable
82 #######
83 
84  ./hello.out
85 
86 
87 #######
88 ####### Copy results back
89 #######
90 
91 ifdh mkdir ${SCRATCH_DIR}/${GRID_USER}/output_${CLUSTER}.${PROCESS}
92 
93 ifdh cp test_hello.txt ${SCRATCH_DIR}/${GRID_USER}/output_${CLUSTER}.${PROCESS}/
94 
95 
96 
97 #######
98 ####### The rest is some copying info, that is not necessarily relevant.
99 #######
100 
101 
102 if [ -z "$SCRATCH_DIR" ]; then
103  echo "Invalid dCache scratch directory, not copying back"
104 else
105 
106 #export IFDH_DEBUG=1
107 
108 
109 
110  # first do lfdh ls to check if directory exists
111  ifdh ls ${SCRATCH_DIR}/$GRID_USER
112  # A non-zero exit value probably means it doesn't, so create it
113  if [ $? -ne 0 && -z "$IFDH_OPTION" ]; then
114 
115  echo "Unable to read ${SCRATCH_DIR}/$GRID_USER. Make sure that you have created this directory and given it group write permission (chmod g+w ${SCRATCH_DIR}/$GRID_USER)."
116  exit 74
117 # ifdh mkdir ${SCRATCH_DIR}/$GRID_USER
118 # if [ "$?" -ne "0" ]; then
119 # echo "Unable to make ${SCRATCH_DIR}/$GRID_USER directory"
120 # else
121 # ifdh cp -D --force=gridftp job_output_${CLUSTER}.${PROCESS}.log ${SCRATCH_DIR}/${GRID_USER}/
122 # if [ "$?" -ne "0" ]; then
123 # echo "Error $? when copying to dCache scratch area!!!"
124 # fi
125 # fi
126  else
127  # directory already exists, so let's copy
128  ifdh cp -D $IFDH_OPTION job_output_${CLUSTER}.${PROCESS}.log ${SCRATCH_DIR}/${GRID_USER}/output_${CLUSTER}.${PROCESS}/
129  if [ $? -ne 0 ]; then
130  echo "Error $? when copying to dCache scratch area!\n If you created ${SCRATCH_DIR}/${GRID_USER} yourself,\n make sure that it has group write permission."
131  exit 73
132  fi
133  fi
134 fi
135 
136 echo "End `date`"
137 
138 exit 0
process_name opflash particleana ie ie ie z
then source grid fermiapp products dune setup_dune_fermiapp sh exit else echo No setup file found exit fi setup
process_name opflash particleana ie x
do source
#define the
set x echo Start date echo Site
Definition: run_job.sh:13
then echo Invalid dCache scratch not copying back else ifdh ls
Definition: run_job.sh:111
lar1nd SCRATCH_DIR
Definition: run_job.sh:28
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
process_name gaushit a
then GROUP
Definition: run_job.sh:16
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more information
then shift fi
then echo Setting up ifdhc
esac shift done rm f *xml find $SBNDCODE_DIR source fcl gen name *fcl while read fcl do if!echo $fcl grep q common
do cd
g grid
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
do i e
T copy(T const &v)
then GRID_USER
Definition: run_job.sh:46
stream1 can override from command line with o or output services user sbnd
pnfs
Definition: file_to_url.sh:60