Ignore:
Timestamp:
Oct 20, 2017 8:50:47 AM (6 years ago)
Author:
raasch
Message:

palmrun adjusted for grid engine batch systems, informative messages reduced and reformatted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmrun

    r2551 r2566  
    2727# -----------------
    2828# $Id$
     29# execute command for combine_plot_fields added
     30# "TEMPDIR" renamed "tempdir"
     31# temporary working directory for local batch jobs is created immediately within
     32# the user's palmrun call, due to a requirement of the "grid engine" batch
     33# system, where the working directory is given with batch directive -wd and must
     34# already exist when the job is submitted,
     35# informative messages in non-trace mode reduced and partly reformatted
     36#
     37# 2551 2017-10-18 07:25:11Z raasch
    2938# TEMPDIR added as replacement string to be used in batch directives
    3039#
     
    137146 tasks_per_node=0
    138147 threads_per_task=1
    139  tmpcreate=false
    140148 transfer_problems=false
    141149 user_source_path=""
     
    161169             eval  ${err_command[$i]}
    162170          done
    163           [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $TEMPDIR)
     171          [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $tempdir)
    164172          printf "\n\n+++ palmrun killed \n\n"
    165173       elif [[ $locat != control_c ]]
    166174       then
    167           printf "\n\n --> palmrun finished\n\n"
    168           if [[ $running_on_remote = true ]]
    169           then
    170              printf "     Bye, bye $remote_username !!\n\n"
    171           else
    172              printf "     Bye, bye $local_username !!\n\n"
    173           fi
     175          printf "\n --> palmrun finished\n\n"
    174176       fi' exit
    175177
    176178
    177179    # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C):
    178  trap 'cd; rm -rf $TEMPDIR
     180 trap 'cd; rm -rf $tempdir
    179181       printf "\n+++ palmrun killed by \"^C\" \n\n"
    180182       locat=control_c
     
    11891191    job_id=${fname}.$run_id
    11901192
    1191     TEMPDIR=$fast_io_catalog/$job_id
     1193    tempdir=$fast_io_catalog/$job_id
    11921194 fi
    11931195
     
    15231525    if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
    15241526    then
    1525        printf " ***  batch-job will be created and submitted"
     1527       printf "\n ***  batch-job will be created and submitted"
    15261528    else
    1527        printf " ***  PALMRUN will now continue to execute on this machine"
     1529       printf "\n ***  PALMRUN will now continue to execute on this machine"
    15281530    fi
    15291531 fi
     
    15371539    if [[ $create_batch_job = true  ||  $create_remote_batch_job  = true ]]
    15381540    then
    1539        printf "\n\n  *** creating executable and other sources for the remote host"
     1541       printf "\n\n  *** creating executable and other sources for the remote host\n"
    15401542    else
    1541        printf "\n\n  *** creating executable and other sources for the local host"
     1543       printf "\n\n  *** creating executable and other sources for the local host\n"
    15421544    fi
    15431545
     
    15931595       fi
    15941596
    1595        palmbuild  -v  -h $host_configuration
     1597       if [[ $do_trace = true ]]
     1598       then
     1599          palmbuild  -h $host_configuration
     1600       else
     1601          palmbuild  -v  -h $host_configuration
     1602       fi
    15961603
    15971604       if [[ $? != 0 ]]
     
    16081615    fi
    16091616
     1617       # NOW CREATE THE SOURCES_FOR_RUN FOLDER
    16101618    palmbuild  -v  $use_existing_sources_folder  -h $host_configuration  -d $fname
    16111619
     
    16211629    else
    16221630
    1623        printf "\n$dashes\n  *** executable and other sources created\n"
     1631       printf "  *** executable and other sources created\n"
    16241632       rm -rf  $sources_for_run_catalog
    16251633
     
    16391647          # CREATE THE DIRECTORY AND COPY FILES FROM SOURCES_FOR_RUN_... TO THAT
    16401648          # FOLDER
    1641        mkdir -p  $TEMPDIR
    1642        chmod  go+rx  $TEMPDIR
    1643        tmpcreate=true
    1644        cd  $TEMPDIR
    1645        cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  $TEMPDIR
    1646        printf "\n  *** changed to temporary directory: $TEMPDIR"
     1649       mkdir -p  $tempdir
     1650       chmod  go+rx  $tempdir
     1651       cd  $tempdir
     1652       cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  $tempdir
     1653       printf "\n  *** changed to temporary directory: $tempdir"
    16471654
    16481655    else
    16491656
    16501657          # IN BATCH MODE PALMRUN IS CALLED FROM TEMPDIR
    1651        printf "\n  *** running in temporary directory: $TEMPDIR"
     1658       printf "\n  *** running in temporary directory: $tempdir"
    16521659
    16531660    fi
     
    17241731                for file in $(ls *)
    17251732                do
    1726                    ln $file $TEMPDIR/${localin[$i]}
     1733                   ln $file $tempdir/${localin[$i]}
    17271734                done >|/dev/null 2>&1
    1728                 cd $TEMPDIR
     1735                cd $tempdir
    17291736             fi
    17301737
     
    17881795                                    ln -f $file  ${localin[$i]}
    17891796                                 done
    1790                                  cd $TEMPDIR
     1797                                 cd $tempdir
    17911798                              fi
    17921799
     
    18621869       # STARTING THE EXECUTABLE
    18631870    printf "\n\n  *** execution starts in directory\n      \"`pwd`\"\n$dashes\n"
    1864     PATH=$PATH:$TEMPDIR
     1871    PATH=$PATH:$tempdir
    18651872
    18661873
     
    18731880
    18741881       # EXECUTION COMMAND FOR COMBINE_PLOT_FIELDS
    1875     eval line2=\"$line2\"
    1876     execute_command_for_combine="$line2"
     1882    if [[ "$execute_command_for_combine" = "" ]]
     1883    then
     1884       eval line2=\"$line2\"
     1885       execute_command_for_combine="$line2"
     1886    fi
     1887   
    18771888
    18781889
     
    19932004    done
    19942005
    1995 
    1996        # IN TRACE-MODE PRINT CONTENTS OF THE CURRENT (TEMPORARY) WORKING DIRECTORY
    1997     if [[ $do_trace = true ]]
    1998     then
    1999        printf "\n\n"
    2000        ls -al
    2001     fi
    2002    
    20032006
    20042007       # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS
     
    21232126                if [[ "$remote_loginnode" != "" ]]
    21242127                then
    2125                    echo "cd $TEMPDIR; ${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
     2128                   echo "cd $tempdir; ${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
    21262129                else
    21272130                   batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}
     
    22412244                                 ln -f $file  ${pathout[$i]}
    22422245                              done >|/dev/null 2>&1
    2243                               cd $TEMPDIR
     2246                              cd $tempdir
    22442247                    fi
    22452248
     
    23422345       # ALL ACTIONS FINISHED, TEMPORARY WORKING-DIRECTORY CAN BE DELETED
    23432346    cd  $HOME
    2344     [[ $delete_temporary_catalog = true ]]  &&  rm -rf $TEMPDIR
     2347    [[ $delete_temporary_catalog = true ]]  &&  rm -rf $tempdir
    23452348
    23462349
     
    24052408    do
    24062409       (( i = i + 1 ))
    2407        line=`echo  "${batch_directive[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{CPU_HOURS}}/$cpu_hours/g' | sed 's/{{CPU_MINUTES}}/$cpu_minutes/g' | sed 's/{{CPU_SECONDS}}/$cpu_seconds/g' | sed 's/{{NODES}}/$nodes/g' | sed 's/{{CORES}}/$cores/g' | sed 's/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{HOST_CONFIGURATION}}/${host_configuration}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g' | sed 's/{{PROJECT_ACCOUNT}}/$project_account/g' | sed 's/{{PREVIOUS_JOB}}/$previous_job/g' | sed 's/{{TEMPDIR}}/$TEMPDIR/g'`
     2410       line=`echo  "${batch_directive[$i]}" | sed 's/{{JOB_ID}}/$job_id/g' | sed 's/{{JOBFILE}}/$job_protocol_file/g' | sed 's/{{CPU_HOURS}}/$cpu_hours/g' | sed 's/{{CPU_MINUTES}}/$cpu_minutes/g' | sed 's/{{CPU_SECONDS}}/$cpu_seconds/g' | sed 's/{{NODES}}/$nodes/g' | sed 's/{{CORES}}/$cores/g' | sed 's/{{TASKS_PER_NODE}}/$tasks_per_node/g' | sed 's/{{HOST_CONFIGURATION}}/${host_configuration}/g' | sed 's/{{FNAME}}/$fname/g' | sed 's/{{QUEUE}}/$queue/g' | sed 's/{{MEMORY}}/$memory/g' | sed 's/{{PROJECT_ACCOUNT}}/$project_account/g' | sed 's/{{PREVIOUS_JOB}}/$previous_job/g' | sed 's/{{TEMPDIR}}/$tempdir/g'`
    24082411       eval line=\"$line\"
    24092412       echo  "$line"                               >>  $jobfile
     
    24662469
    24672470       # CREATE TEMPORARY DIRECTORY AND SWITCH TO IT
    2468     echo  "mkdir  $TEMPDIR"              >>  $jobfile
    2469     echo  "cd  $TEMPDIR"                 >>  $jobfile
    2470     echo  "export TEMPDIR=$TEMPDIR"      >>  $jobfile
     2471    if [[ $create_remote_batch_job = true ]]
     2472    then
     2473       echo  "mkdir  $tempdir"           >>  $jobfile
     2474       echo  "chmod  go+rx  $tempdir"    >>  $jobfile
     2475    else
     2476          # DIRECTORY FOR LOCAL BATCH JOBS IS CREATED NOW, DUE TO A
     2477          # REQUIREMENT OF THE GRID ENGINE BATCH SYSTEM (WORKING DIR IS GIVEN IN
     2478          # BATCH DIRECTIVE -wd AND MUST ALREADY EXIST WHEN THE JOB IS SUBMITTED)
     2479       mkdir  $tempdir
     2480       chmod  go+rx  $tempdir
     2481    fi
     2482    echo  "cd  $tempdir"                 >>  $jobfile
     2483    echo  "export tempdir=$tempdir"      >>  $jobfile
    24712484    echo  "cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  ."  >>  $jobfile
    24722485    echo  "export PATH=.:\$PATH"         >>  $jobfile
     
    25332546
    25342547          echo " "
    2535           echo "  *** transfer of job to remote host via scp"
     2548          echo " *** transfer of job to remote host via scp"
    25362549          if [[ $do_trace = true ]]
    25372550          then
    25382551             echo "     scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}"
    25392552          fi
    2540           scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}
    2541 
    2542           echo " "
    2543           echo "  *** submit the job (output of submit command, e.g. the job-id, may follow)"
     2553          scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}  >  /dev/null
     2554
     2555          printf " *** submit the job (output of submit command, e.g. the job-id, may follow)"
    25442556          if [[ $do_trace = true ]]
    25452557          then
Note: See TracChangeset for help on using the changeset viewer.