Changeset 2566 for palm/trunk/SCRIPTS/palmrun
- Timestamp:
- Oct 20, 2017 8:50:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrun
r2551 r2566 27 27 # ----------------- 28 28 # $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 29 38 # TEMPDIR added as replacement string to be used in batch directives 30 39 # … … 137 146 tasks_per_node=0 138 147 threads_per_task=1 139 tmpcreate=false140 148 transfer_problems=false 141 149 user_source_path="" … … 161 169 eval ${err_command[$i]} 162 170 done 163 [[ $delete_temporary_catalog = true ]] && (cd; rm -rf $ TEMPDIR)171 [[ $delete_temporary_catalog = true ]] && (cd; rm -rf $tempdir) 164 172 printf "\n\n+++ palmrun killed \n\n" 165 173 elif [[ $locat != control_c ]] 166 174 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" 174 176 fi' exit 175 177 176 178 177 179 # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C): 178 trap 'cd; rm -rf $ TEMPDIR180 trap 'cd; rm -rf $tempdir 179 181 printf "\n+++ palmrun killed by \"^C\" \n\n" 180 182 locat=control_c … … 1189 1191 job_id=${fname}.$run_id 1190 1192 1191 TEMPDIR=$fast_io_catalog/$job_id1193 tempdir=$fast_io_catalog/$job_id 1192 1194 fi 1193 1195 … … 1523 1525 if [[ $create_batch_job = true || $create_remote_batch_job = true ]] 1524 1526 then 1525 printf " *** batch-job will be created and submitted"1527 printf "\n *** batch-job will be created and submitted" 1526 1528 else 1527 printf " *** PALMRUN will now continue to execute on this machine"1529 printf "\n *** PALMRUN will now continue to execute on this machine" 1528 1530 fi 1529 1531 fi … … 1537 1539 if [[ $create_batch_job = true || $create_remote_batch_job = true ]] 1538 1540 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" 1540 1542 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" 1542 1544 fi 1543 1545 … … 1593 1595 fi 1594 1596 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 1596 1603 1597 1604 if [[ $? != 0 ]] … … 1608 1615 fi 1609 1616 1617 # NOW CREATE THE SOURCES_FOR_RUN FOLDER 1610 1618 palmbuild -v $use_existing_sources_folder -h $host_configuration -d $fname 1611 1619 … … 1621 1629 else 1622 1630 1623 printf " \n$dashes\n*** executable and other sources created\n"1631 printf " *** executable and other sources created\n" 1624 1632 rm -rf $sources_for_run_catalog 1625 1633 … … 1639 1647 # CREATE THE DIRECTORY AND COPY FILES FROM SOURCES_FOR_RUN_... TO THAT 1640 1648 # 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" 1647 1654 1648 1655 else 1649 1656 1650 1657 # IN BATCH MODE PALMRUN IS CALLED FROM TEMPDIR 1651 printf "\n *** running in temporary directory: $ TEMPDIR"1658 printf "\n *** running in temporary directory: $tempdir" 1652 1659 1653 1660 fi … … 1724 1731 for file in $(ls *) 1725 1732 do 1726 ln $file $ TEMPDIR/${localin[$i]}1733 ln $file $tempdir/${localin[$i]} 1727 1734 done >|/dev/null 2>&1 1728 cd $ TEMPDIR1735 cd $tempdir 1729 1736 fi 1730 1737 … … 1788 1795 ln -f $file ${localin[$i]} 1789 1796 done 1790 cd $ TEMPDIR1797 cd $tempdir 1791 1798 fi 1792 1799 … … 1862 1869 # STARTING THE EXECUTABLE 1863 1870 printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$dashes\n" 1864 PATH=$PATH:$ TEMPDIR1871 PATH=$PATH:$tempdir 1865 1872 1866 1873 … … 1873 1880 1874 1881 # 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 1877 1888 1878 1889 … … 1993 2004 done 1994 2005 1995 1996 # IN TRACE-MODE PRINT CONTENTS OF THE CURRENT (TEMPORARY) WORKING DIRECTORY1997 if [[ $do_trace = true ]]1998 then1999 printf "\n\n"2000 ls -al2001 fi2002 2003 2006 2004 2007 # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS … … 2123 2126 if [[ "$remote_loginnode" != "" ]] 2124 2127 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_loginnode2128 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 2126 2129 else 2127 2130 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]} … … 2241 2244 ln -f $file ${pathout[$i]} 2242 2245 done >|/dev/null 2>&1 2243 cd $ TEMPDIR2246 cd $tempdir 2244 2247 fi 2245 2248 … … 2342 2345 # ALL ACTIONS FINISHED, TEMPORARY WORKING-DIRECTORY CAN BE DELETED 2343 2346 cd $HOME 2344 [[ $delete_temporary_catalog = true ]] && rm -rf $ TEMPDIR2347 [[ $delete_temporary_catalog = true ]] && rm -rf $tempdir 2345 2348 2346 2349 … … 2405 2408 do 2406 2409 (( 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'` 2408 2411 eval line=\"$line\" 2409 2412 echo "$line" >> $jobfile … … 2466 2469 2467 2470 # 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 2471 2484 echo "cp ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*} ." >> $jobfile 2472 2485 echo "export PATH=.:\$PATH" >> $jobfile … … 2533 2546 2534 2547 echo " " 2535 echo " 2548 echo " *** transfer of job to remote host via scp" 2536 2549 if [[ $do_trace = true ]] 2537 2550 then 2538 2551 echo " scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}" 2539 2552 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)" 2544 2556 if [[ $do_trace = true ]] 2545 2557 then
Note: See TracChangeset
for help on using the changeset viewer.