Changeset 3236 for palm/trunk/SCRIPTS/palmrun
- Timestamp:
- Sep 10, 2018 9:07:06 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrun
r3151 r3236 27 27 # ----------------- 28 28 # $Id$ 29 # warning issued in case of file connection file version mismatch, 30 # host_configuration renamed configuration_identifier, 31 # "host identifier" in header output renamed "config. identifier", 32 # jobname renamed run_identifier, 33 # run_id renamed run_id_number 34 # job_id renamed run_id 35 # option -r renamed -i 36 # 37 # 3151 2018-07-19 08:45:38Z raasch 29 38 # removed additional listing of files to be compiled, print PALM code revision 30 39 # in header … … 170 179 compiler_name_ser="" 171 180 compiler_options="" 181 configuration_identifier="default" 172 182 cores=1 173 183 cores_atmos=0 … … 188 198 execution_error=false 189 199 fileconnection_file=trunk/SCRIPTS/.palm.iofiles 190 jobname=test191 200 global_revision="" 192 host_configuration="default"193 201 hostfile="" 194 202 hp="" … … 221 229 run_coupled_model=false 222 230 run_id="" 231 run_id_number="" 232 run_identifier=test 223 233 silent=false 224 234 source_list="" … … 267 277 # READ SHELLSCRIPT-OPTIONS AND REBUILD THE PALMRUN-COMMAND STRING (prc), 268 278 # WHICH WILL BE USED TO START RESTART-JOBS 269 while getopts :a:A:bBCd:FG:h: jkm:M:O:q:r:R:s:t:T:u:U:vVw:W:xX:yY:Z option279 while getopts :a:A:bBCd:FG:h:i:jkm:M:O:q:R:s:t:T:u:U:vVw:W:xX:yY:Z option 270 280 do 271 281 case $option in … … 275 285 (B) delete_temporary_catalog=false; prc="$prc -B";; 276 286 (C) restart_run=true; prc="$prc -C";; 277 (d) jobname=$OPTARG; prc="$prc -d$OPTARG";;287 (d) run_identifier=$OPTARG; prc="$prc -d$OPTARG";; 278 288 (F) create_jobfile_only=true;; 279 289 (G) global_revision=$OPTARG; prc="$prc -G'$OPTARG'";; 280 (h) host_configuration=$OPTARG; prc="$prc -h$OPTARG";; 290 (h) configuration_identifier=$OPTARG; prc="$prc -h$OPTARG";; 291 (i) run_id_number=$OPTARG;; 281 292 (j) running_in_batch_mode=true;; 282 293 (k) keep_data_from_previous_run=true; prc="$prc -k";; … … 285 296 (O) use_openmp=true; threads_per_task=$OPTARG; prc="$prc -O$OPTARG";; 286 297 (q) queue=$OPTARG; prc="$prc -q$OPTARG";; 287 (r) run_id=$OPTARG;;288 298 (R) return_address=$OPTARG;; 289 299 (s) source_list=$OPTARG;; … … 367 377 368 378 369 # FOR COMPATIBILITY REASONS SET OLD ENVIRONMENT VARIABLE 370 export fname=$jobname 379 # FOR COMPATIBILITY REASONS SET OLD ENVIRONMENT VARIABLES 380 export fname=$run_identifier 381 export jobname=$run_identifier 371 382 372 383 373 384 # BUILD THE CONFIGURATION-FILE NAME AND THE SOURCES_FOR_RUN-FOLDER NAME 374 config_file=.palm.config.$ host_configuration375 sources_for_run_catalog=SOURCES_FOR_RUN_${ host_configuration}_$jobname385 config_file=.palm.config.$configuration_identifier 386 sources_for_run_catalog=SOURCES_FOR_RUN_${configuration_identifier}_$run_identifier 376 387 377 388 … … 389 400 if [[ -f .palm.iofiles ]] 390 401 then 402 403 # CHECK VERSION MISMATCH 404 if [[ $running_in_batch_mode != true ]] 405 then 406 if [[ $(head -n1 $fileconnection_file) != $(head -n1 .palm.iofiles) ]] 407 then 408 printf "\n\n +++ WARNING: A file connection file has been found in your" 409 printf "\n working directory, but its revision does not match" 410 printf "\n the revision of the default (trunk) version." 411 printf "\n You may need to update your connection file!" 412 fi 413 fi 414 391 415 fileconnection_file=.palm.iofiles 416 392 417 fi 393 418 … … 1124 1149 eval filename=${pathin_pre[$i]}/${endin_pre[$i]} 1125 1150 else 1126 eval filename=${pathin_pre[$i]}/${ jobname}${endin_pre[$i]}1151 eval filename=${pathin_pre[$i]}/${run_identifier}${endin_pre[$i]} 1127 1152 fi 1128 1153 … … 1156 1181 else 1157 1182 1158 # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME BASENAME ($jobname) AND 1159 # CREATE A LIST FOR THE DETECTED BASENAME ENDINGS 1183 # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME BASENAME 1184 # ($run_identifier) AND CREATE A LIST FOR THE DETECTED BASENAME 1185 # ENDINGS 1160 1186 if [[ "${multin[$i]}" = true ]] 1161 1187 then … … 1185 1211 fi 1186 1212 1187 # remove the jobnamefrom the beginning1188 length_ jobname=${#jobname}1189 ending=${basefilename:${length_ jobname}}1213 # remove the run_identifier from the beginning 1214 length_run_identifier=${#run_identifier} 1215 ending=${basefilename:${length_run_identifier}} 1190 1216 1191 1217 # remove the ending given in the .iofiles from the beginning … … 1249 1275 eval filename=${pathin[$nr_of_input_files]}/${endin[$nr_of_input_files]} 1250 1276 else 1251 eval filename=${pathin[$nr_of_input_files]}/${ jobname}${endin[$nr_of_input_files]}1277 eval filename=${pathin[$nr_of_input_files]}/${run_identifier}${endin[$nr_of_input_files]} 1252 1278 fi 1253 1279 … … 1329 1355 frelin[$nr_of_input_files]=${endin[$nr_of_input_files]}.$cyclestring 1330 1356 else 1331 frelin[$nr_of_input_files]=${ jobname}${endin[$nr_of_input_files]}.$cyclestring1357 frelin[$nr_of_input_files]=${run_identifier}${endin[$nr_of_input_files]}.$cyclestring 1332 1358 fi 1333 1359 else … … 1336 1362 frelin[$nr_of_input_files]=${endin[$nr_of_input_files]} 1337 1363 else 1338 frelin[$nr_of_input_files]=${ jobname}${endin[$nr_of_input_files]}1364 frelin[$nr_of_input_files]=${run_identifier}${endin[$nr_of_input_files]} 1339 1365 fi 1340 1366 fi … … 1370 1396 fi 1371 1397 (( maxcycle = 0 )) 1372 eval filename=${pathout_pre[$i]}/${ jobname}${endout_pre[$i]}1398 eval filename=${pathout_pre[$i]}/${run_identifier}${endout_pre[$i]} 1373 1399 eval catalogname=${pathout_pre[$i]} 1374 1400 if ! ls $filename* 1>/dev/null 2>&1 … … 1416 1442 if [[ $running_in_batch_mode = false ]] 1417 1443 then 1418 run_id =$RANDOM1419 job_id=${jobname}.$run_id1420 1421 tempdir=$fast_io_catalog/$ job_id1444 run_id_number=$RANDOM 1445 run_id=${run_identifier}.$run_id_number 1446 1447 tempdir=$fast_io_catalog/$run_id 1422 1448 fi 1423 1449 … … 1511 1537 if [[ $create_remote_batch_job = true ]] 1512 1538 then 1513 column1="execution on:"; column2="$ host_configuration(username: $remote_username)"1539 column1="execution on:"; column2="$configuration_identifier (username: $remote_username)" 1514 1540 else 1515 1541 if [[ $running_on_remote = true ]] 1516 1542 then 1517 column1=" host identifier:"; column2="$host_configuration(execute on IP: $remote_ip)"1543 column1="config. identifier:"; column2="$configuration_identifier (execute on IP: $remote_ip)" 1518 1544 else 1519 column1=" host identifier:"; column2="$host_configuration(execute on IP: $local_ip)"1545 column1="config. identifier:"; column2="$configuration_identifier (execute on IP: $local_ip)" 1520 1546 fi 1521 1547 fi … … 1662 1688 fi 1663 1689 printf "| | \n" 1664 column1="run identifier:"; column2=$ jobname1690 column1="run identifier:"; column2=$run_identifier 1665 1691 printf "| %-25s%-45s | \n" "$column1" "$column2" 1666 1692 column1="activation string list:"; column2=$(echo $activation_string_list) … … 1780 1806 1781 1807 line=`grep %base_directory $config_file` 1782 make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${ host_configuration}1783 echo "[[ ! -d ${make_depository} ]] && echo depository not found" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${ host_configuration}_last_make_protokoll1784 1785 if [[ $(grep -c "depository not found" ${ host_configuration}_last_make_protokoll) != 0 ]]1808 make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${configuration_identifier} 1809 echo "[[ ! -d ${make_depository} ]] && echo depository not found" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${configuration_identifier}_last_make_protokoll 1810 1811 if [[ $(grep -c "depository not found" ${configuration_identifier}_last_make_protokoll) != 0 ]] 1786 1812 then 1787 1813 printf "\n\n +++ make depository \"${make_depository}\"" … … 1789 1815 ask_for_make_depository=true 1790 1816 fi 1791 rm ${ host_configuration}_last_make_protokoll1817 rm ${configuration_identifier}_last_make_protokoll 1792 1818 1793 1819 else 1794 1820 1795 1821 # CHECK FOR MAKE_DEPOSITORY ON THE LOCAL HOST 1796 make_depository=${base_directory}/MAKE_DEPOSITORY_${ host_configuration}1822 make_depository=${base_directory}/MAKE_DEPOSITORY_${configuration_identifier} 1797 1823 if [[ ! -d ${make_depository} ]] 1798 1824 then … … 1826 1852 if [[ $do_trace = true ]] 1827 1853 then 1828 palmbuild -h $ host_configuration1854 palmbuild -h $configuration_identifier 1829 1855 else 1830 palmbuild -v -h $ host_configuration1856 palmbuild -v -h $configuration_identifier 1831 1857 fi 1832 1858 … … 1845 1871 1846 1872 # NOW CREATE THE SOURCES_FOR_RUN FOLDER 1847 palmbuild -v $use_existing_sources_folder -h $ host_configuration -d $jobname1873 palmbuild -v $use_existing_sources_folder -h $configuration_identifier -d $run_identifier 1848 1874 1849 1875 if [[ $? != 0 ]] … … 2110 2136 # (FILE ENVPAR WILL BE READ BY PALM) 2111 2137 cat > ENVPAR << EOF 2112 &envpar run_identifier = '$ jobname', host = '$host_configuration',2138 &envpar run_identifier = '$run_identifier', host = '$configuration_identifier', 2113 2139 write_svf = .${write_svf}., write_binary = .${write_binary}., 2114 2140 read_svf = .${read_svf}., tasks_per_node = $tasks_per_node, … … 2361 2387 then 2362 2388 2363 eval filename=${pathout[$i]}/${ jobname}${endout[$i]}2389 eval filename=${pathout[$i]}/${run_identifier}${endout[$i]} 2364 2390 2365 2391 # DETERMINE THE CYCLE NUMBER … … 2503 2529 transfer_failed=false 2504 2530 printf "\n >>> OUTPUT: ${localout[$i]}$catalog_string $append_string by SCP to" 2505 printf "\n ${pathout[$i]}/${ host_configuration}_${jobname}${endout[$i]}$catalog_string\n"2531 printf "\n ${pathout[$i]}/${configuration_identifier}_${run_identifier}${endout[$i]}$catalog_string\n" 2506 2532 2507 2533 # TRANSFER VIA SCP 2508 2534 if [[ "$remote_loginnode" != "" ]] 2509 2535 then 2510 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}_${jobname}${endout[$i]} ${extout[$i]}" | ssh -q $remote_username@$remote_loginnode2536 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]}\" ${configuration_identifier}_${run_identifier}${endout[$i]} ${extout[$i]}" | ssh -q $remote_username@$remote_loginnode 2511 2537 else 2512 batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address ${localout[$i]} "${pathout[$i]}" ${ host_configuration}_${jobname}${endout[$i]} ${extout[$i]}2538 batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address ${localout[$i]} "${pathout[$i]}" ${configuration_identifier}_${run_identifier}${endout[$i]} ${extout[$i]} 2513 2539 fi 2514 2540 [[ $? != 0 ]] && transfer_failed=true … … 2519 2545 then 2520 2546 printf " +++ transfer failed. Trying to save a copy on this host under:\n" 2521 printf " ${pathout[$i]}/${ host_configuration}_${jobname}${endout[$i]}_$run_id\n"2547 printf " ${pathout[$i]}/${configuration_identifier}_${run_identifier}${endout[$i]}_$run_id_number\n" 2522 2548 2523 2549 # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY … … 2529 2555 mkdir -p $local_catalog 2530 2556 fi 2531 eval cp ${localout[$i]} ${pathout[$i]}/${ host_configuration}_${jobname}${endout[$i]}_$run_id2557 eval cp ${localout[$i]} ${pathout[$i]}/${configuration_identifier}_${run_identifier}${endout[$i]}_$run_id_number 2532 2558 transfer_problems=true 2533 2559 fi … … 2755 2781 2756 2782 # BUILD THE PALMRUN-COMMAND TO BE CALLED IN THE BATCH-JOB 2757 palmrun_com="$palmrun_script_name -d $ jobname -h $host_configuration -m $memory -t $cpumax -q $queue -r $run_id-U $local_username"2783 palmrun_com="$palmrun_script_name -d $run_identifier -h $configuration_identifier -m $memory -t $cpumax -q $queue -i $run_id_number -U $local_username" 2758 2784 [[ "$activation_string_list" != "" ]] && palmrun_com=${palmrun_com}" -a \"$activation_string_list\"" 2759 2785 [[ "$global_revision" != "" ]] && palmrun_com=${palmrun_com}" -G \"$global_revision\"" … … 2788 2814 # DETERMINE THE FULL PATHS FOR THE JOB PROTOCOL FILES ON THE LOCAL AND 2789 2815 # REMOTE HOST 2790 job_protocol_file_local=${local_jobcatalog}/${ host_configuration}_${job_id}2816 job_protocol_file_local=${local_jobcatalog}/${configuration_identifier}_${run_id} 2791 2817 job_protocol_file=$job_protocol_file_local 2792 2818 if [[ $create_remote_batch_job = true ]] 2793 2819 then 2794 job_protocol_file_remote=${remote_jobcatalog}/${ host_configuration}_${job_id}2820 job_protocol_file_remote=${remote_jobcatalog}/${configuration_identifier}_${run_id} 2795 2821 job_protocol_file=$job_protocol_file_remote 2796 2822 job_transfer_protocol_file=${remote_jobcatalog}/last_job_transfer_protocol 2797 scpjob_file=${remote_jobcatalog}/scpjob.$run_id 2823 scpjob_file=${remote_jobcatalog}/scpjob.$run_id_number 2798 2824 fi 2799 2825 2800 2826 2801 2827 # BUILD THE JOB-SCRIPTS ON FILE jobfile 2802 jobfile=jobfile.$run_id 2828 jobfile=jobfile.$run_id_number 2803 2829 2804 2830 … … 2819 2845 if [[ $create_remote_batch_job = true ]] 2820 2846 then 2821 echo "set +vx" >> $jobfile2822 echo "trap '" >> $jobfile2823 echo "set +vx" >> $jobfile2824 echo "cd ${remote_jobcatalog}" >> $jobfile2825 echo "cat > scpjob.$run_id << %%END%%">> $jobfile2847 echo "set +vx" >> $jobfile 2848 echo "trap '" >> $jobfile 2849 echo "set +vx" >> $jobfile 2850 echo "cd ${remote_jobcatalog}" >> $jobfile 2851 echo "cat > scpjob.$run_id_number << %%END%%" >> $jobfile 2826 2852 2827 2853 # ADD THE BATCH DIRECTIVES … … 2837 2863 2838 2864 echo "set -x" >> $jobfile 2839 echo "${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT -d -w 10 -u $local_username $local_ip $job_protocol_file_remote \"$local_jobcatalog\" ${ host_configuration}_${jobname}" >> $jobfile2865 echo "${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT -d -w 10 -u $local_username $local_ip $job_protocol_file_remote \"$local_jobcatalog\" ${configuration_identifier}_${run_identifier}" >> $jobfile 2840 2866 echo "%%END%%" >> $jobfile 2841 2867 echo "echo \" *** submitting job for transfering the job protocol file to $local_ip\" " >> $jobfile … … 2916 2942 if [[ $do_trace = true ]] 2917 2943 then 2918 echo " scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${ host_configuration}_${job_id}"2919 fi 2920 scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${ host_configuration}_${job_id} > /dev/null2944 echo " scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${configuration_identifier}_${run_id}" 2945 fi 2946 scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${configuration_identifier}_${run_id} > /dev/null 2921 2947 2922 2948 printf " *** submit the job (output of submit command, e.g. the job-id, may follow)" 2923 2949 if [[ $do_trace = true ]] 2924 2950 then 2925 echo " cd $remote_jobcatalog; $submit_command ${ host_configuration}_${job_id}; rm ${host_configuration}_${job_id} | ssh -q $ssh_key $SSH_PORTOPT ${remote_username}@${remote_ip} 2>&1"2926 fi 2927 echo "cd $remote_jobcatalog; $submit_command ${ host_configuration}_${job_id}; rm ${host_configuration}_${job_id}" | ssh -q $ssh_key $SSH_PORTOPT ${remote_username}@${remote_ip} 2>&12951 echo " cd $remote_jobcatalog; $submit_command ${configuration_identifier}_${run_id}; rm ${configuration_identifier}_${run_id} | ssh -q $ssh_key $SSH_PORTOPT ${remote_username}@${remote_ip} 2>&1" 2952 fi 2953 echo "cd $remote_jobcatalog; $submit_command ${configuration_identifier}_${run_id}; rm ${configuration_identifier}_${run_id}" | ssh -q $ssh_key $SSH_PORTOPT ${remote_username}@${remote_ip} 2>&1 2928 2954 2929 2955 elif [[ $create_batch_job = true ]] … … 2931 2957 2932 2958 eval local_jobcatalog=$local_jobcatalog 2933 cp $jobfile ${local_jobcatalog}/${ host_configuration}_${job_id}2959 cp $jobfile ${local_jobcatalog}/${configuration_identifier}_${run_id} 2934 2960 cd $local_jobcatalog 2935 2961 echo " " … … 2937 2963 if [[ $do_trace = true ]] 2938 2964 then 2939 echo "$submit_command ${ host_configuration}_${job_id}"2940 fi 2941 $submit_command ${ host_configuration}_${job_id}2942 rm ${ host_configuration}_${job_id}2965 echo "$submit_command ${configuration_identifier}_${run_id}" 2966 fi 2967 $submit_command ${configuration_identifier}_${run_id} 2968 rm ${configuration_identifier}_${run_id} 2943 2969 cd - > /dev/null 2944 2970
Note: See TracChangeset
for help on using the changeset viewer.