Changeset 2669 for palm/trunk/SCRIPTS/palmrun
- Timestamp:
- Dec 6, 2017 4:03:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrun
r2639 r2669 27 27 # ----------------- 28 28 # $Id$ 29 # file attributes in .palm.iofiles restructured, "loc" attribute completely 30 # removed, 31 # wildcard (*) allowed in .palm.iofiles as file activation string for output 32 # files, 33 # informative messages in case of missing optional input files shortened 34 # bugfix: variable cycle explicitly interpreted with 10 as the number base 35 # 36 # 2638 2017-11-23 12:44:23Z raasch 29 37 # use of wildcards in file connection statements enabled 30 38 # … … 515 523 do 516 524 517 # FIRST REPLACE ENVIRONMENT-VARIABLES BY THEIR RESPECTIVE VALUES 518 eval line=\"$line\" 519 525 # REPLACE REPEATING SPACES BETWEEN THE COLUMNS BY A SINGLE SPACE 526 line=`echo "$line" | sed -e "s/\s\{1,\}/ /g"` 520 527 521 528 # INTERPRET THE LINE … … 535 542 # LINE DEFINES FILE CONNECTION. READ THE FILE ATTRIBUTES. 536 543 # s2a: in/out - field 537 # s2b: loc - field (optional) 538 # s2c: tr/ar - field (optional) 539 s1=`echo $line | cut -d" " -f1` 540 s2=`echo $line | cut -d" " -s -f2` 541 s2a=$(echo $s2 | cut -d":" -f1) 544 # s2b: action - field (optional) 545 s1=`echo "$line" | cut -d" " -f1` 546 s2=`echo "$line" | cut -d" " -s -f2` 547 # s2a=$(echo $s2 | cut -d":" -f1) 542 548 if [[ $(echo $s2 | grep -c ":") = 0 ]] 543 549 then 550 s2a=$s2 544 551 s2b="" 545 s2c=""546 552 else 547 s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'` 548 s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'` 549 fi 550 s3=`echo $line | cut -d" " -f3` 551 s4=`echo $line | cut -d" " -s -f4` 552 s5=`echo $line | cut -d" " -s -f5` 553 s6=`echo $line | cut -d" " -s -f6` 553 s2a=`echo $s2 | cut -d":" -f1` 554 s2b=`echo $s2 | cut -d":" -f2` 555 fi 556 s3=`echo "$line" | cut -d" " -f3 | sed 's/*/wildcard /g'` 557 s4=`echo "$line" | cut -d" " -s -f4` 558 eval s4=\"$s4\" # REPLACE ENVIRONMENT-VARIABLES IN PATH BY THEIR RESPECTIVE VALUES 559 echo "### s4=\"$s4\" " 560 s5=`echo "$line" | cut -d" " -s -f5` 561 s6=`echo "$line" | cut -d" " -s -f6` 554 562 555 563 … … 558 566 # VARIABLE S3 MAY CONTAIN A LIST OF ACTIVATION STRINGS (FIELD-SEPERATOR ":"). 559 567 # IF EXECUTION IS SCHEDULED FOR A REMOTE-MACHINE AND THE FILE IS ONLY 560 # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b = loc), THE FILE CONNECTION568 # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b != tr), THE FILE CONNECTION 561 569 # IS NOT CHECKED AND STORED. 562 570 IFSALT="$IFS"; IFS="$IFS:" # ADD ":" AS FIELD SEPARATOR 563 if [[ "$s2a" = in && ! ( $create_remote_batch_job = true && ( "$s2b" = loc || "$s2b" = locopt )) ]]571 if [[ ( "$s2a" = in || "$s2a" = inopt ) && ! ( $create_remote_batch_job = true && "$s2b" != tr ) ]] 564 572 then 565 573 found=false … … 574 582 then 575 583 (( iin = iin + 1 )) 576 localin_pre[$iin]=$s1; transin_pre[$iin]=$s2b; actionin_pre[$iin]=$s2c;584 localin_pre[$iin]=$s1; actionin_pre[$iin]=$s2b; 577 585 pathin_pre[$iin]=$s4; endin_pre[$iin]=$s5; extin_pre[$iin]=$s6 586 if [[ "$s2a" = inopt ]] 587 then 588 optin_pre[$iin]=yes 589 else 590 optin_pre[$iin]=no 591 fi 578 592 579 593 # FILES WITH JOB-ATTRIBUTE ARE STORED IN THE SOURCES_FOR_RUN 580 594 # FOLDER IF THE JOB IS RUNNING ON A REMOTE HOST 581 if [[ $running_on_remote = true && ( "$s2b" = job || "$s2b" = jobopt )]]595 if [[ $running_on_remote = true && "$s2b" = tr ]] 582 596 then 583 597 pathin_pre[$iin]=${fast_io_catalog}/${sources_for_run_catalog} … … 588 602 if [[ "${s5: -1}" = "*" ]] 589 603 then 590 if [[ "$s2 c" = "di" ]]604 if [[ "$s2b" = "di" ]] 591 605 then 592 606 printf "\n +++ wildcards (*) not allowed with \"di\" file attribute." … … 602 616 fi 603 617 fi 604 elif [[ "$s2a" = out && ! ( $create_remote_batch_job = true && "$s2b" = loc) ]]618 elif [[ "$s2a" = out && ! ( $create_remote_batch_job = true ) ]] 605 619 then 606 620 found=false 621 echo "### line=\"$line\" " 607 622 for actual in $activation_string_list 608 623 do 609 624 for formal in $s3 610 625 do 611 [[ $actual = $formal || "$formal" = "-" ]] && found=true 626 echo "--- actual=\"$actual\" formal=\"$formal\" s3=\"$s3\" " 627 if [[ $actual = $formal || $formal = wildcard ]] 628 then 629 found=true 630 echo "--- found" 631 else 632 echo "--- not found" 633 fi 612 634 done 613 635 done … … 615 637 then 616 638 (( iout = iout + 1 )) 617 localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2 c; typeout_pre[$iout]=$s3;639 localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2b 618 640 pathout_pre[$iout]=$s4; endout_pre[$iout]=$s5; extout_pre[$iout]=$s6 641 echo "### pathout_pre[$iout]=\"${pathout_pre[$iout]}\" " 642 643 # CHECK IF WILDCARD IS USED AS ACTIVATION STRING 644 # IN SUCH CASES, NO WARNING WILL LATER BE OUTPUT IF LOCAL FILES DO NOT EXIST 645 if [[ $formal = wildcard ]] 646 then 647 warnout_pre[$iout]=false 648 else 649 warnout_pre[$iout]=true 650 fi 619 651 620 652 # CHECK FOR MULTIPLE FILES, SET A RESPECTIVE FLAG AND REMOVE … … 622 654 if [[ "${s1: -1}" = "*" ]] 623 655 then 624 if [[ "$s2 c" = "di" ]]656 if [[ "$s2b" = "di" ]] 625 657 then 626 658 printf "\n +++ wildcards (*) not allowed with \"di\" file attribute." … … 636 668 fi 637 669 fi 638 elif [[ "$s2a" != in && "$s2a" != out ]]639 then 640 printf "\n +++ I/O-attribute in configuration file $config_file has theinvalid"641 printf "\n value \"$s2\". Only \"in\" and \"out\" are allowed!"670 elif [[ "$s2a" != in && "$s2a" != inopt && "$s2a" != out ]] 671 then 672 printf "\n +++ I/O-attribute in file $fileconnection_file has invalid" 673 printf "\n value \"$s2\". Only \"in\", \"inopt\", and \"out\" are allowed!" 642 674 locat=connect; exit 643 675 fi … … 1024 1056 then 1025 1057 1026 # FILES WITH ATTRIBUTE locopt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST.1027 if [[ "${ transin_pre[$i]}" != "locopt" && "${transin_pre[$i]}" != "jobopt" ]]1058 # FILES WITH ATTRIBUTE opt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST. 1059 if [[ "${optin_pre[$i]}" != "yes" ]] 1028 1060 then 1029 1061 printf "\n\n +++ INPUT-file: " … … 1039 1071 (( nr_of_input_files = nr_of_input_files + 1 )) 1040 1072 localin[$nr_of_input_files]="${localin_pre[$i]}" 1041 transin[$nr_of_input_files]="unavailable"1042 actionin[$nr_of_input_files]=" ${actionin_pre[$i]}"1073 optin[$nr_of_input_files]="${optin_pre[$i]}" 1074 actionin[$nr_of_input_files]="unavailable" 1043 1075 pathin[$nr_of_input_files]="${pathin_pre[$i]}" 1044 1076 endin[$nr_of_input_files]="${endin_pre[$i]}" … … 1128 1160 (( nr_of_input_files = nr_of_input_files + 1 )) 1129 1161 localin[$nr_of_input_files]="${localin_pre[$i]}"$ending 1130 transin[$nr_of_input_files]="${transin_pre[$i]}"1162 optin[$nr_of_input_files]="${optin_pre[$i]}" 1131 1163 actionin[$nr_of_input_files]="${actionin_pre[$i]}" 1132 1164 pathin[$nr_of_input_files]="${pathin_pre[$i]}" … … 1164 1196 if [[ $cycle =~ ^-?[0-9]+$ ]] 1165 1197 then 1166 (( icycle = $cycle )) 1198 # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS 1199 # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10 1200 (( icycle = $((10#$cycle)) )) 1167 1201 else 1168 1202 (( icycle = 0 )) … … 1755 1789 1756 1790 1757 # WHEN CREATING A REMOTE BATCH JOB, THOSE INPUT FILES WITH JOB-ATTRIBUT WILL1758 # BE COPIED TO THE REMOTE HOST1791 # WHEN CREATING A REMOTE BATCH JOB, THOSE INPUT FILES WITH TRANSFER-ATTRIBUT 1792 # WILL BE COPIED TO THE REMOTE HOST 1759 1793 if [[ $create_remote_batch_job = true ]] 1760 1794 then … … 1763 1797 do 1764 1798 (( i = i + 1 )) 1765 if [[ "${ transin[$i]}" = job || "${transin[$i]}" = jobopt]]1799 if [[ "${actionin[$i]}" = tr ]] 1766 1800 then 1767 1801 eval inputfile=${pathin[$i]}/${frelin[$i]} … … 1802 1836 # PROVIDE THE INPUT FILES 1803 1837 # LOOP OVER ALL ACTIVATED FILES (LISTED IN THE CONFIGURATION FILE) 1838 optional_files_missing=false 1804 1839 (( i = 0 )) 1805 1840 while (( i < nr_of_input_files )) … … 1813 1848 1814 1849 # SKIP OPTIONAL FILES, IF THEY DO NOT EXIST 1815 if [[ "${transin[$i]}" = unavailable ]] 1816 then 1817 if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] 1818 then 1819 printf "\n *** INFORMATIVE: input file \"${pathin[$i]}/${fname}${endin[$i]}\" " 1820 printf "\n is not available!" 1821 else 1822 printf "\n *** INFORMATIVE: input file \"${pathin[$i]}/${fname}${endin[$i]}.${extin[$i]}\" " 1823 printf "\n is not available!" 1824 fi 1850 if [[ "${actionin[$i]}" = unavailable ]] 1851 then 1852 optional_files_missing=true 1825 1853 continue 1826 1854 fi … … 1887 1915 1888 1916 # FILE IS STORED IN THE RESPECTIVE DIRECTORY GIVEN IN THE CONFIGURATION FILE 1889 if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = " npe" ]]1917 if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "tr" || "${actionin[$i]}" = "npe" ]] 1890 1918 then 1891 1919 … … 1962 1990 printf "\n --- WARNING: ln failed, using cp instead (might be time consuming...)" 1963 1991 fi 1964 if [[ $running_on_remote = true && ( "${transin[$i]}" = job || "${transin[$i]}" = jobopt )]]1992 if [[ $running_on_remote = true && "${actionin[$i]}" = tr ]] 1965 1993 then 1966 1994 mv ${absnamein[$i]} ${localin[$i]} … … 1976 2004 if (( i != 0 )) 1977 2005 then 2006 if [[ $optional_files_missing = true ]] 2007 then 2008 printf "\n *** INFORMATIVE: some optional INPUT-files are not present" 2009 fi 1978 2010 printf "\n$dashes\n *** all INPUT-files provided \n" 1979 2011 fi … … 2208 2240 endout[$nr_of_output_files]="${endout_pre[$i]}"$ending 2209 2241 extout[$nr_of_output_files]="${extout_pre[$i]}" 2242 warnout[$nr_of_output_files]="${warnout_pre[$i]}" 2210 2243 2211 2244 done … … 2268 2301 if [[ $cycle =~ ^-?[0-9]+$ ]] 2269 2302 then 2270 (( icycle = $cycle + 1 )) 2303 # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS 2304 # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10 2305 (( icycle = $((10#$cycle)) + 1 )) 2271 2306 else 2272 2307 (( icycle = 1 )) … … 2346 2381 if [[ ! -f ${localout[$i]} && $files_for_cores = false ]] 2347 2382 then 2348 printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" 2383 if [[ ${warnout[$i]} = true ]] 2384 then 2385 printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" 2386 fi 2349 2387 elif [[ ! -d ${localout[$i]} && $files_for_cores = true ]] 2350 2388 then 2351 printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" 2389 if [[ ${warnout[$i]} = true ]] 2390 then 2391 printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" 2392 fi 2352 2393 else 2353 2394
Note: See TracChangeset
for help on using the changeset viewer.