#!/bin/sh ##################################################### # # # Olivier Dadoun launch.sh # # last modifications 27/11/2006 # # bash script to send GuineaPig++ on the grid # # For questions or comments do not hesitate # # dadoun@lal.in2p3.fr www.dadoun.net # # # ##################################################### # if you are not under ilc VO # you must change those variables MY_VO=TEMPLATE_MY_VO LFC_HOST=TEMPLATE_LFC_HOST LCG_CATALOG_TYPE=TEMPLATE_LCG_CATALOG_TYPE MY_SE_FOLDER=TEMPLATE_MY_SE_FOLDER SE_SERVER=TEMPLATE_SE_SERVER # Which GuineaPig++ binary you want to use MY_BIN=TEMPLATE_MY_BIN if [ ! -e $MY_BIN ]; then echo "$MY_BIN not there correct the path and modify $MY_BIN in $0 " exit 1 fi # By default the TEMP folder is located at /tmp TEMP_FOLDER=/tmp/TEMP`echo $USER` tarball=$TEMP_FOLDER/gp_tarball ############################################ # if MY_SE_FOLDER not defined then exit if [ -z $MY_SE_FOLDER ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " Check the Storage Element name or path " echo " try before lfc-ls $MY_SE_FOLDER" echo " (and modify $MY_SE_FOLDER in $0 if needed)" echo " exit now " echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" exit 1 else #Check if folder in the SE exist if [ $# -ne 3 ]; then echo "**************************************************" echo " Script to send one GuineaPig++ JOB onto the Grid " echo "**************************************************" echo "$0 Need: " echo "1) acc.dat " echo "2) accelerator " echo "3) parameter_set " echo "***************************" exit 1 else if [ -z $LCG_CATALOG_TYPE ]; then echo "!!!!! error !!!!!!!" echo "LCG_CATALOG_TYPE variable not defined , try :" echo "export LCG_CATALOG_TYPE=lfc (bash) or setenv LCG_CATALOG_TYPE lfc (tcsh)" echo "and reload the script" exit 1 fi if [ -z $LFC_HOST ]; then echo "!!!!! error !!!!!!!" echo "LFC_HOST variable not defined , try (if you are under ilc vo try the following \ else ask the Grid User Support @ your lab):" echo "export LFC_HOST=grid-lfc.desy.de (bash) or setenv LFC_HOST grid-lfc.desy.de (tcsh)" echo "and reload the script" exit 1 fi # Create a tempory folder # with the bianry and the acc.dat # it will be send with the jdl script in # the inputsand box if [ ! -e $1 ]; then echo "$1 not there ... " exit 1 fi accelerator=$2 parameter_set=$3 if [ -d $TEMP_FOLDER ]; then echo "$TEMP_FOLDER allready exist , I will erase it and recreate a new one ..." rm -r $TEMP_FOLDER mkdir $TEMP_FOLDER fi mkdir $tarball cp $MY_BIN $tarball/gp++ cp $1 $tarball tar czf gp_tarball.tar.gz -C $TEMP_FOLDER gp_tarball # Script which will be run on the workers cat > $TEMP_FOLDER/workers_exe.sh << EOF #!/bin/sh LCG_CATALOG_TYPE=$LCG_CATALOG_TYPE LFC_HOST=$LFC_HOST tar xfz gp_tarball.tar.gz rm gp_tarball.tar.gz cd gp_tarball ./gp++ $2 $3 out > /dev/null rm gp++ cd .. tar cfz gp_tarball.tar.gz gp_tarball lcg-cr -d $SE_SERVER --vo $MY_VO file:\`pwd\`/gp_tarball.tar.gz -l lfn:$MY_SE_FOLDER/gp_tarball.tar.gz rm gp_tarball.tar.gz cd gp_tarball rm * EOF ### JDL FILE cat > launch.jdl << EOF Executable = "workers_exe.sh"; StdOutput = "gp_std.out"; StdError = "gp_std.err"; InputSandbox = {"$TEMP_FOLDER/workers_exe.sh","gp_tarball.tar.gz"}; OutputSandbox = {"gp_std.out","gp_std.err"}; EOF lfc-ls $MY_SE_FOLDER 2>&1>/dev/null if [ $? -ne 0 ]; then echo "!!!!! error !!!!!!!" echo "Do you have a valid proxy ? " echo "or does the path $MY_SE_FOLDER is valid, check it : lfc-ls $MY_SE_FOLDER" echo "Change $MY_SE_FOLDER here and reload the script" exit 1 fi ### SUBMIT the job edg-job-submit --vo ilc -o out launch.jdl fi fi