- Timestamp:
- 12/22/11 16:04:47 (12 years ago)
- Location:
- trunk/libIGCM
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/AA_additionnal
r504 r544 82 82 #-Q- sx9mercure ## CESIUM FOR SX9 CEA ## 83 83 #-Q- sx9mercure ######################### 84 #-Q- sx9mercure #MSUB -r ATL_ADD # Nom du job 84 #-Q- sx9mercure #MSUB -r ATL_ADD # Nom du job 85 85 #-Q- sx9mercure #MSUB -N 1 # Reservation du noeud 86 86 #-Q- sx9mercure #MSUB -n 2 # Reservation du processus … … 93 93 #-Q- titane ## TITANE CEA ## 94 94 #-Q- titane ###################### 95 #-Q- titane #MSUB -r ATL_ADD # Nom du job 96 #-Q- titane #MSUB -N 1 # Reservation du noeud 97 #-Q- titane #MSUB -n 2 # Reservation du processus 98 #-Q- titane #MSUB -c 4 # Reservation du core 95 #-Q- titane #MSUB -r ATL_ADD # Nom du job 96 #-Q- titane #MSUB -eo 97 #-Q- titane #MSUB -n 1 # Reservation du processus 99 98 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 100 #-Q- titane #MSUB -E "-j o" 101 #-Q- titane #MSUB -E "-S /bin/ksh" 102 #-Q- titane ##MSUB -e nco.out # Sortie standard 103 #-Q- titane ##MSUB -o nco.out # Sortie standard 99 #-Q- titane #MSUB -q mono 104 100 #-Q- default #!/bin/ksh 105 101 #-Q- default ################## -
trunk/libIGCM/AA_atlas_LMDZ
r504 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r ATL_LMDZ # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- default #!/bin/ksh 102 99 #-Q- default ################## -
trunk/libIGCM/AA_atlas_ORCA_LIM
r518 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r ATL_OPA # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- default #!/bin/ksh 102 99 #-Q- default ################## -
trunk/libIGCM/AA_atlas_ORCHIDEE
r504 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r ATL_ORCH # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- lxiv8 ###################### 102 99 #-Q- lxiv8 ## OBELIX LSCE ## -
trunk/libIGCM/AA_atlas_PISCES
r504 r544 91 91 #-Q- titane ## TITANE CEA ## 92 92 #-Q- titane ###################### 93 #-Q- titane #MSUB -r ATL_PIS # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud93 #-Q- titane #MSUB -r ATL_PIS # Nom du job 94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- default #!/bin/ksh 102 99 #-Q- default ################## -
trunk/libIGCM/AA_create_multi_se
r504 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r MULTISE # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- lxiv8 ###################### 102 99 #-Q- lxiv8 ## OBELIX LSCE ## -
trunk/libIGCM/AA_create_se
r504 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r SE # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- lxiv8 ###################### 102 99 #-Q- lxiv8 ## OBELIX LSCE ## -
trunk/libIGCM/AA_create_ts
r514 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r TS # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- lxiv8 ###################### 102 99 #-Q- lxiv8 ## OBELIX LSCE ## -
trunk/libIGCM/AA_monitoring
r504 r544 92 92 #-Q- titane ###################### 93 93 #-Q- titane #MSUB -r MONITORING # Nom du job 94 #-Q- titane #MSUB - N 1 # Reservation du noeud94 #-Q- titane #MSUB -eo 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -E "-j o" 98 #-Q- titane #MSUB -E "-S /bin/ksh" 99 #-Q- titane ##MSUB -e nco.out # Sortie standard 100 #-Q- titane ##MSUB -o nco.out # Sortie standard 97 #-Q- titane #MSUB -q mono 101 98 #-Q- lxiv8 ###################### 102 99 #-Q- lxiv8 ## OBELIX LSCE ## -
trunk/libIGCM/AA_rebuild_fromArchive
r504 r544 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -p gen221198 97 #-Q- titane #MSUB -q mono 99 98 #-Q- lxiv8 ###################### -
trunk/libIGCM/AA_rebuild_fromWorkdir
r504 r544 95 95 #-Q- titane #MSUB -n 1 # Reservation du processus 96 96 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 97 #-Q- titane #MSUB -p gen221198 97 #-Q- titane #MSUB -q mono 99 98 #-Q- lxiv8 ###################### -
trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
r522 r544 15 15 function IGCM_comp_Initialize 16 16 { 17 17 IGCM_debug_PushStack "IGCM_comp_Initialize" 18 18 19 19 # Debug Print : 20 echo 21 IGCM_debug_Print 1 "IGCM_comp_Initialize" 22 echo 23 24 typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option option i j 25 for comp in ${config_ListOfComponents[*]} ; do 26 # Debug Print 27 IGCM_debug_Print 1 "Initialize ${comp} : ${compname} component." 28 29 # Define component 30 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} 31 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 32 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 33 34 # Read libIGCM compatibility version in ${compname}.card 35 card=${SUBMIT_DIR}/COMP/${compname}.card 36 IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM 37 38 eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1 39 if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then 40 IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." 41 fi 42 43 # Manage component executable 44 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp} 45 46 # Read component Write Frequency in config.card 47 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency 48 # Debug Print : 49 eval auxprint=\${config_${comp}_WriteFrequency} 50 IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} " 51 #2> /dev/null 52 53 # Debug Print : 54 IGCM_debug_Print 2 "Initialize following component library" 55 56 # Source drivers in directory DRIVER if it exist 57 # else source them from directory COMP 58 if [ -d ${SUBMIT_DIR}/DRIVER ] ; then 59 IGCM_debug_Print 2 ${SUBMIT_DIR}/DRIVER/${compname}.driver 60 # Source component library 61 . ${SUBMIT_DIR}/DRIVER/${compname}.driver 62 else 63 IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver 64 # Source component library 65 . ${SUBMIT_DIR}/COMP/${compname}.driver 66 fi 67 IGCM_debug_Print 3 "With tag : ${comptagname}" 68 69 # Debug Print 70 IGCM_debug_Print 3 "Initialize ${comp} output directory." 71 72 # Define ARCHIVED Dirs 73 eval R_OUT_${comp}=${R_SAVE}/${comp} 74 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}} 75 76 eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output 77 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O} 78 79 eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart 80 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R} 81 82 eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug 83 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D} 84 85 eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS 86 eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF 87 eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA 88 eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO 89 eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE 90 91 # Define BUFFERED Dirs 92 eval R_BUF_${comp}=${R_BUFR}/${comp} 93 eval IGCM_sys_Mkdir \${R_BUF_${comp}} 94 95 eval R_BUF_${comp}_O=\${R_BUF_${comp}}/Output 96 eval IGCM_sys_Mkdir \${R_BUF_${comp}_O} 97 98 eval R_BUF_${comp}_R=\${R_BUF_${comp}}/Restart 99 eval IGCM_sys_Mkdir \${R_BUF_${comp}_R} 100 101 eval R_BUF_${comp}_D=\${R_BUF_${comp}}/Debug 102 eval IGCM_sys_Mkdir \${R_BUF_${comp}_D} 103 104 eval R_BUF_${comp}_O_I=\${R_BUF_${comp}_O}/INS 105 eval R_BUF_${comp}_O_H=\${R_BUF_${comp}_O}/HF 106 eval R_BUF_${comp}_O_D=\${R_BUF_${comp}_O}/DA 107 eval R_BUF_${comp}_O_M=\${R_BUF_${comp}_O}/MO 108 eval R_BUF_${comp}_O_Y=\${R_BUF_${comp}_O}/YE 109 110 # Read UserChoices section of component card 111 IGCM_debug_Print 2 "DefineArrayFromSection : ${compname}_UserChoices ${card}" 112 IGCM_card_DefineArrayFromSection ${card} UserChoices 113 eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1 114 # If section is not empty we define corresponding variables 115 if [ X${first_option} != X"Error:" ] ; then 116 if [ X${card_UserChoices[0]} != X ] ; then 117 unset card_UserChoices 118 fi 119 eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1 120 IGCM_debug_Print 3 "${compname}_UserChoices_values:" 121 for option in ${card_UserChoices[*]} ; do 122 IGCM_card_DefineVariableFromOption ${card} UserChoices ${option} 123 eval IGCM_debug_Print 3 "${option}=\${${compname}_UserChoices_${option}}" 124 done 125 fi 126 127 # Read and Build Output File stuff 128 IGCM_debug_Print 2 "DefineArrayFromOption : ${compname}_OutputFiles ${card}" 129 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 130 ListFilesName=${compname}_OutputFiles_List 131 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 132 # 133 if [ X${FileName0} != X${NULL_STR} ] ; then 134 # 135 #IGCM_debug_Print 1 "Component : ${compname}" 136 # 137 # INITIALISATION 138 # 139 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 140 # 141 i=2 142 # 143 until [ $i -ge $NbFiles ]; do 144 # 145 eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 146 # 147 if [ X${flag_post} != XNONE ] ; then 148 # 149 # First of all 150 # 151 IGCM_card_DefineArrayFromSection ${card} ${flag_post} 152 # 153 # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default 154 # 155 # variable option allready typeset above 156 for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do 157 if [ ${option} = Seasonal ] ; then 158 FoundSeasonal=true 159 IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal 160 fi 161 done 162 # 163 if [ ! X${FoundSeasonal} = Xtrue ] ; then 164 eval ${compname}_${flag_post}_Seasonal=ON 165 fi 166 # 167 if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then 168 Seasonal=true 169 fi 170 171 # Dimension = vide si vieille card. 172 IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars 173 IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches 174 if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not" ] ; then 175 # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob. 176 ListDimension[0]=2D 177 ListDimension[1]=3D 178 TimeSeries=false 179 iLoop=${#ListDimension[*]} 180 j=0 181 until [ $j -ge ${iLoop} ]; do 182 Dimension=${ListDimension[${j}]} 183 IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension} 184 IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension} 185 # 186 # Time series WITHOUT chunk 187 # 188 if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then 189 if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then 190 IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post}" 191 eval TimeSeries${Dimension}=true 192 fi 193 fi 194 # 195 # Time series WITH chunk 196 # 197 if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then 198 chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) 199 if [ ! ${chunck_size} = NONE ] && [ ! ${chunck_size} = OFF ] ; then 200 IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post}" 201 eval TimeSeriesChunck${Dimension}=true 202 eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp} 203 eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i} 204 eval set +A CHUNCK${Dimension}_NAME \${CHUNCK${Dimension}_NAME[*]} ${flag_post} 205 eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size} 206 fi 207 fi 208 (( j=j+1 )) 209 done 210 else 211 ListDimension[0]="" 212 TimeSeries=true 213 TimeSeries2D=false 214 TimeSeries3D=false 215 TimeSeriesChunck2D=false 216 TimeSeriesChunck3D=false 217 fi 218 fi 219 (( i=i+3 )) 220 done 221 fi 222 # Debug Print 223 IGCM_debug_Print 3 "Initialize ${compname} with driver." 224 # INIT component 225 ${comp}_Initialize 20 226 echo 21 IGCM_debug_Print 1 "IGCM_comp_Initialize" 22 echo 23 24 typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option option i j 25 for comp in ${config_ListOfComponents[*]} ; do 26 # Debug Print 27 IGCM_debug_Print 1 ${comp} 28 # Define component 29 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} 30 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 31 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 32 33 # Read libIGCM compatibility version in ${compname}.card 34 card=${SUBMIT_DIR}/COMP/${compname}.card 35 IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM 36 37 eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1 38 if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then 39 IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." 40 fi 41 42 # Manage component executable 43 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp} 44 45 # Read component Write Frequency in config.card 46 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency 47 # Debug Print : 48 eval auxprint=\${config_${comp}_WriteFrequency} 49 IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} " 50 #2> /dev/null 51 52 # Debug Print : 53 IGCM_debug_Print 2 "Initialize following component library" 54 55 # Source drivers in directory DRIVER if it exist 56 # else source them from directory COMP 57 if [ -d ${SUBMIT_DIR}/DRIVER ] ; then 58 IGCM_debug_Print 2 ${SUBMIT_DIR}/DRIVER/${compname}.driver 59 # Source component library 60 . ${SUBMIT_DIR}/DRIVER/${compname}.driver 61 else 62 IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver 63 # Source component library 64 . ${SUBMIT_DIR}/COMP/${compname}.driver 65 fi 66 IGCM_debug_Print 3 "With tag : ${comptagname}" 67 68 69 # Debug Print 70 IGCM_debug_Print 3 "Initialize ${comp} output directory." 71 # Define Dirs 72 eval R_OUT_${comp}=${R_SAVE}/${comp} 73 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}} 74 75 eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output 76 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O} 77 78 eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart 79 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R} 80 81 eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug 82 eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D} 83 84 eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS 85 eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF 86 eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA 87 eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO 88 eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE 89 90 # Read UserChoices section of component card 91 IGCM_debug_Print 2 "DefineArrayFromSection : ${compname}_UserChoices ${card}" 92 IGCM_card_DefineArrayFromSection ${card} UserChoices 93 eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1 94 # If section is not empty we define corresponding variables 95 if [ X${first_option} != X"Error:" ] ; then 96 if [ X${card_UserChoices[0]} != X ] ; then 97 unset card_UserChoices 98 fi 99 eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1 100 IGCM_debug_Print 3 "${compname}_UserChoices_values:" 101 for option in ${card_UserChoices[*]} ; do 102 IGCM_card_DefineVariableFromOption ${card} UserChoices ${option} 103 eval IGCM_debug_Print 3 "${option}=\${${compname}_UserChoices_${option}}" 104 done 105 fi 106 107 # Read and Build Output File stuff 108 IGCM_debug_Print 2 "DefineArrayFromOption : ${compname}_OutputFiles ${card}" 109 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 110 ListFilesName=${compname}_OutputFiles_List 111 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 112 # 113 if [ X${FileName0} != X${NULL_STR} ] ; then 114 # 115 #IGCM_debug_Print 1 "Component : ${compname}" 116 # 117 # INITIALISATION 118 # 119 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 120 # 121 i=2 122 # 123 until [ $i -ge $NbFiles ]; do 124 # 125 eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 126 # 127 if [ X${flag_post} != XNONE ] ; then 128 # 129 # First of all 130 # 131 IGCM_card_DefineArrayFromSection ${card} ${flag_post} 132 # 133 # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default 134 # 135 # variable option allready typeset above 136 for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do 137 if [ ${option} = Seasonal ] ; then 138 FoundSeasonal=true 139 IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal 140 fi 141 done 142 # 143 if [ ! X${FoundSeasonal} = Xtrue ] ; then 144 eval ${compname}_${flag_post}_Seasonal=ON 145 fi 146 # 147 if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then 148 Seasonal=true 149 fi 150 151 # Dimension = vide si vieille card. 152 IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars 153 IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches 154 if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not" ] ; then 155 # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob. 156 ListDimension[0]=2D 157 ListDimension[1]=3D 158 TimeSeries=false 159 iLoop=${#ListDimension[*]} 160 j=0 161 until [ $j -ge ${iLoop} ]; do 162 Dimension=${ListDimension[${j}]} 163 IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension} 164 IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension} 165 # 166 # Time series WITHOUT chunk 167 # 168 if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then 169 if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then 170 IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post}" 171 eval TimeSeries${Dimension}=true 172 fi 173 fi 174 # 175 # Time series WITH chunk 176 # 177 if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then 178 chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) 179 if [ ! ${chunck_size} = NONE ] && [ ! ${chunck_size} = OFF ] ; then 180 IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post}" 181 eval TimeSeriesChunck${Dimension}=true 182 eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp} 183 eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i} 184 eval set +A CHUNCK${Dimension}_NAME \${CHUNCK${Dimension}_NAME[*]} ${flag_post} 185 eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size} 186 fi 187 fi 188 (( j=j+1 )) 189 done 190 else 191 ListDimension[0]="" 192 TimeSeries=true 193 TimeSeries2D=false 194 TimeSeries3D=false 195 TimeSeriesChunck2D=false 196 TimeSeriesChunck3D=false 197 fi 198 fi 199 (( i=i+3 )) 200 done 201 fi 202 # Debug Print 203 IGCM_debug_Print 3 "Initialize ${compname} with driver." 204 # INIT component 205 ${comp}_Initialize 206 echo 207 done 208 209 IGCM_debug_PopStack "IGCM_comp_Initialize" 227 done 228 229 IGCM_debug_PopStack "IGCM_comp_Initialize" 210 230 } 211 231 … … 213 233 function IGCM_comp_PrepareDeletedFiles 214 234 { 215 216 217 218 219 220 221 222 223 235 IGCM_debug_PushStack "IGCM_comp_PrepareDeletedFiles" $@ 236 237 if [ X${2} != X. ] ; then 238 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${2} ) > /dev/null 2>&1 239 else 240 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${1} ) > /dev/null 2>&1 241 fi 242 243 IGCM_debug_PopStack "IGCM_comp_PrepareDeletedFiles" 224 244 } 225 245 … … 227 247 function IGCM_comp_GetInputInitialStateFiles 228 248 { 229 IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles" 230 231 # Debug Print : 232 echo 233 IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles" 234 echo 235 236 # Only the first time step need InitialStateFiles 237 # otherwise it's BoundaryConditions 238 if ( ${FirstInitialize} ) ; then 239 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 240 typeset file_in_ file_in file_out_ file_out do_init 241 for comp in ${config_ListOfComponents[*]} ; do 242 # Initialize 249 IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles" 250 251 # Debug Print : 252 echo 253 IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles" 254 echo 255 256 # Only the first time step need InitialStateFiles 257 # otherwise it's BoundaryConditions 258 if ( ${FirstInitialize} ) ; then 259 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 260 typeset file_in_ file_in file_out_ file_out do_init 261 for comp in ${config_ListOfComponents[*]} ; do 262 # Initialize 263 do_init="y" 264 # Do we need to bring initial state file for this component 265 if [ "${config_Restarts_OverRule}" = "y" ] ; then 266 eval do_init="n" 267 else 268 # Read component Restarts parameters 269 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart 270 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 271 if [ "${do_start}" = "y" ] ; then 272 do_init="n" 273 else 243 274 do_init="y" 244 # Do we need to bring initial state file for this component 245 if [ "${config_Restarts_OverRule}" = "y" ] ; then 246 eval do_init="n" 247 else 248 # Read component Restarts parameters 249 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart 250 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 251 if [ "${do_start}" = "y" ] ; then 252 do_init="n" 253 else 254 do_init="y" 255 fi 256 fi 257 258 if [ "${do_init}" = "y" ] ; then 259 # Define component 260 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 261 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 262 263 # Debug Print : 264 IGCM_debug_Print 3 "Initialisation files ${compname}" 265 266 card=${SUBMIT_DIR}/COMP/${compname}.card 267 268 IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List 269 ListFilesName=${compname}_InitialStateFiles_List 270 271 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 272 if [ X${FileName0} != X${NULL_STR} ] ; then 273 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 274 (( i=0 )) 275 until [ $i -ge $NbFiles ]; do 276 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 277 eval file_in=${file_in_} 278 (( i_ = i+1 )) 279 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 280 eval file_out=${file_out_} 281 282 IGCM_sys_Get ${file_in} ${file_out} 283 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 284 285 (( i=i+2 )) 286 done 287 fi 288 fi 289 done 290 fi 291 IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles" 275 fi 276 fi 277 278 if [ "${do_init}" = "y" ] ; then 279 # Define component 280 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 281 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 282 283 # Debug Print : 284 IGCM_debug_Print 3 "Initialisation files ${compname}" 285 286 card=${SUBMIT_DIR}/COMP/${compname}.card 287 288 IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List 289 ListFilesName=${compname}_InitialStateFiles_List 290 291 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 292 if [ X${FileName0} != X${NULL_STR} ] ; then 293 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 294 (( i=0 )) 295 until [ $i -ge $NbFiles ]; do 296 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 297 eval file_in=${file_in_} 298 (( i_ = i+1 )) 299 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 300 eval file_out=${file_out_} 301 302 IGCM_sys_Get ${file_in} ${file_out} 303 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 304 305 (( i=i+2 )) 306 done 307 fi 308 fi 309 done 310 fi 311 IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles" 292 312 } 293 313 … … 311 331 function IGCM_SmoothModulo 312 332 { 313 IGCM_debug_PushStack "IGCM_SmoothModulo" 314 typeset defVector ModValue 315 316 eval set +A defVector -- $( echo "${1}" | \ 317 gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' ) 318 319 # Save Smooth Min and Max. Needed to call IGCM_sys_Get when appropriate 320 arr[1]=${defVector[0]} 321 arr[2]=${defVector[2]} 322 323 # Test limits : 324 # ${defVector[0]} <= ${2} <= ${defVector[2]} 325 # or ${defVector[2]} == -1 326 if ( [ ${2} -ge ${defVector[0]} ] && \ 327 ( [ ${2} -le ${defVector[2]} ] || \ 328 [ ${defVector[2]} -lt 0 ] ) ) ; then 329 # Test modulo 330 ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} ) 331 if [ ${ModValue} -eq 0 ] ; then 332 arr[3]=true 333 echo ${arr[@]} 334 IGCM_debug_PopStack "IGCM_SmoothModulo" 335 return 1 336 else 337 arr[3]=false 338 echo ${arr[@]} 339 IGCM_debug_PopStack "IGCM_SmoothModulo" 340 return 0 341 fi 333 IGCM_debug_PushStack "IGCM_SmoothModulo" 334 typeset defVector ModValue 335 336 eval set +A defVector -- $( echo "${1}" | \ 337 gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' ) 338 339 # Save Smooth Min and Max. Needed to call IGCM_sys_Get when appropriate 340 arr[1]=${defVector[0]} 341 arr[2]=${defVector[2]} 342 343 # Test limits : 344 # ${defVector[0]} <= ${2} <= ${defVector[2]} 345 # or ${defVector[2]} == -1 346 if ( [ ${2} -ge ${defVector[0]} ] && ( [ ${2} -le ${defVector[2]} ] || [ ${defVector[2]} -lt 0 ] ) ) ; then 347 # Test modulo 348 ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} ) 349 if [ ${ModValue} -eq 0 ] ; then 350 arr[3]=true 351 echo ${arr[@]} 352 IGCM_debug_PopStack "IGCM_SmoothModulo" 353 return 1 342 354 else 343 arr[3]=false 344 echo ${arr[@]} 345 IGCM_debug_PopStack "IGCM_SmoothModulo" 346 return 0 347 fi 355 arr[3]=false 356 echo ${arr[@]} 357 IGCM_debug_PopStack "IGCM_SmoothModulo" 358 return 0 359 fi 360 else 361 arr[3]=false 362 echo ${arr[@]} 363 IGCM_debug_PopStack "IGCM_SmoothModulo" 364 return 0 365 fi 348 366 } 349 367 … … 351 369 function IGCM_comp_GetInputSmoothFiles 352 370 { 353 IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles" 371 IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles" 372 373 # Debug Print : 374 echo 375 IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles" 376 echo 377 378 typeset comp compname comptagname card ListFilesName FileName0 NbFiles j i i_ i__ 379 typeset file_in_ file_in file_out_ file_out ret SmoothDef aux val 380 381 for comp in ${config_ListOfComponents[*]} ; do 382 # Define component 383 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 384 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 354 385 355 386 # Debug Print : 356 echo 357 IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles" 358 echo 359 360 typeset comp compname comptagname card ListFilesName FileName0 NbFiles j i i_ i__ 361 typeset file_in_ file_in file_out_ file_out ret SmoothDef aux val 362 363 for comp in ${config_ListOfComponents[*]} ; do 364 # Define component 365 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 366 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 367 368 # Debug Print : 369 IGCM_debug_Print 3 "Smooth files ${compname}" 370 371 card=${SUBMIT_DIR}/COMP/${compname}.card 372 373 IGCM_card_DefineArrayFromOption ${card} SmoothFiles List 374 ListFilesName=${compname}_SmoothFiles_List 375 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 376 377 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != X"Section" ] ) ; then 378 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 379 380 (( i=0 )) 381 until [ $i -ge $NbFiles ]; do 382 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 383 eval file_in=${file_in_} 384 (( i_ = i+1 )) 385 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 386 eval file_out=${file_out_} 387 388 # define CumulPeriod definition for this file 389 (( i__ = i+2 )) 390 eval SmoothDef=\${${ListFilesName}[$i__]} 391 IGCM_debug_Print 3 " ${file_in} ${SmoothDef}" 392 aux=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} ) 393 j=1 394 for val in ${aux} ; do 395 [ ${j} -eq 1 ] && SmoothMin=${val} 396 [ ${j} -eq 2 ] && SmoothMax=${val} 397 [ ${j} -eq 3 ] && ret=${val} 398 (( j=j+1 )) 399 done 400 [ ${SmoothMax} -eq -1 ] && SmoothMax=${CumulPeriod} 401 if ( [ X${ret} = Xtrue ] || ( [ ${Period} -eq 1 ] && [ ${CumulPeriod} -ge ${SmoothMin} ] && [ ${CumulPeriod} -le ${SmoothMax} ] ) ) ; then 402 #if ( [ X${ret} = Xtrue ] || [ ${Period} -eq 1 ] ) ; then 403 IGCM_sys_Get ${file_in} ${file_out} 404 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 405 fi 406 (( i=i+3 )) 407 done 387 IGCM_debug_Print 3 "Smooth files ${compname}" 388 389 card=${SUBMIT_DIR}/COMP/${compname}.card 390 391 IGCM_card_DefineArrayFromOption ${card} SmoothFiles List 392 ListFilesName=${compname}_SmoothFiles_List 393 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 394 395 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != X"Section" ] ) ; then 396 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 397 398 (( i=0 )) 399 until [ $i -ge $NbFiles ]; do 400 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 401 eval file_in=${file_in_} 402 (( i_ = i+1 )) 403 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 404 eval file_out=${file_out_} 405 406 # define CumulPeriod definition for this file 407 (( i__ = i+2 )) 408 eval SmoothDef=\${${ListFilesName}[$i__]} 409 IGCM_debug_Print 3 " ${file_in} ${SmoothDef}" 410 aux=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} ) 411 j=1 412 for val in ${aux} ; do 413 [ ${j} -eq 1 ] && SmoothMin=${val} 414 [ ${j} -eq 2 ] && SmoothMax=${val} 415 [ ${j} -eq 3 ] && ret=${val} 416 (( j=j+1 )) 417 done 418 [ ${SmoothMax} -eq -1 ] && SmoothMax=${CumulPeriod} 419 if ( [ X${ret} = Xtrue ] || ( [ ${Period} -eq 1 ] && [ ${CumulPeriod} -ge ${SmoothMin} ] && [ ${CumulPeriod} -le ${SmoothMax} ] ) ) ; then 420 #if ( [ X${ret} = Xtrue ] || [ ${Period} -eq 1 ] ) ; then 421 IGCM_sys_Get ${file_in} ${file_out} 422 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 408 423 fi 409 done 410 411 IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles" 424 (( i=i+3 )) 425 done 426 fi 427 done 428 429 IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles" 412 430 } 413 431 … … 415 433 function IGCM_comp_GetInputBoundaryFiles 416 434 { 417 IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles" 435 IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles" 436 437 # Debug Print : 438 echo 439 IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles" 440 echo 441 442 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 443 typeset file_in_ file_in file_out_ file_out 444 445 if [ ${Period} = 1 ]; then 446 ListFixBoundary=" " 447 fi 448 449 for comp in ${config_ListOfComponents[*]} ; do 450 451 # Define component 452 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 453 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 418 454 419 455 # Debug Print : 420 echo 421 IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles" 422 echo 423 424 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 425 typeset file_in_ file_in file_out_ file_out 426 456 IGCM_debug_Print 3 "Boundary files ${compname}" 457 458 card=${SUBMIT_DIR}/COMP/${compname}.card 459 460 IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List 461 ListFilesName=${compname}_BoundaryFiles_List 462 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 463 464 if [ X${FileName0} != X${NULL_STR} ] ; then 465 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 466 467 (( i=0 )) 468 until [ $i -ge $NbFiles ]; do 469 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 470 eval file_in=${file_in_} 471 (( i_ = i+1 )) 472 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 473 eval file_out=${file_out_} 474 475 IGCM_sys_Get ${file_in} ${file_out} 476 IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 477 478 (( i=i+2 )) 479 done 480 fi 481 482 # Get non deleted files 427 483 if [ ${Period} = 1 ]; then 428 ListFixBoundary=" " 429 fi 430 431 for comp in ${config_ListOfComponents[*]} ; do 432 433 # Define component 434 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 435 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 436 437 # Debug Print : 438 IGCM_debug_Print 3 "Boundary files ${compname}" 439 440 card=${SUBMIT_DIR}/COMP/${compname}.card 441 442 IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List 443 ListFilesName=${compname}_BoundaryFiles_List 444 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 445 446 if [ X${FileName0} != X${NULL_STR} ] ; then 447 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 448 449 (( i=0 )) 450 until [ $i -ge $NbFiles ]; do 451 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 452 eval file_in=${file_in_} 453 (( i_ = i+1 )) 454 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 455 eval file_out=${file_out_} 456 457 IGCM_sys_Get ${file_in} ${file_out} 458 IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 459 460 (( i=i+2 )) 461 done 462 fi 463 464 # Get non deleted files 465 if [ ${Period} = 1 ]; then 466 467 IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel 468 ListFilesName=${compname}_BoundaryFiles_ListNonDel 469 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 470 471 if [ X${FileName0} != X${NULL_STR} ] ; then 472 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 473 474 (( i=0 )) 475 until [ $i -ge $NbFiles ]; do 476 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 477 eval file_in=${file_in_} 478 (( i_ = i+1 )) 479 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 480 eval file_out=${file_out_} 481 482 IGCM_sys_Get ${file_in} ${file_out} 483 484 if [ X${file_out} != X. ] ; then 485 ListFixBoundary=${ListFixBoundary}" "${file_out} 486 else 487 ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} ) 488 fi 489 490 (( i=i+2 )) 491 done 492 fi 493 fi 494 done 495 496 IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles" 484 485 IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel 486 ListFilesName=${compname}_BoundaryFiles_ListNonDel 487 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 488 489 if [ X${FileName0} != X${NULL_STR} ] ; then 490 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 491 492 (( i=0 )) 493 until [ $i -ge $NbFiles ]; do 494 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 495 eval file_in=${file_in_} 496 (( i_ = i+1 )) 497 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 498 eval file_out=${file_out_} 499 500 IGCM_sys_Get ${file_in} ${file_out} 501 502 if [ X${file_out} != X. ] ; then 503 ListFixBoundary=${ListFixBoundary}" "${file_out} 504 else 505 ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} ) 506 fi 507 508 (( i=i+2 )) 509 done 510 fi 511 fi 512 done 513 514 IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles" 497 515 } 498 516 … … 500 518 function IGCM_comp_DelFixeBoundaryFiles 501 519 { 502 503 504 505 506 507 508 509 510 511 512 520 IGCM_debug_PushStack "IGCM_comp_DelFixeBoundaryFiles" 521 522 # Debug Print : 523 echo 524 IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles" 525 echo 526 527 ls -l ${ListFixBoundary} 528 rm -f ${ListFixBoundary} 529 530 IGCM_debug_PopStack "IGCM_comp_DelFixeBoundaryFiles" 513 531 } 514 532 … … 516 534 function IGCM_comp_GetInputParametersFiles 517 535 { 518 IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles" 536 IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles" 537 538 # Debug Print : 539 echo 540 IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles" 541 echo 542 543 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out 544 for comp in ${config_ListOfComponents[*]} ; do 545 # Define component 546 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 547 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 519 548 520 549 # Debug Print : 521 echo 522 IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles" 523 echo 524 525 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out 526 for comp in ${config_ListOfComponents[*]} ; do 527 # Define component 528 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 529 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 530 531 # Debug Print : 532 IGCM_debug_Print 3 "Parameters ${compname}" 533 534 card=${SUBMIT_DIR}/COMP/${compname}.card 535 536 IGCM_card_DefineArrayFromOption ${card} ParametersFiles List 537 ListFilesName=${compname}_ParametersFiles_List 538 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 539 540 if [ X${FileName0} != X${NULL_STR} ] ; then 541 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 542 543 (( i=0 )) 544 until [ $i -ge $NbFiles ]; do 545 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 546 eval file_in=${file_in_} 547 (( i_ = i+1 )) 548 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 549 eval file_out=${file_out_} 550 551 IGCM_sys_Cp ${file_in} ${file_out} 552 IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 553 554 (( i=i+2 )) 555 done 556 fi 557 done 558 559 IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles" 550 IGCM_debug_Print 3 "Parameters ${compname}" 551 552 card=${SUBMIT_DIR}/COMP/${compname}.card 553 554 IGCM_card_DefineArrayFromOption ${card} ParametersFiles List 555 ListFilesName=${compname}_ParametersFiles_List 556 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 557 558 if [ X${FileName0} != X${NULL_STR} ] ; then 559 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 560 561 (( i=0 )) 562 until [ $i -ge $NbFiles ]; do 563 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 564 eval file_in=${file_in_} 565 (( i_ = i+1 )) 566 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 567 eval file_out=${file_out_} 568 569 IGCM_sys_Cp ${file_in} ${file_out} 570 IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 571 572 (( i=i+2 )) 573 done 574 fi 575 done 576 577 IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles" 560 578 } 561 579 … … 563 581 function IGCM_comp_GetInputRestartFiles 564 582 { 565 IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles" 583 IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles" 584 585 # Debug Print : 586 echo 587 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles" 588 echo 589 590 typeset Date_tmp Date_r Path_r do_start CompOldName Path_OUT Path_BUF Buffered 591 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 592 typeset file_in file_out file_in_ file_out_ file_in_Name 593 typeset -Z4 j4 594 595 for comp in ${config_ListOfComponents[*]} ; do 596 # Define component 597 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 598 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 599 # 600 card=${SUBMIT_DIR}/COMP/${compname}.card 601 # 602 IGCM_card_DefineArrayFromOption ${card} RestartFiles List 603 ListFilesName=${compname}_RestartFiles_List 604 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 566 605 567 606 # Debug Print : 568 echo 569 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles" 570 echo 571 572 typeset Date_tmp Date_r Path_r do_start CompOldName Path_temp 573 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 574 typeset file_in file_out file_in_ file_out_ file_in_Name 575 typeset -Z4 j4 576 577 for comp in ${config_ListOfComponents[*]} ; do 578 # Define component 579 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 580 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 581 # 582 card=${SUBMIT_DIR}/COMP/${compname}.card 583 # 584 IGCM_card_DefineArrayFromOption ${card} RestartFiles List 585 ListFilesName=${compname}_RestartFiles_List 586 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 587 588 # Debug Print : 589 IGCM_debug_Print 3 "restart ${compname}" 590 591 if ( ${FirstInitialize} ) ; then 592 593 if [ "${config_Restarts_OverRule}" = "y" ] ; then 594 eval config_${comp}_Restart="y" 595 eval config_${comp}_RestartDate=${config_Restarts_RestartDate} 596 eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName} 597 eval config_${comp}_RestartPath=${config_Restarts_RestartPath} 598 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 599 eval CompOldName=${comp} 607 IGCM_debug_Print 3 "restart ${compname}" 608 609 if ( ${FirstInitialize} ) ; then 610 611 if [ "${config_Restarts_OverRule}" = "y" ] ; then 612 eval config_${comp}_Restart="y" 613 eval config_${comp}_RestartDate=${config_Restarts_RestartDate} 614 eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName} 615 eval config_${comp}_RestartPath=${config_Restarts_RestartPath} 616 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 617 eval CompOldName=${comp} 618 else 619 # Read component Restarts parameters 620 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart 621 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 622 623 if [ "${do_start}" = "y" ] ; then 624 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate 625 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName 626 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath 627 else 628 eval config_${comp}_RestartDate=-1 629 eval config_${comp}_RestartJobName=${NULL_STR} 630 eval config_${comp}_RestartPath=${NULL_STR} 631 fi 632 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName 633 eval CompOldName=\${config_${comp}_OldName} 634 if [ X${CompOldName} = X ] ; then 635 eval CompOldName=${comp} 636 fi 637 fi 638 639 if [ "${do_start}" = "y" ] ; then 640 641 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 642 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 643 644 (( i=1 )) 645 until [ $i -gt $NbFiles ]; do 646 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 647 eval file_in=${file_in_} 648 649 (( i_ = i+1 )) 650 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 651 eval file_out=${file_out_} 652 653 eval Date_tmp=\${config_${comp}_RestartDate} 654 Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} ) 655 eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart 656 eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in} 657 658 generic_restart_file_name_in=$( basename ${file_in_Name} .nc ) 659 generic_restart_file_name_out=$( basename ${file_out} .nc ) 660 661 eval Path_OUT=\${Path_r}/${generic_restart_file_name_in} 662 nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc) 663 664 if [ ${nb_restart_file} -gt 1 ] ; then 665 j=0 666 until [ $j -ge $nb_restart_file ]; do 667 j4=${j} 668 eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 669 #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 670 #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1 671 (( j=j+1 )) 672 done 600 673 else 601 # Read component Restarts parameters 602 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart 603 eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1 604 605 if [ "${do_start}" = "y" ] ; then 606 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate 607 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName 608 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath 609 else 610 eval config_${comp}_RestartDate=-1 611 eval config_${comp}_RestartJobName=${NULL_STR} 612 eval config_${comp}_RestartPath=${NULL_STR} 613 fi 614 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName 615 eval CompOldName=\${config_${comp}_OldName} 616 if [ X${CompOldName} = X ] ; then 617 eval CompOldName=${comp} 618 fi 619 fi 620 621 if [ "${do_start}" = "y" ] ; then 622 623 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 624 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 625 626 (( i=1 )) 627 until [ $i -gt $NbFiles ]; do 628 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 629 eval file_in=${file_in_} 630 631 (( i_ = i+1 )) 632 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 633 eval file_out=${file_out_} 634 635 eval Date_tmp=\${config_${comp}_RestartDate} 636 Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} ) 637 eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart 638 eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in} 639 640 generic_restart_file_name_in=$( basename ${file_in_Name} .nc ) 641 generic_restart_file_name_out=$( basename ${file_out} .nc ) 642 643 eval Path_temp=\${Path_r}/${generic_restart_file_name_in} 644 nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc) 645 646 if [ ${nb_restart_file} -gt 1 ] ; then 647 j=0 648 until [ $j -ge $nb_restart_file ]; do 649 j4=${j} 650 eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 651 #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 652 #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1 653 (( j=j+1 )) 654 done 655 else 656 eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out} 657 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 658 fi 659 660 (( i=i+3 )) 661 done 662 else 663 if [ X${FileName0} != XNONE ] ; then 664 IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}." 665 else 666 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}." 667 fi 668 fi 669 fi 670 elif [ ${Period} -eq 1 ] ; then 671 # if not FirstInitialize and first loop of this job 672 673 # Restore Restarts files 674 #----------------------- 675 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 676 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 677 678 (( i=1 )) 679 until [ $i -gt $NbFiles ]; do 680 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 681 eval file_in=${file_in_} 682 (( i_ = i+1 )) 683 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 684 eval file_out=${file_out_} 685 686 file_in_Name=${run_Configuration_OldPrefix}_${file_in} 687 688 generic_restart_file_name_in=$( basename ${file_in_Name} .nc ) 689 generic_restart_file_name_out=$( basename ${file_out} .nc ) 690 691 eval Path_temp=\${R_OUT_${comp}_R}/${generic_restart_file_name_in} 692 nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc) 693 694 if [ ${nb_restart_file} -gt 1 ] ; then 695 j=0 696 until [ $j -ge $nb_restart_file ]; do 697 j4=${j} 698 eval IGCM_sys_Get \${R_OUT_${comp}_R}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 699 #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 700 #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1 701 702 (( j=j+1 )) 703 done 704 else 705 eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out} 706 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 707 fi 708 709 (( i=i+3 )) 710 done 674 eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out} 675 #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 676 fi 677 678 (( i=i+3 )) 679 done 680 else 681 if [ X${FileName0} != XNONE ] ; then 682 IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}." 683 else 684 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}." 685 fi 686 fi 687 fi 688 elif [ ${Period} -eq 1 ] ; then 689 # if not FirstInitialize and first loop of this job 690 691 # Restore Restarts files 692 #----------------------- 693 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 694 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 695 696 (( i=1 )) 697 until [ $i -gt $NbFiles ]; do 698 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 699 eval file_in=${file_in_} 700 (( i_ = i+1 )) 701 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 702 eval file_out=${file_out_} 703 704 file_in_Name=${run_Configuration_OldPrefix}_${file_in} 705 706 generic_restart_file_name_in=$( basename ${file_in_Name} .nc ) 707 generic_restart_file_name_out=$( basename ${file_out} .nc ) 708 709 eval Path_BUF=\${R_BUF_${comp}_R}/${generic_restart_file_name_in} 710 eval Path_OUT=\${R_OUT_${comp}_R}/${generic_restart_file_name_in} 711 712 if [ -f ${Path_BUF}*.nc ] ; then 713 Buffered=true 714 nb_restart_file=$(IGCM_sys_CountFileBuffer ${Path_BUF}_????.nc) 715 else 716 Buffered=false 717 nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc) 718 fi 719 720 if [ ${nb_restart_file} -gt 1 ] ; then 721 j=0 722 until [ $j -ge $nb_restart_file ]; do 723 j4=${j} 724 if [ ${Buffered} ] ; then 725 IGCM_sys_GetBuffer ${Path_BUF}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 726 else 727 IGCM_sys_Get ${Path_OUT}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc 728 fi 729 (( j=j+1 )) 730 done 731 else 732 if [ ${Buffered} ] ; then 733 eval IGCM_sys_GetBuffer \${R_BUF_${comp}_R}/${file_in_Name} ${file_out} 711 734 else 712 if [ X${FileName0} != XNONE ] ; then 713 IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}." 714 else 715 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}." 716 fi 717 fi 735 eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out} 736 fi 737 fi 738 739 (( i=i+3 )) 740 done 741 else 742 if [ X${FileName0} != XNONE ] ; then 743 IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}." 744 else 745 IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}." 718 746 fi 719 done 720 721 typeset NbFichs 722 NbFiles=$( ls * 2> /dev/null | wc -l ) 723 if [ ${NbFiles} -gt 0 ] ; then 724 IGCM_sys_Chmod u+rw * 725 fi 726 727 IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles" 747 fi 748 fi 749 done 750 751 NbFiles=$( ls * 2> /dev/null | wc -l ) 752 if [ ${NbFiles} -gt 0 ] ; then 753 IGCM_sys_Chmod u+rw * 754 fi 755 756 IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles" 728 757 } 729 758 … … 731 760 function IGCM_comp_PeriodStart 732 761 { 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 762 IGCM_debug_PushStack "IGCM_comp_PeriodStart" 763 764 # Debug Print : 765 echo 766 IGCM_debug_Print 1 "IGCM_comp_PeriodStart" 767 echo 768 769 typeset ExeNameIn ExeNameOut 770 typeset comp compname comptagname 771 for comp in ${config_ListOfComponents[*]} ; do 772 # Define component 773 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 774 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 775 776 # Copy executable for this component 777 eval ExeNameIn=\${config_Executable_${comp}[0]} 778 eval ExeNameOut=\${config_Executable_${comp}[1]} 779 780 # Debug Print 781 IGCM_debug_Print 3 "PeriodStart ${compname} Driver Function (if any)." 782 # UPDATE component 783 ${comp}_PeriodStart 2> /dev/null 784 785 done 786 787 IGCM_debug_PopStack "IGCM_comp_PeriodStart" 759 788 } 760 789 … … 762 791 function IGCM_comp_Update 763 792 { 764 793 IGCM_debug_PushStack "IGCM_comp_Update" 765 794 766 795 # Debug Print : 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 796 echo 797 IGCM_debug_Print 1 "IGCM_comp_Update" 798 echo 799 800 typeset ExeNameIn ExeNameOut 801 typeset comp compname comptagname 802 for comp in ${config_ListOfComponents[*]} ; do 803 # Define component 804 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 805 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 806 807 # Copy executable for this component 808 eval ExeNameIn=\${config_Executable_${comp}[0]} 809 eval ExeNameOut=\${config_Executable_${comp}[1]} 810 811 # If missing executable then stop! 812 #if [ ! X${ExeNameIn} = X ] && [ ! -f ${R_EXE}/${ExeNameIn} ] ; then 813 # IGCM_debug_Exit "IGCM_comp_Update missing executable ${ExeNameIn}" 814 #fi 815 816 if [ ${Period} -eq 1 ] && [ -f ${R_EXE}/${ExeNameIn} ] ; then 817 eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut} 818 if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then 819 eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut} 820 fi 821 elif [ -f ${R_EXE}/${ExeNameIn} ] && [ ! -f ${RUN_DIR}/${ExeNameOut} ] ; then 822 eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut} 823 if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then 824 eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut} 825 fi 826 fi 827 828 # Debug Print 829 IGCM_debug_Print 1 "Update ${compname} Parameter Files." 830 # UPDATE component 831 ${comp}_Update 832 833 done 834 835 IGCM_debug_PopStack "IGCM_comp_Update" 807 836 } 808 837 … … 810 839 function IGCM_comp_Finalize 811 840 { 812 IGCM_debug_PushStack "IGCM_comp_Finalize" 813 814 # Debug Print : 841 IGCM_debug_PushStack "IGCM_comp_Finalize" 842 843 # Debug Print : 844 echo 845 IGCM_debug_Print 1 "IGCM_comp_Finalize" 846 echo 847 848 typeset ListTextName TextName0 849 typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive 850 typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file 851 typeset -Z4 j4 852 typeset list_file nlist_file 853 typeset compactoutputs 854 855 compactoutputs=false 856 if [ X${JobType} != XRUN ] ; then 857 compactoutputs=true 858 elif [ X${config_UserChoices_CompactText} != Xn ] ; then 859 compactoutputs=true 860 fi 861 862 for comp in ${config_ListOfComponents[*]} ; do 863 # Define component 864 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 865 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 866 867 # Debug Print 868 IGCM_debug_Print 1 "Finalize ${comp} : ${compname} component." 869 # FINALIZE component 870 ${comp}_Finalize 871 872 card=${SUBMIT_DIR}/COMP/${compname}.card 873 874 # Save Restarts files 875 #-------------------- 876 IGCM_debug_Print 2 "Save Restart files for ${comp} : ${compname} component." 877 IGCM_card_DefineArrayFromOption ${card} RestartFiles List 878 ListFilesName=${compname}_RestartFiles_List 879 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 880 881 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 882 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 883 884 (( i=0 )) 885 until [ $i -ge $NbFiles ]; do 886 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 887 eval file_in=${file_in_} 888 889 (( i_ = i+1 )) 890 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 891 eval file_out=${file_out_} 892 893 (( i_ = i+2 )) 894 eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 895 eval file_outin=${file_outin_} 896 897 generic_restart_file_name_in=$( basename ${file_in} .nc ) 898 generic_restart_file_name_out=$( basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc ) 899 generic_restart_file_name_outin=$( basename ${file_outin} .nc ) 900 901 nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 902 if [ ${nb_restart_file} -gt 1 ] ; then 903 j=0 904 until [ $j -ge $nb_restart_file ]; do 905 j4=${j} 906 #eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc 907 eval IGCM_sys_PutBuffer_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_BUF_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc 908 if [ ! ${file_in} = ${file_outin} ] ; then 909 if ( ${ExitFlag} ) ; then 910 echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed." 911 else 912 IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc 913 fi 914 fi 915 (( j=j+1 )) 916 done 917 else 918 #eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} 919 eval IGCM_sys_PutBuffer_Rest ${file_in} \${R_BUF_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} 920 if [ ! ${file_in} = ${file_outin} ] ; then 921 if ( ${ExitFlag} ) ; then 922 echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed." 923 else 924 IGCM_sys_Mv ${file_in} ${file_outin} 925 fi 926 fi 927 fi 928 929 (( i=i+3 )) 930 done 931 else 932 if [ X${FileName0} != XNONE ] ; then 933 IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}." 934 else 935 IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}." 936 fi 937 fi 938 939 # Save Output files 940 #------------------ 941 IGCM_debug_Print 2 "Save Output files for ${comp} : ${compname} component." 942 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 943 ListFilesName=${compname}_OutputFiles_List 944 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 945 946 if [ X${FileName0} != X${NULL_STR} ] ; then 947 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 948 949 (( i=0 )) 950 until [ $i -ge $NbFiles ]; do 951 SaveOnArchive=true 952 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 953 eval file_in=${file_in_} 954 (( i_ = i+1 )) 955 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 956 eval file_out=${file_out_} 957 (( i_ = i+2 )) 958 eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1 959 # 960 generic_file_name=$( basename ${file_in} .nc ) 961 nb_rebuild_file=$( ls | grep "^${generic_file_name}_[0-9]*.nc" | wc -l ) 962 # 963 if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then 964 IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed" 965 IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in} 966 elif [ ${nb_rebuild_file} -gt 1 ] ; then 967 IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed" 968 if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then 969 IGCM_debug_Print 2 "Rebuilding ${file_in} online" 970 IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc 971 else 972 IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}" 973 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 974 IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin} 975 976 # Prepare headers for the shell dedicated to offline rebuild 977 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 978 if [ $DRYRUN -le 1 ]; then 979 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 980 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 981 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 982 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 983 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 984 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 985 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 986 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 987 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 988 fi 989 fi 990 # Prepare the shell dedicated to offline rebuild 991 if [ $DRYRUN -le 1 ]; then 992 echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 993 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 994 fi 995 # 996 # Load Patch we need to apply and apply 997 if [ $DRYRUN -le 1 ]; then 998 if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) != X${NULL_STR} ]; then 999 for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do 1000 echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1001 echo "IGCM_${Patch} ${file_in} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1002 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1003 done 1004 fi 1005 fi 1006 # 1007 if [ $DRYRUN -le 1 ]; then 1008 echo "IGCM_sys_Put_Out ${file_in} ${file_out} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1009 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1010 echo "IGCM_sys_Rm ${generic_file_name}_*.nc " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1011 fi 1012 SaveOnArchive=false 1013 fi 1014 fi 1015 # 1016 if [ ${SaveOnArchive} = true ] ; then 1017 # 1018 # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on 1019 # 1020 thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} ) 1021 1022 if ( [ ! X${thereisapatch} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 1023 if [ -f ${file_in} ] ; then 1024 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 1025 1026 IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin} 1027 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1 1028 # 1029 if [ $DRYRUN -le 1 ]; then 1030 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 1031 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1032 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1033 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1034 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1035 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1036 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1037 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1038 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1039 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1040 fi 1041 # 1042 for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do 1043 echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1044 echo "IGCM_${Patch} ${file_in} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1045 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1046 done 1047 # 1048 echo "IGCM_sys_Put_Out ${file_in} ${file_out} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1049 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1050 # 1051 fi 1052 fi 1053 else 1054 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 1055 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 1056 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1057 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1058 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1059 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1060 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1061 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1062 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1063 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1064 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1065 fi 1066 1067 IGCM_sys_Put_Out ${file_in} ${file_out} 1068 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 1069 if [ ${nb_rebuild_file} -gt 1 ] ; then 1070 for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do 1071 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1 1072 done 1073 fi 1074 fi 1075 fi 1076 (( i=i+3 )) 1077 done 1078 fi 1079 1080 # Save Output Text files of models 1081 #--------------------------------- 1082 IGCM_debug_Print 2 "Save Output Text files for ${comp} : ${compname} component." 1083 IGCM_card_DefineArrayFromOption ${card} OutputText List 1084 ListTextName=${compname}_OutputText_List 1085 1086 eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1 1087 if [ X${TextName0} != X${NULL_STR} ] ; then 1088 eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1 1089 1090 (( i=0 )) 1091 until [ $i -eq $NbFiles ]; do 1092 eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1 1093 eval file_out=${PREFIX}_${file_in} 1094 1095 (( i=i+1 )) 1096 1097 unset list_file 1098 #set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null ) 1099 # result for a a1 a10 a2 with file_in=a a a1 a2 a10 1100 set +A list_file -- $( [ -f ${file_in} ] && ls ${file_in} ; for i in $(ls ${file_in}* 2>/dev/null | sed "s/${file_in}//" | sort -n) ; do ls ${file_in}$i ; done ) 1101 nlist_file=${#list_file[@]} 1102 if [ ${nlist_file} -gt 1 ] ; then 1103 if ( ${compactoutputs} ) ; then 1104 IGCM_debug_Print 2 "Parallelism of Text Output with ${nlist_file} files." 1105 IGCM_debug_Print 2 "Compact files in ${file_out} : " ${list_file[*]} 1106 echo ${list_file[*]} > ${file_out} 1107 echo " 1108 " >> ${file_out} 1109 1110 (( i_ = 0 )) 1111 for file in ${list_file[@]} 1112 do 1113 echo "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " >> ${file_out} 1114 echo "| " ${i_} " " ${file} >> ${file_out} 1115 echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " >> ${file_out} 1116 cat ${file} | sed "s/\(.*\)/${i_}\1/" ${file} >> ${file_out} 1117 echo " 1118 " >> ${file_out} 1119 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1 1120 (( i_ = i_ + 1 )) 1121 done 1122 #eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}_D}/${file_out} 1123 eval IGCM_sys_PutBuffer_Out ${file_out} \${R_BUF_${comp}_D}/${file_out} 1124 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1 1125 1126 if ( ${ExecutionFail} ) ; then 1127 IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}/Debug 1128 fi 1129 else 1130 for file in ${list_file[@]} 1131 do 1132 #eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file} 1133 eval IGCM_sys_PutBuffer_Out ${file} \${R_BUF_${comp}_D}/${PREFIX}_${file} 1134 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1 1135 1136 if ( ${ExecutionFail} ) ; then 1137 IGCM_sys_Cp ${file} ${SUBMIT_DIR}/Debug/${PREFIX}_${file} 1138 fi 1139 done 1140 fi 1141 else 1142 if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then 1143 eval IGCM_sys_Mv ${file_in}* ${file_in} 1144 fi 1145 #eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${file_out} 1146 eval IGCM_sys_PutBuffer_Out ${file_in} \${R_BUF_${comp}_D}/${file_out} 1147 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 1148 1149 if ( ${ExecutionFail} ) ; then 1150 IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/Debug/${file_out} 1151 fi 1152 fi 1153 done 1154 fi 815 1155 echo 816 IGCM_debug_Print 1 "IGCM_comp_Finalize" 817 echo 818 819 typeset ListTextName TextName0 820 typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive 821 typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file 822 typeset -Z4 j4 823 typeset list_file nlist_file 824 typeset compactoutputs 825 826 compactoutputs=false 827 if [ X${JobType} != XRUN ] ; then 828 compactoutputs=true 829 elif [ X${config_UserChoices_CompactText} != Xn ] ; then 830 compactoutputs=true 831 fi 832 833 for comp in ${config_ListOfComponents[*]} ; do 834 # Define component 835 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 836 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 837 838 # Debug Print 839 IGCM_debug_Print 1 "Finalize ${compname} component." 840 # FINALIZE component 841 ${comp}_Finalize 842 843 card=${SUBMIT_DIR}/COMP/${compname}.card 844 845 # Save Restarts files 846 #-------------------- 847 IGCM_card_DefineArrayFromOption ${card} RestartFiles List 848 ListFilesName=${compname}_RestartFiles_List 849 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 850 851 if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then 852 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 853 854 (( i=0 )) 855 until [ $i -ge $NbFiles ]; do 856 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 857 eval file_in=${file_in_} 858 859 (( i_ = i+1 )) 860 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 861 eval file_out=${file_out_} 862 863 (( i_ = i+2 )) 864 eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 865 eval file_outin=${file_outin_} 866 867 generic_restart_file_name_in=$( basename ${file_in} .nc ) 868 generic_restart_file_name_out=$( basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc ) 869 generic_restart_file_name_outin=$( basename ${file_outin} .nc ) 870 871 nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 872 if [ ${nb_restart_file} -gt 1 ] ; then 873 j=0 874 until [ $j -ge $nb_restart_file ]; do 875 j4=${j} 876 eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc 877 if [ ! ${file_in} = ${file_outin} ] ; then 878 if ( ${ExitFlag} ) ; then 879 echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed." 880 else 881 IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc 882 fi 883 fi 884 #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_in}_${j4}.nc" > /dev/null 2>&1 885 (( j=j+1 )) 886 done 887 else 888 eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} 889 if [ ! ${file_in} = ${file_outin} ] ; then 890 if ( ${ExitFlag} ) ; then 891 echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed." 892 else 893 IGCM_sys_Mv ${file_in} ${file_outin} 894 fi 895 fi 896 #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 897 fi 898 899 (( i=i+3 )) 900 done 901 else 902 if [ X${FileName0} != XNONE ] ; then 903 IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}." 904 else 905 IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}." 906 fi 907 fi 908 909 # Save Output files 910 #------------------ 911 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 912 ListFilesName=${compname}_OutputFiles_List 913 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 914 915 if [ X${FileName0} != X${NULL_STR} ] ; then 916 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 917 918 (( i=0 )) 919 until [ $i -ge $NbFiles ]; do 920 SaveOnArchive=true 921 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 922 eval file_in=${file_in_} 923 (( i_ = i+1 )) 924 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 925 eval file_out=${file_out_} 926 (( i_ = i+2 )) 927 eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1 928 # 929 generic_file_name=$( basename ${file_in} .nc ) 930 nb_rebuild_file=$( ls | grep "^${generic_file_name}_[0-9]*.nc" | wc -l ) 931 # 932 if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then 933 IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed" 934 IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in} 935 elif [ ${nb_rebuild_file} -gt 1 ] ; then 936 IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed" 937 if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then 938 IGCM_debug_Print 2 "Rebuilding ${file_in} online" 939 IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc 940 else 941 IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}" 942 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 943 IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin} 944 945 # Prepare headers for the shell dedicated to offline rebuild 946 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 947 if [ $DRYRUN -le 1 ]; then 948 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 949 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 950 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 951 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 952 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 953 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 954 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 955 echo "export R_SAVE=${R_SAVE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 956 echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 957 fi 958 fi 959 # Prepare the shell dedicated to offline rebuild 960 if [ $DRYRUN -le 1 ]; then 961 echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 962 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 963 fi 964 # 965 # Load Patch we need to apply and apply 966 if [ $DRYRUN -le 1 ]; then 967 if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) != X${NULL_STR} ]; then 968 for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do 969 echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 970 echo "IGCM_${Patch} ${file_in} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 971 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 972 done 973 fi 974 fi 975 # 976 if [ $DRYRUN -le 1 ]; then 977 echo "IGCM_sys_Put_Out ${file_in} ${file_out} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 978 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 979 echo "IGCM_sys_Rm ${generic_file_name}_*.nc " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 980 fi 981 SaveOnArchive=false 982 fi 983 fi 984 # 985 if [ ${SaveOnArchive} = true ] ; then 986 # 987 # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on 988 # 989 thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} ) 990 991 if ( [ ! X${thereisapatch} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 992 if [ -f ${file_in} ] ; then 993 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 994 995 IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin} 996 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1 997 # 998 if [ $DRYRUN -le 1 ]; then 999 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 1000 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1001 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1002 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1003 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1004 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1005 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1006 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1007 fi 1008 # 1009 for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do 1010 echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1011 echo "IGCM_${Patch} ${file_in} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1012 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1013 done 1014 # 1015 echo "IGCM_sys_Put_Out ${file_in} ${file_out} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1016 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1017 # 1018 fi 1019 fi 1020 else 1021 [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 1022 if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 1023 echo "#!/bin/ksh " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1024 echo "function IGCM_FlushRebuild " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1025 echo "{ " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1026 echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1027 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1028 echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1029 echo "echo " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 1030 fi 1031 1032 IGCM_sys_Put_Out ${file_in} ${file_out} 1033 [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 1034 if [ ${nb_rebuild_file} -gt 1 ] ; then 1035 for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do 1036 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1 1037 done 1038 fi 1039 fi 1040 fi 1041 (( i=i+3 )) 1042 done 1043 fi 1044 1045 # Save Output Text files of models 1046 #--------------------------------- 1047 1048 IGCM_card_DefineArrayFromOption ${card} OutputText List 1049 ListTextName=${compname}_OutputText_List 1050 1051 eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1 1052 if [ X${TextName0} != X${NULL_STR} ] ; then 1053 eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1 1054 1055 (( i=0 )) 1056 until [ $i -eq $NbFiles ]; do 1057 eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1 1058 (( i=i+1 )) 1059 1060 unset list_file 1061 #set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null ) 1062 # result for a a1 a10 a2 with file_in=a a a1 a2 a10 1063 set +A list_file -- $( [ -f ${file_in} ] && ls ${file_in} ; for i in $(ls ${file_in}* 2>/dev/null | sed "s/${file_in}//" | sort -n) ; do ls ${file_in}$i ; done ) 1064 nlist_file=${#list_file[@]} 1065 if [ ${nlist_file} -gt 1 ] ; then 1066 if ( ${compactoutputs} ) ; then 1067 eval file_out=${PREFIX}_${file_in} 1068 1069 IGCM_debug_Print 2 "Parallelism of Text Output with ${nlist_file} files." 1070 IGCM_debug_Print 2 "Compact files in ${file_out} : " ${list_file[*]} 1071 echo ${list_file[*]} > ${file_out} 1072 echo " 1073 " >> ${file_out} 1074 1075 (( i_ = 0 )) 1076 for file in ${list_file[@]} 1077 do 1078 echo "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " >> ${file_out} 1079 echo "| " ${i_} " " ${file} >> ${file_out} 1080 echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " >> ${file_out} 1081 cat ${file} | sed "s/\(.*\)/${i_}\1/" ${file} >> ${file_out} 1082 echo " 1083 " >> ${file_out} 1084 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1 1085 (( i_ = i_ + 1 )) 1086 done 1087 eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}_D}/${file_out} 1088 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1 1089 1090 if ( ${ExecutionFail} ) ; then 1091 IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}/Debug 1092 fi 1093 else 1094 for file in ${list_file[@]} 1095 do 1096 eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file} 1097 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1 1098 done 1099 if ( ${ExecutionFail} ) ; then 1100 IGCM_sys_Cp ${file} ${SUBMIT_DIR}/Debug/${PREFIX}_${file} 1101 fi 1102 fi 1103 else 1104 if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then 1105 eval IGCM_sys_Mv ${file_in}* ${file_in} 1106 fi 1107 eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${PREFIX}_${file_in} 1108 [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 1109 1110 if ( ${ExecutionFail} ) ; then 1111 IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/Debug/${PREFIX}_${file_in} 1112 fi 1113 fi 1114 done 1115 fi 1116 done 1117 1118 IGCM_debug_PopStack "IGCM_comp_Finalize" 1156 done 1157 IGCM_debug_PopStack "IGCM_comp_Finalize" 1119 1158 } -
trunk/libIGCM/libIGCM_config/libIGCM_config.ksh
r541 r544 15 15 function IGCM_config_Initialize 16 16 { 17 IGCM_debug_PushStack "IGCM_config_Initialize" 18 19 # Debug Print : 17 IGCM_debug_PushStack "IGCM_config_Initialize" 18 19 # Debug Print : 20 echo 21 IGCM_debug_Print 1 "IGCM_config_Initialize" 22 23 if [ ! -r ${SUBMIT_DIR}/run.card ]; then 24 #================================================# 25 # The file run.card doesn't exist # 26 #================================================# 27 FirstInitialize=true 28 #copy initial run.card 29 IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card 30 IGCM_debug_Print 2 "run.card copied from run.card.init" 31 else 32 FirstInitialize=false 33 IGCM_debug_Print 2 "run.card exists" 34 fi 35 36 # Test modipsl tree existence. 37 IGCM_sys_TestDir ${MODIPSL} 38 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 39 IGCM_sys_TestDir ${libIGCM} 40 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 41 IGCM_sys_TestDir ${R_EXE} 42 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 43 IGCM_sys_TestDir ${SUBMIT_DIR} 44 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 45 46 if ( $DEBUG_debug ) ; then 47 echo "Keep trace of inital SUBMIT_DIR : " 48 ls -lta ${SUBMIT_DIR} 49 fi 50 51 #================================== 52 53 typeset option auxprint CompatibilityTag 54 # Read libIGCM compatibility version in config.card 55 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM 56 eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1 57 58 if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then 59 IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." 60 fi 61 62 #================================== 63 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices 64 65 for option in ${config_UserChoices[*]} ; do 66 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} 67 done 68 echo 69 IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" 70 # Name Space of this experience 71 if [ X${config_UserChoices_SpaceName} != X ] ; then 72 IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName 73 fi 74 # Expericence class of the run 75 if [ X${config_UserChoices_ExperimentName} != X ] ; then 76 IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName 77 fi 78 IGCM_debug_PrintVariables 3 config_UserChoices_JobName 79 if [ 3 -le ${Verbosity} ] ; then 80 echo "--------------Debug3-->" "config_UserChoices_LongName=" 81 echo "--------------Debug3-->" \"${config_UserChoices_LongName}\" 82 fi 83 IGCM_debug_PrintVariables 3 config_UserChoices_TagName 84 IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType 85 IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin 86 IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd 87 IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength 88 89 #================================== 90 91 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents 92 for comp in ${config_ListOfComponents[*]} ; do 93 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} 94 done 95 96 echo 97 IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" 98 IGCM_debug_Print 3 ${config_ListOfComponents[*]} 99 100 NbComponents=${#config_ListOfComponents[*]} 101 102 #================================== 103 # Define principal executable 104 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable 105 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name 106 107 #================================== 108 # Define Outputs Name 109 IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" 110 eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} 111 IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" 112 eval Exe_Output=out_${config_Executable_Name} 113 IGCM_debug_Print 3 "Exe_Output = ${Exe_Output}" 114 115 #================================== 116 117 #===================================================================# 118 # Prepare variables available for ${COMP}.card and ${COMP}.driver # 119 # But available to any son functions # 120 #===================================================================# 121 122 # Convert yyyy-mm-dd date to gregorian yyyymmdd 123 DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) 124 DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 125 126 # Period Length In Days between DateBegin and DateEnd 127 (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) 128 if [ ${ExperienceLengthInDays} -lt 0 ] ; then 129 IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." 130 IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." 131 IGCM_debug_Verif_Exit 132 fi 133 134 # Day and Year of Initial State (Given in julian format) 135 InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )) 136 InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )) 137 138 #================================== 139 # Restarts : Gerneral rule or local for each component ? 140 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts 141 142 echo 143 IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts" 144 145 for option in ${config_Restarts[*]} ; do 146 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option} 147 eval auxprint=\${config_Restarts_${option}} 148 IGCM_debug_Print 3 "${option} : ${auxprint}" 149 done 150 151 #================================================================# 152 # Test and Prepare directories # 153 #================================================================# 154 155 # ==> 4 kinds of input files : 156 # 1) R_INIT : Initial State Files (Etat0, carteveg) 157 # 2) R_BC : Boundary Conditions (Forcages, lai) 158 # 3) Parameters files (allready define through ${SUBMIT_DIR}) 159 # 4) Restarts files (allready define in IGCM_config_Initialize) 160 161 # Here we offer the possibility to redefine R_INIT, R_BC 162 # and PeriodNb through config.card 163 R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} 164 IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb" 165 IGCM_debug_Print 3 "R_INIT=${R_INIT}" 166 R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} 167 IGCM_debug_Print 3 "R_BC=${R_BC}" 168 PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}} 169 IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" 170 171 # Test Archive input/output. 172 IGCM_sys_TestDirArchive ${ARCHIVE} 173 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 174 IGCM_sys_TestDirArchive ${R_IN} 175 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 176 177 #==================================================== 178 #R_SAVE : Job output directory 179 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then 180 FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) 181 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 182 R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 183 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 184 else 185 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 186 R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 187 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} 188 fi 189 190 if ( ${FirstInitialize} ) ; then 191 IGCM_sys_MkdirArchive ${R_SAVE} 192 IGCM_sys_Mkdir ${R_BUFR} 193 else 194 IGCM_sys_TestDirArchive ${R_SAVE} 195 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive ${R_SAVE}" 196 197 IGCM_sys_TestDir ${R_BUFR} 198 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}" 199 #Test state of run in run.card 200 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 201 202 if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 203 echo 204 IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 205 IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 206 IGCM_debug_Exit 207 IGCM_debug_Verif_Exit 208 fi 209 fi 210 211 #================================== 212 # Post : 213 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post 214 215 echo 216 IGCM_debug_Print 1 "DefineArrayFromOption : config_Post" 217 218 for option in ${config_Post[*]} ; do 219 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option} 220 eval auxprint=\${config_Post_${option}} 221 IGCM_debug_Print 3 "${option} : ${auxprint}" 222 done 223 224 #==================================================== 225 # Define REBUILD_DIR : where we store files needing rebuild process 226 if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 227 REBUILD_DIR=${R_SAVE}/TMP 228 IGCM_sys_MkdirArchive ${REBUILD_DIR} 229 else 230 REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 231 IGCM_sys_MkdirWork ${REBUILD_DIR} 232 fi 233 234 #==================================================== 235 # Experience type : DEB(ug), DEV(elopment), RUN 236 if [ X${JobType} != XRUN ] ; then 20 237 echo 21 IGCM_debug_Print 1 "IGCM_config_Initialize" 22 23 if [ ! -r ${SUBMIT_DIR}/run.card ]; then 24 #================================================# 25 # The file run.card doesn't exist # 26 #================================================# 27 FirstInitialize=true 28 #copy initial run.card 29 IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card 30 IGCM_debug_Print 2 "run.card copied from run.card.init" 31 else 32 FirstInitialize=false 33 IGCM_debug_Print 2 "run.card exists" 238 echo "====================================================" 239 echo "libIGCM JOB is NOT in RUN type mode." 240 echo "!! OUTPUT files will NOT be PROTECTED !!" 241 echo "Be carefull : you can ERASE the result of this job !" 242 243 case ${JobType} in 244 DEB) 245 echo "DEBUG mode : activation of 'set -vx' mode." 246 echo "DEBUG mode : no protection for output files." 247 echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency." 248 ;; 249 DEV) 250 echo "DEVelopment mode : no protection for output files." 251 echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency." 252 ;; 253 esac 254 255 if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then 256 if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then 257 echo "------------" 258 echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" 259 echo " to PeriodLength : ${config_UserChoices_PeriodLength}" 260 echo "------------" 261 config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} 262 fi 34 263 fi 35 36 # Test modipsl tree existence. 37 IGCM_sys_TestDir ${MODIPSL} 38 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 39 IGCM_sys_TestDir ${libIGCM} 40 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 41 IGCM_sys_TestDir ${R_EXE} 42 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 43 IGCM_sys_TestDir ${SUBMIT_DIR} 44 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" 45 46 if ( $DEBUG_debug ) ; then 47 echo "Keep trace of inital SUBMIT_DIR : " 48 ls -lta ${SUBMIT_DIR} 49 fi 50 51 #================================== 52 53 typeset option auxprint CompatibilityTag 54 # Read libIGCM compatibility version in config.card 55 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM 56 eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1 57 58 if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then 59 IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." 60 fi 61 62 #================================== 63 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices 64 65 for option in ${config_UserChoices[*]} ; do 66 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} 67 done 264 echo "====================================================" 68 265 echo 69 IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" 70 # Name Space of this experience 71 if [ X${config_UserChoices_SpaceName} != X ] ; then 72 IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName 73 fi 74 # Expericence class of the run 75 if [ X${config_UserChoices_ExperimentName} != X ] ; then 76 IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName 77 fi 78 IGCM_debug_PrintVariables 3 config_UserChoices_JobName 79 if [ 3 -le ${Verbosity} ] ; then 80 echo "--------------Debug3-->" "config_UserChoices_LongName=" 81 echo "--------------Debug3-->" \"${config_UserChoices_LongName}\" 82 fi 83 IGCM_debug_PrintVariables 3 config_UserChoices_TagName 84 IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType 85 IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin 86 IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd 87 IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength 88 89 #================================== 90 91 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents 92 for comp in ${config_ListOfComponents[*]} ; do 93 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} 94 done 95 96 echo 97 IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" 98 IGCM_debug_Print 3 ${config_ListOfComponents[*]} 99 100 NbComponents=${#config_ListOfComponents[*]} 101 102 #================================== 103 # Define principal executable 104 105 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable 106 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name 107 108 #================================== 109 # Define Outputs Name 110 IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" 111 eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} 112 IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" 113 eval Exe_Output=out_${config_Executable_Name} 114 IGCM_debug_Print 3 "Exe_Output = ${Exe_Output}" 115 116 #================================== 117 118 #===================================================================# 119 # Prepare variables available for ${COMP}.card and ${COMP}.driver # 120 # But available to any son functions # 121 #===================================================================# 122 123 # Convert yyyy-mm-dd date to gregorian yyyymmdd 124 DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) 125 DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 126 127 # Period Length In Days between DateBegin and DateEnd 128 (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) 129 if [ ${ExperienceLengthInDays} -lt 0 ] ; then 130 IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." 131 IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." 132 IGCM_debug_Verif_Exit 133 fi 134 135 # Day and Year of Initial State (Given in julian format) 136 InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )) 137 InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )) 138 139 #================================== 140 # Restarts : Gerneral rule or local for each component ? 141 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts 142 143 echo 144 IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts" 145 146 for option in ${config_Restarts[*]} ; do 147 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option} 148 eval auxprint=\${config_Restarts_${option}} 149 IGCM_debug_Print 3 "${option} : ${auxprint}" 150 done 151 152 #================================================================# 153 # Test and Prepare directories # 154 #================================================================# 155 156 # ==> 4 kinds of input files : 157 # 1) R_INIT : Initial State Files (Etat0, carteveg) 158 # 2) R_BC : Boundary Conditions (Forcages, lai) 159 # 3) Parameters files (allready define through ${SUBMIT_DIR}) 160 # 4) Restarts files (allready define in IGCM_config_Initialize) 161 162 # Here we offer the possibility to redefine R_INIT, R_BC 163 # and PeriodNb through config.card 164 R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} 165 IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb" 166 IGCM_debug_Print 3 "R_INIT=${R_INIT}" 167 R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} 168 IGCM_debug_Print 3 "R_BC=${R_BC}" 169 PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}} 170 IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" 171 172 # Test Archive input/output. 173 IGCM_sys_TestDirArchive ${ARCHIVE} 174 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 175 IGCM_sys_TestDirArchive ${R_IN} 176 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 177 178 #==================================================== 179 #R_SAVE : Job output directory 180 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then 181 FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) 182 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 183 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 184 else 185 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 186 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} 187 fi 188 189 if ( ${FirstInitialize} ) ; then 190 IGCM_sys_MkdirArchive ${R_SAVE} 191 else 192 IGCM_sys_TestDirArchive ${R_SAVE} 193 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 194 #Test state of run in run.card 195 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 196 197 if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 198 echo 199 IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 200 IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 201 IGCM_debug_Exit 202 IGCM_debug_Verif_Exit 203 fi 204 fi 205 206 #================================== 207 # Post : 208 IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post 209 210 echo 211 IGCM_debug_Print 1 "DefineArrayFromOption : config_Post" 212 213 for option in ${config_Post[*]} ; do 214 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option} 215 eval auxprint=\${config_Post_${option}} 216 IGCM_debug_Print 3 "${option} : ${auxprint}" 217 done 218 219 #==================================================== 220 # Define REBUILD_DIR : where we store files needing rebuild process 221 if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 222 REBUILD_DIR=${R_SAVE}/TMP 223 IGCM_sys_MkdirArchive ${REBUILD_DIR} 224 else 225 REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 226 IGCM_sys_MkdirWork ${REBUILD_DIR} 227 fi 228 229 #==================================================== 230 # Experience type : DEB(ug), DEV(elopment), RUN 231 if [ X${JobType} != XRUN ] ; then 232 echo 233 echo "====================================================" 234 echo "libIGCM JOB is NOT in RUN type mode." 235 echo "!! OUTPUT files will NOT be PROTECTED !!" 236 echo "Be carefull : you can ERASE the result of this job !" 237 238 case ${JobType} in 239 DEB) 240 echo "DEBUG mode : activation of 'set -vx' mode." 241 echo "DEBUG mode : no protection for output files." 242 echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency." 243 ;; 244 DEV) 245 echo "DEVelopment mode : no protection for output files." 246 echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency." 247 ;; 248 esac 249 250 if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then 251 if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then 252 echo "------------" 253 echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" 254 echo " to PeriodLength : ${config_UserChoices_PeriodLength}" 255 echo "------------" 256 config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} 257 fi 258 fi 259 echo "====================================================" 260 echo 261 fi 262 263 #==================================================== 264 #R_OUT_KSH : Storage place for job output 265 #R_OUT_EXE : Storage place for binary used during simulation 266 R_OUT_KSH=${R_SAVE}/Out 267 R_OUT_EXE=${R_SAVE}/Exe 268 269 IGCM_debug_PopStack "IGCM_config_Initialize" 266 fi 267 268 #==================================================== 269 #R_OUT_KSH : Storage place for job output 270 #R_OUT_EXE : Storage place for binary used during simulation 271 R_OUT_KSH=${R_SAVE}/Out 272 R_OUT_EXE=${R_SAVE}/Exe 273 274 #==================================================== 275 #R_BUF_KSH : Buffer place for job output 276 #R_BUF_EXE : Buffer place for binary used during simulation 277 R_BUF_KSH=${R_BUFR}/Out 278 R_BUF_EXE=${R_BUFR}/Exe 279 280 IGCM_debug_PopStack "IGCM_config_Initialize" 270 281 } 271 282 … … 273 284 function IGCM_config_Analyse_PeriodLength 274 285 { 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 286 IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength" 287 288 typeset i 289 290 # Determine number of day(s) in PeriodLength : 291 case ${config_UserChoices_PeriodLength} in 292 *Y|*y) 293 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) 294 IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}" 295 PeriodLengthInDays=0 296 i=0 297 until [ $i -ge $PeriodLengthInYears ] ; do 298 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 299 (( i=i+1 )) 300 done 301 ;; 302 *M|*m) 303 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) 304 IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 305 PeriodLengthInDays=0 306 i=0 307 until [ $i -ge $PeriodLengthInMonths ] ; do 308 if [ $(( month + i )) -lt 13 ] ; then 309 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 310 else 311 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 312 fi 313 (( i=i+1 )) 314 done 315 ;; 316 *D|*d) 317 PeriodLengthInMonths=0 318 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );; 319 *) 320 IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 321 IGCM_debug_Verif_Exit ;; 322 esac 323 324 IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" 314 325 } 315 326 … … 317 328 function IGCM_config_Check 318 329 { 319 IGCM_debug_PushStack "IGCM_config_Check" 320 321 # If one of the following modulo is not zero : 322 # we will issue an error then explain and exit in 323 # AA_job IGCM_debug_Verif_Exit call before binary submission 324 330 IGCM_debug_PushStack "IGCM_config_Check" 331 332 # If one of the following modulo is not zero : 333 # we will issue an error then explain and exit in 334 # AA_job IGCM_debug_Verif_Exit call before binary submission 335 336 echo 337 IGCM_debug_Print 1 "IGCM_config_Check" 338 echo 339 340 typeset i 341 342 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 343 AsynchronousRebuild=true 344 IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 325 345 echo 326 IGCM_debug_Print 1 "IGCM_config_Check" 346 # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero 347 IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength" 348 IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 349 IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency" 350 IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency 351 IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency" 352 IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency 353 else 354 AsynchronousRebuild=false 355 IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 356 IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 327 357 echo 328 329 typeset i 330 331 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 332 AsynchronousRebuild=true 333 IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 334 echo 335 # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero 336 IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength" 337 IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 338 IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency" 339 IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency 340 IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency" 341 IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency 342 else 343 AsynchronousRebuild=false 344 IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 345 IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 346 echo 347 #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 348 IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength" 349 IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength 350 IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength" 351 IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength 352 fi 353 354 #modulo (TimeSeriesFrequency and all Chunck2D) must be zero 355 NbJob=${#CHUNCK2D_SIZE[@]} 356 i=0 357 until [ $i -ge $NbJob ]; do 358 value=${CHUNCK2D_SIZE[${i}]} 359 IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency" 360 IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 361 case ${value} in 362 *Y|*y) ;; 363 *) IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 364 IGCM_debug_Exit "This will stop the job" ;; 365 esac 366 (( i=i+1 )) 367 done 368 369 #modulo (TimeSeriesFrequency and all Chunck3D) must be zero 370 NbJob=${#CHUNCK3D_SIZE[@]} 371 i=0 372 until [ $i -ge $NbJob ]; do 373 value=${CHUNCK3D_SIZE[${i}]} 374 IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency" 375 IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 376 case ${value} in 377 *Y|*y) ;; 378 *) IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 379 IGCM_debug_Exit "This will stop the job" ;; 380 esac 381 (( i=i+1 )) 382 done 383 384 IGCM_debug_PopStack "IGCM_config_Check" 358 #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 359 IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength" 360 IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength 361 IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength" 362 IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength 363 fi 364 365 #modulo (TimeSeriesFrequency and all Chunck2D) must be zero 366 NbJob=${#CHUNCK2D_SIZE[@]} 367 i=0 368 until [ $i -ge $NbJob ]; do 369 value=${CHUNCK2D_SIZE[${i}]} 370 IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency" 371 IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 372 case ${value} in 373 *Y|*y) ;; 374 *) IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 375 IGCM_debug_Exit "This will stop the job" ;; 376 esac 377 (( i=i+1 )) 378 done 379 380 #modulo (TimeSeriesFrequency and all Chunck3D) must be zero 381 NbJob=${#CHUNCK3D_SIZE[@]} 382 i=0 383 until [ $i -ge $NbJob ]; do 384 value=${CHUNCK3D_SIZE[${i}]} 385 IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency" 386 IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 387 case ${value} in 388 *Y|*y) ;; 389 *) IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 390 IGCM_debug_Exit "This will stop the job" ;; 391 esac 392 (( i=i+1 )) 393 done 394 395 IGCM_debug_PopStack "IGCM_config_Check" 385 396 } 386 397 … … 388 399 function IGCM_config_PeriodStart 389 400 { 390 IGCM_debug_PushStack "IGCM_config_PeriodStart" 391 392 echo 393 IGCM_debug_Print 1 "IGCM_config_PeriodStart" 394 echo 395 396 if ( ${FirstInitialize} ) ; then 397 #================================================# 398 # Initialize date/period information # 399 #================================================# 400 401 IGCM_date_GetYearMonthDay $DateBegin year month day 402 IGCM_config_Analyse_PeriodLength 403 404 eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1 405 PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) ) 406 eval CumulPeriod=1 > /dev/null 2>&1 407 408 #=================================================# 409 # Write updated run.card # 410 #=================================================# 411 412 #Correct run.card Configuration for this period 413 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} 414 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} 415 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} 416 if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then 417 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR} 418 fi 419 420 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 421 401 IGCM_debug_PushStack "IGCM_config_PeriodStart" 402 403 echo 404 IGCM_debug_Print 1 "IGCM_config_PeriodStart" 405 echo 406 407 if ( ${FirstInitialize} ) ; then 408 #================================================# 409 # Initialize date/period information # 410 #================================================# 411 412 IGCM_date_GetYearMonthDay $DateBegin year month day 413 IGCM_config_Analyse_PeriodLength 414 415 eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1 416 PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) ) 417 eval CumulPeriod=1 > /dev/null 2>&1 418 419 #=================================================# 420 # Write updated run.card # 421 #=================================================# 422 423 #Correct run.card Configuration for this period 424 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} 425 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} 426 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} 427 if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then 428 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR} 429 fi 430 431 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 432 433 else 434 #================================================# 435 # The file run.card allready exist # 436 #================================================# 437 438 #Test state of run in run.card 439 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 440 if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 441 echo 442 IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 443 IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 444 echo 445 IGCM_debug_Exit 446 IGCM_debug_Verif_Exit 447 fi 448 449 #===================================# 450 # Read updated run.card # 451 #===================================# 452 453 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix 454 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin 455 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd 456 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod 457 458 PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) 459 PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) 460 eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1 461 462 LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" ) 463 464 typeset LastDate 465 set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" ) 466 LastYearDateEnd=${LastDate[0]} 467 LastMonthDateEnd=${LastDate[1]} 468 LastDayDateEnd=${LastDate[2]} 469 470 if [ ${Period} = 1 ]; then 471 # save last Job output 472 typeset LastPeriod iLastPeriod Last_Script_Output_Name 473 (( LastPeriod=CumulPeriod-PeriodNb )) 474 iLastPeriod=$( printf "%06d" ${LastPeriod} ) 475 Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}" 476 Last_run_card="run.card.${iLastPeriod}" 477 #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name} 478 #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1 479 IGCM_debug_Print 2 "Try to save previous ksh job output" 480 IGCM_sys_Cd ${SUBMIT_DIR}/ 481 IGCM_sys_PutBuffer_Out ${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name}.$$ rw 482 483 IGCM_card_CheckConflict run.card 484 IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/${Last_run_card}.$$ rw 485 486 IGCM_sys_Cd ${RUN_DIR} 422 487 else 423 #================================================# 424 # The file run.card allready exist # 425 #================================================# 426 427 #Test state of run in run.card 428 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 429 if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 430 echo 431 IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 432 IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 433 echo 434 IGCM_debug_Exit 435 IGCM_debug_Verif_Exit 436 fi 437 438 #===================================# 439 # Read updated run.card # 440 #===================================# 441 442 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix 443 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin 444 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd 445 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod 446 447 PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) 448 PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) 449 eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1 450 451 LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" ) 452 453 typeset LastDate 454 set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" ) 455 LastYearDateEnd=${LastDate[0]} 456 LastMonthDateEnd=${LastDate[1]} 457 LastDayDateEnd=${LastDate[2]} 458 459 if [ ${Period} = 1 ]; then 460 # save last Job output 461 typeset LastPeriod iLastPeriod Last_Script_Output_Name 462 (( LastPeriod=CumulPeriod-PeriodNb )) 463 iLastPeriod=$( printf "%06d" ${LastPeriod} ) 464 Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}" 465 Last_run_card="run.card.${iLastPeriod}" 466 #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name} 467 #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1 468 IGCM_debug_Print 2 "Try to save previous ksh job output" 469 IGCM_sys_Cd ${SUBMIT_DIR}/ 470 IGCM_sys_Put_Out ${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name}.$$ rw 471 472 IGCM_card_CheckConflict run.card 473 IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/${Last_run_card}.$$ rw 474 475 IGCM_sys_Cd ${RUN_DIR} 476 else 477 unset FileToBeDeleted 478 fi 479 480 IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 481 IGCM_config_Analyse_PeriodLength 482 483 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 484 485 fi 486 OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} 487 488 # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 489 # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) 490 year_m1=$(( year - 1 )) 491 year_p1=$(( year + 1 )) 492 # Compute month_m1 (month minus 1M) 493 # Compute yyyymm_m1 (yyyymm minus 1M) 494 month_m1=$(( month - 1 )) 495 if [ ${month_m1} = 0 ]; then 496 month_m1=12 497 yyyymm_m1=${year_m1}12 498 elif [ ${month_m1} -le 9 ]; then 499 month_m1=0${month_m1} 500 yyyymm_m1=${year}${month_m1} 501 else 502 yyyymm_m1=${year}${month_m1} 488 unset FileToBeDeleted 503 489 fi 504 # Compute month_p1 (month plus 1M) 505 # Compute yyyymm_p1 (yyyymm plus 1M) 506 month_p1=$(( month + 1 )) 507 if [ ${month_p1} = 13 ]; then 508 month_p1=01 509 yyyymm_p1=${year_p1}01 510 elif [ ${month_p1} -le 9 ]; then 511 month_p1=0${month_p1} 512 yyyymm_p1=${year}${month_p1} 513 else 514 yyyymm_p1=${year}${month_p1} 490 491 IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 492 IGCM_config_Analyse_PeriodLength 493 494 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 495 496 fi 497 OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} 498 499 # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 500 # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) 501 year_m1=$(( year - 1 )) 502 year_p1=$(( year + 1 )) 503 # Compute month_m1 (month minus 1M) 504 # Compute yyyymm_m1 (yyyymm minus 1M) 505 month_m1=$(( month - 1 )) 506 if [ ${month_m1} = 0 ]; then 507 month_m1=12 508 yyyymm_m1=${year_m1}12 509 elif [ ${month_m1} -le 9 ]; then 510 month_m1=0${month_m1} 511 yyyymm_m1=${year}${month_m1} 512 else 513 yyyymm_m1=${year}${month_m1} 514 fi 515 # Compute month_p1 (month plus 1M) 516 # Compute yyyymm_p1 (yyyymm plus 1M) 517 month_p1=$(( month + 1 )) 518 if [ ${month_p1} = 13 ]; then 519 month_p1=01 520 yyyymm_p1=${year_p1}01 521 elif [ ${month_p1} -le 9 ]; then 522 month_p1=0${month_p1} 523 yyyymm_p1=${year}${month_p1} 524 else 525 yyyymm_p1=${year}${month_p1} 526 fi 527 #IGCM_debug_Print 1 "jg 1 month_m1 = ${month_m1} month_p1 = ${month_p1} " 528 #IGCM_debug_Print 1 "jg 1 calculate yyyymm_m1 = ${yyyymm_m1} " 529 #IGCM_debug_Print 1 "jg 1 calculate yyyymm_p1 = ${yyyymm_p1} " 530 531 # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 532 533 #===================================================================# 534 # Prepare variables available for ${COMP}.card and ${COMP}.driver # 535 # But available to any son functions # 536 #===================================================================# 537 538 # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !) 539 (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 )) 540 541 # Debug Print : 542 IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" 543 IGCM_debug_Print 1 "Year of simulation : ${year}" 544 IGCM_debug_Print 1 "Month of simulation : ${month}" 545 IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" 546 IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" 547 IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" 548 IGCM_debug_Print 1 "SimulationLengthInDays : ${SimulationLengthInDays}" 549 IGCM_debug_Print 1 "ExperienceLengthInDays : ${ExperienceLengthInDays}" 550 551 #================================================================# 552 # Prepare variables available for comp_finalyze # 553 #================================================================# 554 555 # Period for save files 556 eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1 557 558 # Prefix for save files of this period 559 eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod} > /dev/null 2>&1 560 561 # List of files that will be deleted in RUN_DIR after run 562 [ -f stack ] && FileToBeDeleted[0]="stack" 563 564 # Test if the same run as already been saved : 565 if [ X${JobType} = XRUN ] ; then 566 if [ ${DRYRUN} -le 0 ] ; then 567 if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then 568 IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 569 IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 570 IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 571 IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 572 IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists." 573 IGCM_debug_Verif_Exit 574 fi 515 575 fi 516 #IGCM_debug_Print 1 "jg 1 month_m1 = ${month_m1} month_p1 = ${month_p1} " 517 #IGCM_debug_Print 1 "jg 1 calculate yyyymm_m1 = ${yyyymm_m1} " 518 #IGCM_debug_Print 1 "jg 1 calculate yyyymm_p1 = ${yyyymm_p1} " 519 520 # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 521 522 #===================================================================# 523 # Prepare variables available for ${COMP}.card and ${COMP}.driver # 524 # But available to any son functions # 525 #===================================================================# 526 527 # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !) 528 (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 )) 529 530 # Debug Print : 531 IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" 532 IGCM_debug_Print 1 "Year of simulation : ${year}" 533 IGCM_debug_Print 1 "Month of simulation : ${month}" 534 IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" 535 IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" 536 IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" 537 IGCM_debug_Print 1 "SimulationLengthInDays : ${SimulationLengthInDays}" 538 IGCM_debug_Print 1 "ExperienceLengthInDays : ${ExperienceLengthInDays}" 539 540 #================================================================# 541 # Prepare variables available for comp_finalyze # 542 #================================================================# 543 544 # Period for save files 545 eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1 546 547 # Prefix for save files of this period 548 eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod} > /dev/null 2>&1 549 550 # List of files that will be deleted in RUN_DIR after run 551 [ -f stack ] && FileToBeDeleted[0]="stack" 552 553 # Test if the same run as already been saved : 554 if [ X${JobType} = XRUN ] ; then 555 if [ ${DRYRUN} -le 0 ] ; then 556 if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then 557 IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 558 IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 559 IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 560 IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 561 IGCM_debug_Print 1 " This exit has been initiated because at least ${R_OUT_KSH}/${PREFIX}_${Exe_Output} exists." 562 IGCM_debug_Verif_Exit 563 fi 564 fi 565 else 566 if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then 567 IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode." 568 fi 576 else 577 if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then 578 IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode." 569 579 fi 570 571 ExecutionFail=false 572 573 IGCM_debug_PopStack "IGCM_config_PeriodStart" 580 fi 581 582 ExecutionFail=false 583 584 IGCM_debug_PopStack "IGCM_config_PeriodStart" 574 585 } 575 586 … … 577 588 function IGCM_config_SaveSourceModifications 578 589 { 579 580 581 582 583 584 585 590 IGCM_debug_PushStack "IGCM_config_SaveSourceModifications" 591 592 typeset ExeOutDateMax listVarEnv 593 ExeOutDateMax=$1 594 595 listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR" 596 IGCM_sys_RshMaster "\ 586 597 . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \ 587 598 export ExeOutDateMax=${ExeOutDateMax};\ 588 599 export R_OUT_EXE=${R_OUT_EXE};\ 589 600 export PREFIX=${PREFIX};\ … … 593 604 IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}" 594 605 595 606 IGCM_debug_PopStack "IGCM_config_SaveSourceModifications" 596 607 } 597 608 … … 599 610 function IGCM_config_PeriodEnd 600 611 { 601 602 603 604 605 606 607 608 609 610 IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output}611 612 613 IGCM_card_CheckConflict run.card614 IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card rw615 616 IGCM_debug_Print 1 "Check components binary : size and creation date"617 618 typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize619 typeset comp i620 typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax621 622 #==================================#623 # Get last Exe Size #624 #==================================#625 626 (( i=0 ))627 if ( ${FirstInitialize} ) ; then612 IGCM_debug_PushStack "IGCM_config_PeriodEnd" 613 614 echo 615 IGCM_debug_Print 1 "IGCM_config_PeriodEnd" 616 echo 617 618 #==================================# 619 # Save Job output # 620 #==================================# 621 IGCM_sys_PutBuffer_Out ${Exe_Output} ${R_BUF_KSH}/${PREFIX}_${Exe_Output} 622 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}" 623 624 IGCM_card_CheckConflict run.card 625 IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw 626 627 IGCM_debug_Print 1 "Check components binary : size and creation date" 628 629 typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize 630 typeset comp i 631 typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax 632 633 #==================================# 634 # Get last Exe Size # 635 #==================================# 636 637 (( i=0 )) 638 if ( ${FirstInitialize} ) ; then 628 639 run_Log_LastExeSize="" 629 640 for comp in ${config_ListOfComponents[*]} ; do 630 631 641 run_Log_LastExeSize[$i]=0 642 (( i=i+1 )) 632 643 done 633 else644 else 634 645 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 635 fi636 #==================================#637 # And Build ExeDate #638 #==================================#639 640 # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33641 # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M")642 # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34643 ExeDate=""644 NextExeSize="( "645 (( i=0 ))646 UpdateExe=false647 (( ExeSecDateMax = 0 ))648 for comp in ${config_ListOfComponents[*]} ; do646 fi 647 #==================================# 648 # And Build ExeDate # 649 #==================================# 650 651 # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33 652 # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M") 653 # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34 654 ExeDate="" 655 NextExeSize="( " 656 (( i=0 )) 657 UpdateExe=false 658 (( ExeSecDateMax = 0 )) 659 for comp in ${config_ListOfComponents[*]} ; do 649 660 650 661 IGCM_debug_Print 3 ${comp} … … 654 665 # Only if we really have an executable for the component : 655 666 if [ X${ExeNameIn} = X\"\" ] ; then 656 657 667 # If there is no exe file for this component 668 (( ExeSize=0 )) 658 669 else 659 660 661 662 663 664 665 666 667 668 669 670 eval LS_bin=${R_EXE}/${ExeNameIn} 671 IGCM_sys_FileSize ${LS_bin} ExeSize 672 673 set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) 674 if [ X${ExeDate} = X ] ; then 675 # First component exe date 676 ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} 677 else 678 ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} 679 fi 680 ExeDate=${ExeDate}_${LS_comp[7]} 670 681 fi 671 682 672 683 if [ ${i} -eq 0 ] ; then 673 674 684 # First component 685 NextExeSize="( "${ExeSize} 675 686 else 676 687 NextExeSize=${NextExeSize}", "${ExeSize} 677 688 fi 678 689 eval LastCompExeSize=${run_Log_LastExeSize[$i]} … … 680 691 681 692 if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 682 683 684 685 686 687 688 689 690 691 692 693 694 695 693 if ( ${FirstInitialize} ) ; then 694 IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" 695 else 696 IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 697 IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" 698 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 699 fi 700 eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 701 UpdateExe=true 702 703 IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate 704 if [ $ExeSecDateMax -lt $ExeSecDate ] ; then 705 ExeSecDateMax=$ExeSecDate 706 fi 696 707 fi 697 done 698 699 if ( ${UpdateExe} ) ; then 700 echo "Launch SaveSourceModifications." 701 IGCM_config_SaveSourceModifications ${ExeSecDateMax} 702 fi 703 704 NextExeSize=${NextExeSize}" )" 705 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 706 707 if [ ${DRYRUN} -le 1 ] ; then 708 done 709 710 # SD : switch off for now 711 # if ( ${UpdateExe} ) ; then 712 # echo "Launch SaveSourceModifications." 713 # IGCM_config_SaveSourceModifications ${ExeSecDateMax} 714 # fi 715 716 NextExeSize=${NextExeSize}" )" 717 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 718 719 if [ ${DRYRUN} -le 1 ] ; then 708 720 tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt 709 721 ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) 710 722 RET=$? 711 723 if [ $RET -eq 0 ] ; then 712 713 714 715 724 # ExeCpuLog variable contents 5 fields 725 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" | \ 726 gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ 727 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card 716 728 fi 717 729 eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" 718 fi719 720 # All was right ? no ? then we stop.721 IGCM_debug_Verif_Exit722 723 # If all was OK, we can delete all files not necessary for next Job724 echo725 IGCM_debug_Print 1 "Files that will be deleted before next period-run : "726 727 if [ ${DRYRUN} -le 2 ] ; then730 fi 731 732 # All was right ? no ? then we stop. 733 IGCM_debug_Verif_Exit 734 735 # If all was OK, we can delete all files not necessary for next Job 736 echo 737 IGCM_debug_Print 1 "Files that will be deleted before next period-run : " 738 739 if [ ${DRYRUN} -le 2 ] ; then 728 740 for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done 729 else741 else 730 742 echo ${FileToBeDeleted[@]} 731 fi732 733 #=================================================#734 # Modification of libIGCM behaviour #735 #=================================================#736 737 # To use this function, one must copy libIGCM.card from ${libIGCM} directory738 # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card,739 # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop.740 if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then743 fi 744 745 #=================================================# 746 # Modification of libIGCM behaviour # 747 #=================================================# 748 749 # To use this function, one must copy libIGCM.card from ${libIGCM} directory 750 # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, 751 # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 752 if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then 741 753 echo 742 754 echo "########################################################################" … … 750 762 # Special treatments for libIGCM internals 751 763 for option in ${libIGCM_UserChanges[*]} ; do 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 764 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} 765 766 echo "We will change : ${option}." 767 eval echo "Previous value : " \${${option}} 768 eval echo "Change to : " \${libIGCM_UserChanges_${option}} 769 770 eval ${option}=\${libIGCM_UserChanges_${option}} 771 772 case ${option} in 773 config_UserChoices_DateEnd) 774 IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd 775 DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 776 777 # Period Length In Days between DateBegin and DateEnd 778 (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) 779 if [ ${ExperienceLengthInDays} -lt 0 ] ; then 780 IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." 781 IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates." 782 IGCM_debug_Verif_Exit 783 fi 784 ;; 785 config_UserChoices_PeriodLength) 786 IGCM_debug_Print 1 "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" 787 ;; 788 PeriodNb) 789 IGCM_debug_Print 1 "Loop in main Job with ${PeriodNb} period(s)" 790 ;; 791 config_Post_RebuildFrequency) 792 IGCM_debug_Print 1 "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" 793 IGCM_post_Configure 794 ;; 795 config_Post_TimeSeriesFrequency) 796 IGCM_debug_Print 1 "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" 797 IGCM_post_Configure 798 ;; 799 config_Post_SeasonalFrequency) 800 IGCM_debug_Print 1 "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" 801 IGCM_post_Configure 802 ;; 803 esac 804 done 805 806 echo 807 echo "########################################################################" 808 echo 809 fi 810 811 #=================================================# 812 # Determine next computed period # 813 #=================================================# 814 815 PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 ) 816 IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 817 year_m1=$(( year - 1 )) 818 year_p1=$(( year + 1 )) 819 IGCM_config_Analyse_PeriodLength 820 PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) ) 821 822 # Debug Print : 823 echo 824 IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution" 825 IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" 826 IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" 827 IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" 828 829 PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} ) 830 PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} ) 831 832 (( CumulPeriod = CumulPeriod + 1 )) 833 834 # Debug Print : 835 echo 836 IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}" 837 IGCM_debug_Print 3 "PeriodDateEnd Human : ${PeriodDateEnd}" 838 IGCM_debug_Print 3 "CumulPeriod : ${CumulPeriod}" 839 840 #=================================================# 841 # Write updated run.card # 842 #=================================================# 843 844 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix} 845 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} 846 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} 847 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} 848 849 if ( ${FirstInitialize} ) ; then 850 # It's no more the first time 851 FirstInitialize=false 852 fi 853 854 IGCM_debug_PopStack "IGCM_config_PeriodEnd" 843 855 } 844 856 … … 846 858 function IGCM_config_Finalize 847 859 { 848 IGCM_debug_PushStack "IGCM_config_Finalize" 849 850 echo 851 IGCM_debug_Print 1 "IGCM_config_Finalize" 852 echo 853 854 if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then 855 #==========================# 856 # End of entire simulation # 857 #==========================# 858 859 # Mail notification 860 IGCM_sys_SendMail 861 862 # 863 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed" 864 IGCM_debug_Print 1 "Normal End of computation." 865 if ( $DEBUG_debug ) ; then 866 echo 867 IGCM_debug_Print 1 "Your files on ${R_OUT} :" 868 IGCM_sys_Tree ${R_SAVE} 869 fi 870 else 871 #=================# 872 # Submit next job # 873 #=================# 874 875 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" 876 877 # Name of next Ksh Script output : 878 eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )" 879 880 IGCM_debug_Print 1 "Submit next job" 881 # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR 882 IGCM_sys_Cd ${SUBMIT_DIR} 883 # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} 884 ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l ) 885 [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) 886 # Submit next job and come back 887 IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} 888 IGCM_sys_Cd - 860 IGCM_debug_PushStack "IGCM_config_Finalize" 861 862 echo 863 IGCM_debug_Print 1 "IGCM_config_Finalize" 864 echo 865 866 if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then 867 #==========================# 868 # End of entire simulation # 869 #==========================# 870 871 # Mail notification 872 IGCM_sys_SendMail 873 874 # 875 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed" 876 IGCM_debug_Print 1 "Normal End of computation." 877 if ( $DEBUG_debug ) ; then 878 echo 879 IGCM_debug_Print 1 "Your files on ${R_SAVE} :" 880 IGCM_sys_Tree ${R_SAVE} 881 882 IGCM_debug_Print 1 "Your files on ${R_BUFR} :" 883 IGCM_sys_Tree ${R_BUFR} 889 884 fi 890 891 # Supress Non Deleted Boundary files 892 if [ ${DRYRUN} -le 2 ] ; then 893 IGCM_comp_DelFixeBoundaryFiles 894 ls -la 895 fi 896 897 # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 898 # Only for production run (No clean up in DEV or DEB mode) 899 # and command sent from .. directory. 900 IGCM_sys_Cd .. 901 [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR} 902 903 IGCM_debug_PopStack "IGCM_config_Finalize" 885 else 886 #=================# 887 # Submit next job # 888 #=================# 889 890 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" 891 892 # Name of next Ksh Script output : 893 eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )" 894 895 IGCM_debug_Print 1 "Submit next job" 896 # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR 897 IGCM_sys_Cd ${SUBMIT_DIR} 898 # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} 899 ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l ) 900 [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) 901 # Submit next job and come back 902 IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} 903 IGCM_sys_Cd - 904 fi 905 906 # Supress Non Deleted Boundary files 907 if [ ${DRYRUN} -le 2 ] ; then 908 IGCM_comp_DelFixeBoundaryFiles 909 ls -la 910 fi 911 912 # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 913 # Only for production run (No clean up in DEV or DEB mode) 914 # and command sent from .. directory. 915 IGCM_sys_Cd .. 916 [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR} 917 918 IGCM_debug_PopStack "IGCM_config_Finalize" 904 919 } 905 920 -
trunk/libIGCM/libIGCM_date/libIGCM_date.ksh
r522 r544 42 42 function IGCM_date_YearDigit 43 43 { 44 45 46 47 48 49 44 IGCM_debug_PushStack "IGCM_date_YearDigit" $@ 45 46 NUM=$(( 10#${1} )) 47 echo $( gawk "BEGIN { printf \"%0${dY}d\",${NUM} }" ) 48 49 IGCM_debug_PopStack "IGCM_date_YearDigit" 50 50 } 51 51 … … 53 53 function IGCM_date_GregorianDigit 54 54 { 55 56 57 58 59 60 55 IGCM_debug_PushStack "IGCM_date_GregorianDigit" $@ 56 57 NUM=$(( 10#${1} )) 58 echo $( gawk "BEGIN { printf \"%0${pY}d\",${NUM} }" ) 59 60 IGCM_debug_PopStack "IGCM_date_GregorianDigit" 61 61 } 62 62 … … 64 64 function IGCM_date_HumanDigit 65 65 { 66 67 68 69 70 71 66 IGCM_debug_PushStack "IGCM_date_HumanDigit" $@ 67 68 echo $( IGCM_date_GregorianDigit $( print ${1} | sed 's/-//g' ) ) \ 69 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/" 70 71 IGCM_debug_PopStack "IGCM_date_HumanDigit" 72 72 } 73 73 … … 75 75 function IGCM_date_SupressZeros 76 76 { 77 78 79 77 IGCM_debug_PushStack "IGCM_date_SupressZeros" $@ 78 echo $( print ${1} | sed -e "s/0*//" ) 79 IGCM_debug_PopStack "IGCM_date_SupressZeros" 80 80 } 81 81 … … 83 83 function IGCM_date_ConvertFormatToGregorian 84 84 { 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 85 IGCM_debug_PushStack "IGCM_date_ConvertFormatToGregorian" $@ 86 87 # from a yyyy-mm-dd date format return 88 # a yyymmdd date format 89 # usage IGCM_date_ConvertFormat yyyy-mm-dd 90 91 # if there is no argument on the command line, 92 # then assume that a y-m-d formated date is being 93 # piped in 94 typeset ymd 95 if [ $# = 0 ] 96 then 97 read ymd 98 else 99 ymd=$1 100 fi 101 102 IGCM_date_GregorianDigit $( print ${ymd} | sed 's/-//g' ) 103 104 IGCM_debug_PopStack "IGCM_date_ConvertFormatToGregorian" 105 105 } 106 106 … … 108 108 function IGCM_date_ConvertFormatToHuman 109 109 { 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 110 IGCM_debug_PushStack "IGCM_date_ConvertFormatToHuman" $@ 111 112 # from a yyyymmdd date format return 113 # a yyyy-mm-dd date format 114 # usage IGCM_date_ConvertFormat yyyymmdd 115 116 # if there is no argument on the command line, 117 # then assume that a yyyymmdd formated date is being 118 # piped in 119 typeset dt 120 if [ $# = 0 ] 121 then 122 read dt 123 else 124 dt=$1 125 fi 126 127 # break the yyyymmdd into separate parts for year, month and day 128 echo $( IGCM_date_GregorianDigit ${dt} ) \ 129 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/" 130 131 IGCM_debug_PopStack "IGCM_date_ConvertFormatToHuman" 132 132 } 133 133 … … 135 135 function IGCM_date_GetYearMonth 136 136 { 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 137 IGCM_debug_PushStack "IGCM_date_GetYearMonth" $@ 138 139 # from a yyyymmdd date format return 140 # a yyyy year and mm month 141 # usage IGCM_date_GetYearMonth yyyymmdd year_var month_var 142 143 # if there is no argument on the command line, 144 # then assume that a yyyymmdd formated date is being 145 # piped in 146 typeset dt 147 if [ $# = 0 ] 148 then 149 read dt 150 else 151 dt=$1 152 fi 153 154 # break the yyyymmdd into separate parts for year, month and day 155 eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 156 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) 157 eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 158 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) 159 160 IGCM_debug_PopStack "IGCM_date_GetYearMonth" 161 161 } 162 162 … … 164 164 function IGCM_date_GetYearMonthDay 165 165 { 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 166 IGCM_debug_PushStack "IGCM_date_GetYearMonthDay" $@ 167 168 # from a yyyymmdd date format return 169 # a yyyy year, mm month and dd day 170 # usage IGCM_date_GetYearMonthDay yyyymmdd year_var month_var day_var 171 172 # if there is no argument on the command line, 173 # then assume that a yyyymmdd formated date is being 174 # piped in 175 typeset dt 176 if [ $# = 0 ] 177 then 178 read dt 179 else 180 dt=$1 181 fi 182 183 # break the yyyymmdd into separate parts for year, month and day 184 eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 185 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) 186 eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 187 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) 188 eval $4=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 189 | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3/" ) 190 191 IGCM_debug_PopStack "IGCM_date_GetYearMonthDay" 192 192 } 193 193 … … 202 202 { 203 203 # IGCM_debug_PushStack "IGCM_date_DaysInYear" $@ 204 205 206 207 208 209 210 211 212 213 214 204 # return the number of days in a year 205 # usage IGCM_date_DaysInYear yyyy 206 207 # What is the calendar : 208 case ${config_UserChoices_CalendarType} in 209 360d|360_day) 210 if [ X$2 = X ] ; then 211 echo 360 212 else 213 eval $2=360 > /dev/null 2>&1 214 fi 215 215 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 216 return;; 217 noleap|365_day) 218 if [ X$2 = X ] ; then 219 echo 365 220 else 221 eval $2=365 > /dev/null 2>&1 222 fi 223 224 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 225 return;; 226 all_leap|366_day) 227 if [ X$2 = X ] ; then 228 echo 366 229 else 230 eval $2=366 > /dev/null 2>&1 231 fi 232 233 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 234 return;; 235 esac 236 237 typeset y a 238 239 # if there is no argument on the command line, 240 # then assume that a yyyy is being piped in 241 if [ $# = 0 ] 242 then 243 read y 244 else 245 y=$(( 10#${1} )) 246 fi 247 248 # a year is a leap year if it is even divisible by 4 249 # but not evenly divisible by 100 250 # unless it is evenly divisible by 400 251 252 # if it is evenly divisible by 400 it must be a leap year 253 a=$(( $y % 400 )) 254 if [ $a = 0 ] 255 then 256 if [ X$2 = X ] ; then 257 echo 366 258 else 259 eval $2=366 > /dev/null 2>&1 260 fi 216 return;; 217 noleap|365_day) 218 if [ X$2 = X ] ; then 219 echo 365 220 else 221 eval $2=365 > /dev/null 2>&1 222 fi 261 223 262 224 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 263 return 264 fi 265 266 #if it is evenly divisible by 100 it must not be a leap year 267 a=$(( $y % 100 )) 268 if [ $a = 0 ] 269 then 270 if [ X$2 = X ] ; then 271 echo 365 272 else 273 eval $2=365 > /dev/null 2>&1 274 fi 225 return;; 226 all_leap|366_day) 227 if [ X$2 = X ] ; then 228 echo 366 229 else 230 eval $2=366 > /dev/null 2>&1 231 fi 275 232 276 233 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 277 return 278 fi 279 280 # if it is evenly divisible by 4 it must be a leap year 281 a=$(( $y % 4 )) 282 if [ $a = 0 ] 283 then 284 if [ X$2 = X ] ; then 285 echo 366 286 else 287 eval $2=366 > /dev/null 2>&1 288 fi 234 return;; 235 esac 236 237 typeset y a 238 239 # if there is no argument on the command line, 240 # then assume that a yyyy is being piped in 241 if [ $# = 0 ] 242 then 243 read y 244 else 245 y=$(( 10#${1} )) 246 fi 247 248 # a year is a leap year if it is even divisible by 4 249 # but not evenly divisible by 100 250 # unless it is evenly divisible by 400 251 252 # if it is evenly divisible by 400 it must be a leap year 253 a=$(( $y % 400 )) 254 if [ $a = 0 ] 255 then 256 if [ X$2 = X ] ; then 257 echo 366 258 else 259 eval $2=366 > /dev/null 2>&1 260 fi 289 261 290 262 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 291 return 292 fi 293 294 # otherwise it is not a leap year 263 return 264 fi 265 266 # if it is evenly divisible by 100 it must not be a leap year 267 a=$(( $y % 100 )) 268 if [ $a = 0 ] 269 then 295 270 if [ X$2 = X ] ; then 296 echo 365 297 else 298 eval $2=365 > /dev/null 2>&1 299 fi 271 echo 365 272 else 273 eval $2=365 > /dev/null 2>&1 274 fi 275 276 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 277 return 278 fi 279 280 # if it is evenly divisible by 4 it must be a leap year 281 a=$(( $y % 4 )) 282 if [ $a = 0 ] 283 then 284 if [ X$2 = X ] ; then 285 echo 366 286 else 287 eval $2=366 > /dev/null 2>&1 288 fi 289 290 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 291 return 292 fi 293 294 # otherwise it is not a leap year 295 if [ X$2 = X ] ; then 296 echo 365 297 else 298 eval $2=365 > /dev/null 2>&1 299 fi 300 300 301 301 # IGCM_debug_PopStack "IGCM_date_DaysInYear" … … 315 315 # IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@ 316 316 317 # calculates the number of days in a month 318 # usage IGCM_date_DaysInMonth yyyy mm 319 # or IGCM_date_DaysInMonth yyyymmdd 317 # calculates the number of days in a month 318 # usage IGCM_date_DaysInMonth yyyy mm 319 # or IGCM_date_DaysInMonth yyyymmdd 320 321 # What is the calendar : 322 if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then 323 if [ X$3 = X ] ; then 324 echo 30 325 else 326 eval $3=30 > /dev/null 2>&1 327 fi 328 329 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 330 return 331 fi 332 333 typeset ymd y m 334 335 # if there are no command line arguments then assume that a yyyymmdd is being 336 # piped in and read the value. 337 # if there is only one argument assume it is a yyyymmdd on the command line 338 # other wise it is a yyyy and mm on the command line 339 if [ $# = 0 ] 340 then 341 read ymd 342 elif [ $# = 1 ] 343 then 344 ymd=$1 345 else 346 ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 )) 347 fi 348 349 # extract the year and the month 350 y=$(( $ymd / 10000 )) ; 351 m=$(( ( $ymd % 10000 ) / 100 )) ; 352 353 # 30 days hath september etc. 354 case $m in 355 1|3|5|7|8|10|12) 356 if [ X$3 = X ] ; then 357 echo 31 358 else 359 eval $3=31 > /dev/null 2>&1 360 fi 361 362 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 363 return ;; 364 4|6|9|11) 365 if [ X$3 = X ] ; then 366 echo 30 367 else 368 eval $3=30 > /dev/null 2>&1 369 fi 320 370 321 # What is the calendar :322 if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then323 if [ X$3 = X ] ; then324 echo 30325 else326 eval $3=30 > /dev/null 2>&1327 fi328 329 # IGCM_debug_PopStack "IGCM_date_DaysInMonth"330 return331 fi332 333 typeset ymd y m334 335 # if there are no command line arguments then assume that a yyyymmdd is being336 # piped in and read the value.337 # if there is only one argument assume it is a yyyymmdd on the command line338 # other wise it is a yyyy and mm on the command line339 if [ $# = 0 ]340 then341 read ymd342 elif [ $# = 1 ]343 then344 ymd=$1345 else346 ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 ))347 fi348 349 # extract the year and the month350 y=$(( $ymd / 10000 )) ;351 m=$(( ( $ymd % 10000 ) / 100 )) ;352 353 # 30 days hath september etc.354 case $m in355 1|3|5|7|8|10|12)356 if [ X$3 = X ] ; then357 echo 31358 else359 eval $3=31 > /dev/null 2>&1360 fi361 362 371 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 363 return ;; 364 4|6|9|11) 365 if [ X$3 = X ] ; then 366 echo 30 367 else 368 eval $3=30 > /dev/null 2>&1 369 fi 370 371 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 372 return ;; 373 *) ;; 374 esac 375 376 # except for month 2 which depends on whether the year is a leap year 377 # Use IGCM_date_DaysInYear to get the number of days in the year and return a value 378 # accordingly. 379 IGCM_date_DaysInYear $y diy 380 case $diy in 381 365) 382 if [ X$3 = X ] ; then 383 echo 28 384 else 385 eval $3=28 > /dev/null 2>&1 386 fi 387 388 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 389 return ;; 390 366) 391 if [ X$3 = X ] ; then 392 echo 29 393 else 394 eval $3=29 > /dev/null 2>&1 395 fi 396 397 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 398 return ;; 399 esac 372 return ;; 373 *) ;; 374 esac 375 376 # except for month 2 which depends on whether the year is a leap year 377 # Use IGCM_date_DaysInYear to get the number of days in the year and return a value 378 # accordingly. 379 IGCM_date_DaysInYear $y diy 380 case $diy in 381 365) 382 if [ X$3 = X ] ; then 383 echo 28 384 else 385 eval $3=28 > /dev/null 2>&1 386 fi 387 388 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 389 return ;; 390 366) 391 if [ X$3 = X ] ; then 392 echo 29 393 else 394 eval $3=29 > /dev/null 2>&1 395 fi 396 397 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" 398 return ;; 399 esac 400 400 401 401 # IGCM_debug_PopStack "IGCM_date_DaysInMonth" … … 411 411 function IGCM_date_ConvertGregorianDateToJulian 412 412 { 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 413 IGCM_debug_PushStack "IGCM_date_ConvertGregorianDateToJulian" $@ 414 415 # IGCM_date_ConvertGregorianDateToJulian converts yyyymmdd to yyyyddd 416 # usage IGCM_date_ConvertGregorianDateToJulian 19980429 417 418 typeset dt y m d x jul 419 420 # if there is no command line argument, then assume that the date 421 # is coming in on a pipe and use read to collect it 422 if [ $# = 0 ] 423 then 424 read dt 425 else 426 dt=$( IGCM_date_SupressZeros $1 ) 427 fi 428 429 # break the yyyymmdd into separate parts for year, month and day 430 y=$(( $dt / 10000 )) 431 m=$(( ( $dt % 10000 ) / 100 )) 432 d=$(( ( $dt % 100 ) )) 433 434 # add the days in each month up to (but not including the month itself) 435 # into the days. For example if the date is 19980203 then extract the 436 # number of days in January and add it to 03. If the date is June 14, 1998 437 # then extract the number of days in January, February, March, April and May 438 # and add them to 14. 439 x=1 440 while [ $x -lt $m ] 441 do 442 IGCM_date_DaysInMonth $y $x md 443 d=$(( $d + $md )) 444 x=$(( $x + 1 )) 445 done 446 447 # combine the year and day back together again and you have the julian date. 448 jul=$(( ( $y * 1000 ) + $d )) 449 echo $jul 450 451 IGCM_debug_PopStack "IGCM_date_ConvertGregorianDateToJulian" 452 452 } 453 453 … … 461 461 function IGCM_date_ConvertJulianDateToGregorian 462 462 { 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 463 IGCM_debug_PushStack "IGCM_date_ConvertJulianDateToGregorian" $@ 464 465 # IGCM_date_ConvertJulianDateToGregorian converts yyyyddd to yyyymmdd 466 # usage IGCM_date_ConvertJulianDateToGregorian 1998213 467 468 typeset dt y m d grg 469 470 # if there is no command line argument, assume one is being 471 # piped in and read it 472 if [ X$1 = X ] 473 then 474 read dt 475 else 476 dt=$1 477 fi 478 479 # break apart the year and the days 480 y=$(( $dt / 1000 )) 481 d=$(( $dt % 1000 )) 482 483 # subtract the number of days in each month starting from 1 484 # from the days in the date. When the day goes below 1, you 485 # have the current month. Add back the number of days in the 486 # month to get the correct day of the month 487 m=1 488 while [ $d -gt 0 ] 489 do 490 IGCM_date_DaysInMonth $y $m md 491 d=$(( $d - $md )) 492 m=$(( $m + 1 )) 493 done 494 495 d=$(( $d + $md )) 496 497 # the loop steps one past the correct month, so back up the month 498 m=$(( $m - 1 )) 499 500 # assemble the results into a gregorian date 501 grg=$(( ( $y * 10000 ) + ( $m * 100 ) + $d )) 502 echo $( IGCM_date_GregorianDigit $grg ) 503 504 IGCM_debug_PopStack "IGCM_date_ConvertJulianDateToGregorian" 505 505 } 506 506 … … 514 514 function IGCM_date_AddDaysToJulianDate 515 515 { 516 IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@ 517 518 # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date 519 # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14 520 521 typeset dif yd d y 522 523 # Read the difference from the command lines 524 # and the date from the command line, or standard input 525 if [ X$2 = X ] 526 then 527 dif=$1 528 read yd 529 else 530 yd=$1 531 dif=$2 532 fi 533 534 # Break it into pieces 535 d=$(( $yd % 1000 )) 536 y=$(( $yd / 1000 )) 537 538 # Add the number of days (if days is negative this results is 539 # a subtraction) 540 d=$(( $d + $dif )) 541 542 # Extract the days in the year 516 IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@ 517 518 # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date 519 # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14 520 521 typeset dif yd d y 522 523 # Read the difference from the command lines 524 # and the date from the command line, or standard input 525 if [ X$2 = X ] 526 then 527 dif=$1 528 read yd 529 else 530 yd=$1 531 dif=$2 532 fi 533 534 # Break it into pieces 535 d=$(( $yd % 1000 )) 536 y=$(( $yd / 1000 )) 537 538 # Add the number of days (if days is negative this results is 539 # a subtraction) 540 d=$(( $d + $dif )) 541 542 # Extract the days in the year 543 IGCM_date_DaysInYear $y diy 544 545 # If the calculated day exceeds the days in the year, 546 # add one year to the year and subtract the days in the year from the 547 # calculated days. Extract the days in the new year and repeat 548 # test until you end up with a day number that falls within the 549 # days of the year 550 while [ $d -gt $diy ] 551 do 552 d=$(( $d - $diy )) 553 y=$(( $y + 1 )) 543 554 IGCM_date_DaysInYear $y diy 544 545 # If the calculated day exceeds the days in the year, 546 # add one year to the year and subtract the days in the year from the 547 # calculated days. Extract the days in the new year and repeat 548 # test until you end up with a day number that falls within the 549 # days of the year 550 while [ $d -gt $diy ] 551 do 552 d=$(( $d - $diy )) 553 y=$(( $y + 1 )) 554 IGCM_date_DaysInYear $y diy 555 done 556 557 # This is the reverse process. If the calculated number of days 558 # is less than 1, move back one year. Extract 559 # the days in this year and add the days in the year 560 # loop on this test until you end up with a number that 561 # falls within the days of the year 562 while [ $d -lt 1 ] 563 do 564 y=$(( $y - 1 )) 565 IGCM_date_DaysInYear $y diy 566 d=$(( $d + $diy )) 567 done 568 569 # put the year and day back together and echo the result 570 yd=$(( ( $y * 1000 ) + $d )) 571 572 echo $yd 573 574 IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate" 555 done 556 557 # This is the reverse process. If the calculated number of days 558 # is less than 1, move back one year. Extract 559 # the days in this year and add the days in the year 560 # loop on this test until you end up with a number that 561 # falls within the days of the year 562 while [ $d -lt 1 ] 563 do 564 y=$(( $y - 1 )) 565 IGCM_date_DaysInYear $y diy 566 d=$(( $d + $diy )) 567 done 568 569 # put the year and day back together and echo the result 570 yd=$(( ( $y * 1000 ) + $d )) 571 572 echo $yd 573 574 IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate" 575 575 } 576 576 … … 584 584 function IGCM_date_AddDaysToGregorianDate 585 585 { 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 586 IGCM_debug_PushStack "IGCM_date_AddDaysToGregorianDate" $@ 587 588 # IGCM_date_AddDaysToGregorianDate adds days to a yyyymmdd formatted date 589 # usage IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14 590 591 # Read the difference from the command lines 592 # and the date from the command line, or standard input 593 typeset dif yd tmp res 594 if [ X$2 = X ] 595 then 596 dif=$1 597 read yd 598 else 599 yd=$1 600 dif=$2 601 fi 602 603 tmp=$( IGCM_date_ConvertGregorianDateToJulian $yd ) 604 tmp=$( IGCM_date_AddDaysToJulianDate $tmp $dif ) 605 res=$( IGCM_date_ConvertJulianDateToGregorian $tmp ) 606 607 echo $res 608 609 IGCM_debug_PopStack "IGCM_date_AddDaysToGregorianDate" 610 610 } 611 611 … … 619 619 function IGCM_date_DaysBetweenJulianDate 620 620 { 621 IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@ 622 623 # calculates the days difference between two dates and reports 624 # the number days as jul1 - jul2 625 # usage IGCM_date_DaysBetweenJulianDate jul1 jul2 626 # where julian date is in the form yyyyddd 627 628 usage () { 629 echo "Usage:" 630 echo " IGCM_date_DaysBetweenJulianDate jul1 jul2" 631 echo "" 632 echo " Calculates the day difference between" 633 echo " two julian dates (jul1 -jul2)" 634 echo " where a julian date is in the form of yyyyddd." 635 } 636 637 if [ $# -lt 2 ]; then 638 usage 639 IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate" 640 fi 641 642 # This process subtracts arg2 from arg1. If arg2 is larger 643 # then reverse the arguments. The calculations are done, and 644 # then the sign is reversed 645 if [ $1 -lt $2 ] 646 then 647 jul1=$2 648 jul2=$1 649 elif [ $1 -gt $2 ] 650 then 651 jul1=$1 652 jul2=$2 653 else 654 echo 0 655 IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate" 656 return 657 fi 658 659 # Break the dates in to year and day portions 660 yyyy1=$(( $jul1 / 1000 )) 661 yyyy2=$(( $jul2 / 1000 )) 662 ddd1=$(( $jul1 % 1000 )) 663 ddd2=$(( $jul2 % 1000 )) 664 665 # Subtract days 666 res=$(( $ddd1 - $ddd2 )) 667 668 # Then add days in year until year2 matches year1 669 670 case ${config_UserChoices_CalendarType} in 671 360d|360_day) 672 res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;; 673 noleap|365_day) 674 res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;; 675 all_leap|366_day) 676 res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;; 677 leap|gregorian|standard) 678 while [ $yyyy2 -lt $yyyy1 ] 679 do 680 IGCM_date_DaysInYear $yyyy2 diy 681 res=$(( $res + $diy )) 682 yyyy2=$(( $yyyy2 + 1 )) 683 done 684 ;; 685 esac 686 687 688 # if argument 2 was larger than argument 1 then 689 # the arguments were reversed before calculating 690 # adjust by reversing the sign 691 if [ $1 -lt $2 ] 692 then 693 res=$(( $res * -1 )) 694 fi 695 696 # and output the results 697 echo $res 698 621 IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@ 622 623 # calculates the days difference between two dates and reports 624 # the number days as jul1 - jul2 625 # usage IGCM_date_DaysBetweenJulianDate jul1 jul2 626 # where julian date is in the form yyyyddd 627 628 usage () { 629 echo "Usage:" 630 echo " IGCM_date_DaysBetweenJulianDate jul1 jul2" 631 echo "" 632 echo " Calculates the day difference between" 633 echo " two julian dates (jul1 -jul2)" 634 echo " where a julian date is in the form of yyyyddd." 635 } 636 637 if [ $# -lt 2 ]; then 638 usage 639 IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate" 640 fi 641 642 # This process subtracts arg2 from arg1. If arg2 is larger 643 # then reverse the arguments. The calculations are done, and 644 # then the sign is reversed 645 if [ $1 -lt $2 ] 646 then 647 jul1=$2 648 jul2=$1 649 elif [ $1 -gt $2 ] 650 then 651 jul1=$1 652 jul2=$2 653 else 654 echo 0 699 655 IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate" 656 return 657 fi 658 659 # Break the dates in to year and day portions 660 yyyy1=$(( $jul1 / 1000 )) 661 yyyy2=$(( $jul2 / 1000 )) 662 ddd1=$(( $jul1 % 1000 )) 663 ddd2=$(( $jul2 % 1000 )) 664 665 # Subtract days 666 res=$(( $ddd1 - $ddd2 )) 667 668 # Then add days in year until year2 matches year1 669 case ${config_UserChoices_CalendarType} in 670 360d|360_day) 671 res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;; 672 noleap|365_day) 673 res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;; 674 all_leap|366_day) 675 res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;; 676 leap|gregorian|standard) 677 while [ $yyyy2 -lt $yyyy1 ] 678 do 679 IGCM_date_DaysInYear $yyyy2 diy 680 res=$(( $res + $diy )) 681 yyyy2=$(( $yyyy2 + 1 )) 682 done 683 ;; 684 esac 685 686 687 # if argument 2 was larger than argument 1 then 688 # the arguments were reversed before calculating 689 # adjust by reversing the sign 690 if [ $1 -lt $2 ] 691 then 692 res=$(( $res * -1 )) 693 fi 694 695 # and output the results 696 echo $res 697 698 IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate" 700 699 } 701 700 … … 709 708 function IGCM_date_DaysBetweenGregorianDate 710 709 { 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 710 IGCM_debug_PushStack "IGCM_date_DaysBetweenGregorianDate" $@ 711 712 # calculates the days difference between two dates and reports 713 # the number days as grg1 - grg2 714 # usage IGCM_date_DaysBetweenGregorianDate grg1 grg2 715 # where gregorian date is in the form yyyymmdd 716 717 usage () { 718 echo "Usage:" 719 echo " IGCM_date_DaysBetweenGregorianDate grg1 grg2" 720 echo "" 721 echo " Calculate day difference between" 722 echo " two gregorian dates (grg1 - grg2)" 723 echo " where a gregorian date is in the form of yyyymmdd." 724 } 725 726 if [ $# -lt 2 ]; then 727 usage 728 IGCM_debug_Exit "IGCM_date_DaysBetweenGregorianDate" 729 fi 730 731 # convert each date to julian 732 grg1=$1 733 grg2=$2 734 735 jul1=$( IGCM_date_ConvertGregorianDateToJulian $grg1 ) 736 jul2=$( IGCM_date_ConvertGregorianDateToJulian $grg2 ) 737 738 if [ $jul1 -ne $jul2 ]; then 740 739 # calculate the answer using IGCM_date_DaysBetweenJulianDate 741 740 res=$( IGCM_date_DaysBetweenJulianDate $jul1 $jul2 ) 742 741 # and output the results 743 744 745 746 747 748 742 echo $res 743 else 744 echo 0 745 fi 746 747 IGCM_debug_PopStack "IGCM_date_DaysBetweenGregorianDate" 749 748 } 750 749 … … 757 756 function IGCM_date_DaysSinceJC 758 757 { 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 758 IGCM_debug_PushStack "IGCM_date_DaysSinceJC" $@ 759 760 # calculates the days difference between a date and 00010101 761 # usage IGCM_date_DaysSinceJC grg1 762 # where gregorian date is in the form yyyymmdd 763 764 usage () { 765 echo "Usage:" 766 echo " IGCM_date_DaysSinceJC grg1" 767 echo "" 768 echo " Calculate day difference between" 769 echo " a gregorian date and 00010101" 770 echo " where a gregorian date is in the form of yyyymmdd." 771 } 772 773 if [ $# -lt 1 ]; then 774 usage 775 IGCM_debug_Exit "IGCM_date_DaysSinceJC" 776 fi 777 778 typeset aux num 779 780 if [ ${1} -lt 5000000 ]; then 781 case ${config_UserChoices_CalendarType} in 782 360d|360_day) 783 aux=-360;; 784 noleap|365_day) 785 aux=-365;; 786 all_leap|366_day) 787 aux=-366;; 788 leap|gregorian|standard) 789 aux=-366;; 790 esac 791 num=101 792 elif [ ${1} -lt 15000000 ]; then 793 # To save CPU type we use auxiliary value 794 # which is number of days since JC and 10000101 795 case ${config_UserChoices_CalendarType} in 796 360d|360_day) 797 aux=359640;; 798 noleap|365_day) 799 aux=364635;; 800 all_leap|366_day) 801 aux=365634;; 802 leap|gregorian|standard) 803 aux=364877;; 804 esac 805 num=10000101 806 else 807 # To save CPU type we use auxiliary value 808 # which is number of days since JC and 19000101 809 case ${config_UserChoices_CalendarType} in 810 360d|360_day) 811 aux=683640;; 812 noleap|365_day) 813 aux=693135;; 814 all_leap|366_day) 815 aux=695034;; 816 leap|gregorian|standard) 817 aux=693595;; 818 esac 819 num=19000101 820 fi 821 echo $(( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) + $aux )) 822 823 IGCM_debug_PopStack "IGCM_date_DaysSinceJC" 825 824 } 826 825 … … 830 829 function IGCM_date_Check 831 830 { 832 831 IGCM_debug_PushStack "IGCM_date_Check" 833 832 834 833 #--------------------- 835 836 837 838 839 834 if [ ! -n "${libIGCM}" ] ; then 835 echo "Check libIGCM_date ...........................................[ FAILED ]" 836 echo "--Error--> libIGCM variable is not defined" 837 IGCM_debug_Exit "IGCM_date_Check" 838 fi 840 839 841 840 #--------------------- 842 843 844 845 846 847 841 whence -v gawk > /dev/null 2>&1 842 if [ ! $? -eq 0 ] ; then 843 echo "Check libIGCM_date ...........................................[ FAILED ]" 844 echo "--Error--> gawk command is not defined" 845 IGCM_debug_Exit "IGCM_date_Check" 846 fi 848 847 849 848 #--------------------- 850 851 852 853 854 855 856 857 858 859 860 861 862 863 849 ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh > IGCM_date_Test.ref.failed 2>&1 850 851 if diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref > /dev/null 2>&1 ; then 852 echo "Check libIGCM_date ...............................................[ OK ]" 853 rm -f IGCM_date_Test.ref.failed 854 else 855 echo "Check libIGCM_date ...........................................[ FAILED ]" 856 echo "--Error--> Execution of ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh" 857 echo " has produced the file IGCM_date_Test.ref.failed" 858 echo " Please analyse differences with the reference file by typing:" 859 echo " diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref" 860 echo " Report errors to the author: Sebastien.Denvil@ipsl.jussieu.fr" 861 IGCM_debug_Exit "IGCM_date_Check" 862 fi 864 863 865 864 #--------------------- 866 865 IGCM_debug_PopStack "IGCM_date_Check" 867 866 } 868 867 -
trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
r457 r544 28 28 29 29 if ( $DEBUG_debug ) ; then 30 31 32 33 34 35 30 if [ -f stack ] ; 31 then 32 echo "Stack of an libIGCM job :" >> stack 33 else 34 echo "Stack of an libIGCM job :" > stack 35 fi 36 36 fi 37 37 … … 68 68 #D- 69 69 function IGCM_debug_CallStack { 70 echo 71 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" 72 echo "!! IGCM_debug_CallStack !!" 70 echo 71 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" 72 echo "!! IGCM_debug_CallStack !!" 73 echo "!------------------------!" 74 echo 75 if ( $DEBUG_debug ) ; then 76 # La pile d'appels est affichée de la plus vieille à la plus récente 77 # (c'est donc l'inverse de la norme d'affichage). 78 typeset i decal 79 (( i=0 )) 80 until [ $i -eq ${IGCM_debug_LenStack} ]; do 81 decal=0 82 until [ $decal -eq ${i} ]; do 83 printf -- ' ' 84 let $(( decal=decal+1 )) 85 done 86 echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\ 87 "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" 88 let $((i=i+1)) 89 done 73 90 echo "!------------------------!" 74 echo 75 if ( $DEBUG_debug ) ; then 76 # La pile d'appels est affichée de la plus vieille à la plus récente 77 # (c'est donc l'inverse de la norme d'affichage). 78 typeset i decal 79 (( i=0 )) 80 until [ $i -eq ${IGCM_debug_LenStack} ]; do 81 decal=0 82 until [ $decal -eq ${i} ]; do 83 printf -- ' ' 84 let $(( decal=decal+1 )) 85 done 86 echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\ 87 "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" 88 let $((i=i+1)) 89 done 90 echo "!------------------------!" 91 fi 91 fi 92 92 } 93 93 … … 97 97 #D- 98 98 function IGCM_debug_PushStack { 99 100 101 102 103 99 if ( $DEBUG_debug ) ; then 100 typeset decal 101 echo >> stack 102 decal=0 103 while [ $decal -lt ${IGCM_debug_LenStack} ]; do 104 104 # printf -- ' ' >> stack 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 105 printf ' ' >> stack 106 let $(( decal=decal+1 )) 107 done 108 echo "> ${IGCM_debug_LenStack} : ${@}" >> stack 109 110 # We add function call name on beginning of the stack 111 set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]} 112 113 # We include the "null" Args in the beginning of the StackArgs 114 set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 115 # Then, we shift StackArgs tabular 116 if [ $# -gt 1 ]; then 117 shift; 118 IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2 119 fi 120 (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 )) 121 122 # If you want to print CallStack each time : 123 # IGCM_debug_CallStack 124 fi 125 125 } 126 126 … … 130 130 #D- 131 131 function IGCM_debug_PopStack { 132 if ( $DEBUG_debug ) ; then 133 if ( ${ExitFlag} ) ; then 134 echo '!!! ExitFlag has been activated !!!' >> stack 135 fi 136 if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then 137 let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) 138 139 IGCM_debug_Stack[0]="" 140 IGCM_debug_StackArgs[0]="" 141 142 set +A tmpStack -- ${IGCM_debug_Stack[*]} 143 unset IGCM_debug_Stack 144 set +A IGCM_debug_Stack -- ${tmpStack[*]} 145 146 set +A tmpStack -- ${IGCM_debug_StackArgs[*]} 147 unset IGCM_debug_StackArgs 148 set +A IGCM_debug_StackArgs -- ${tmpStack[*]} 149 unset tmpStack 150 else 151 echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} 152 IGCM_debug_Exit $@ 153 fi 154 typeset decal=0 155 while [ $decal -lt ${IGCM_debug_LenStack} ]; do 156 # printf -- ' ' >> stack 157 printf ' ' >> stack 158 (( decal=decal+1 )) 159 done 160 echo "< ${IGCM_debug_LenStack} : ${@}" >> stack 161 162 if [ ${IGCM_debug_LenStack} = 0 ]; then 163 # Reset array only when necessary 164 #echo 165 #IGCM_debug_Print 3 "Clean stack array" 166 #echo 167 #set -A IGCM_debug_Stack ${NULL_STR} 168 #set -A IGCM_debug_StackArgs ${NULL_STR} 169 unset IGCM_debug_Stack 170 unset IGCM_debug_StackArgs 171 IGCM_debug_Stack[0]=${NULL_STR} 172 IGCM_debug_StackArgs[0]=${NULL_STR} 173 fi 174 175 fi 176 177 #IGCM_debug_CallStack 132 if ( $DEBUG_debug ) ; then 133 if ( ${ExitFlag} ) ; then 134 echo '!!! ExitFlag has been activated !!!' >> stack 135 fi 136 if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then 137 let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) 138 139 IGCM_debug_Stack[0]="" 140 IGCM_debug_StackArgs[0]="" 141 142 set +A tmpStack -- ${IGCM_debug_Stack[*]} 143 unset IGCM_debug_Stack 144 set +A IGCM_debug_Stack -- ${tmpStack[*]} 145 146 set +A tmpStack -- ${IGCM_debug_StackArgs[*]} 147 unset IGCM_debug_StackArgs 148 set +A IGCM_debug_StackArgs -- ${tmpStack[*]} 149 unset tmpStack 150 else 151 echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} 152 IGCM_debug_Exit $@ 153 fi 154 typeset decal=0 155 while [ $decal -lt ${IGCM_debug_LenStack} ]; do 156 # printf -- ' ' >> stack 157 printf ' ' >> stack 158 (( decal=decal+1 )) 159 done 160 echo "< ${IGCM_debug_LenStack} : ${@}" >> stack 161 162 if [ ${IGCM_debug_LenStack} = 0 ]; then 163 # Reset array only when necessary 164 #echo 165 #IGCM_debug_Print 3 "Clean stack array" 166 #echo 167 #set -A IGCM_debug_Stack ${NULL_STR} 168 #set -A IGCM_debug_StackArgs ${NULL_STR} 169 unset IGCM_debug_Stack 170 unset IGCM_debug_StackArgs 171 IGCM_debug_Stack[0]=${NULL_STR} 172 IGCM_debug_StackArgs[0]=${NULL_STR} 173 fi 174 175 fi 176 #IGCM_debug_CallStack 178 177 } 179 178 … … 183 182 #D- 184 183 function IGCM_debug_Exit { 185 186 187 188 189 184 IGCM_debug_PushStack "IGCM_debug_Exit" 185 echo "IGCM_debug_Exit : " "${@}" 186 IGCM_debug_CallStack 187 ExitFlag=true 188 IGCM_debug_PopStack "IGCM_debug_Exit" 190 189 } 191 190 … … 195 194 #D- 196 195 function IGCM_debug_Verif_Exit { 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 196 if ( ${ExitFlag} ) ; then 197 # Plan to send an email here with IGCM_sys_SendMail 198 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal" 199 echo "IGCM_debug_Verif_Exit : Something wrong append." 200 echo " EXIT THE JOB." 201 echo 202 if ( $DEBUG_debug ) ; then 203 IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 204 echo "Your files on ${R_OUT} :" 205 IGCM_sys_Tree ${R_SAVE} 206 echo 207 fi 208 # Mail notification 209 IGCM_sys_SendMail 210 # And Good Bye 211 date 212 exit 1 213 fi 215 214 } 216 215 … … 220 219 #D- 221 220 function IGCM_debug_Verif_Exit_Post { 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 221 if ( ${ExitFlag} ) ; then 222 echo "IGCM_debug_Verif_Exit_Post : Something wrong append." 223 # If SpaceName is PROD then we stop if post_processing fails 224 # Plan to send an email here with IGCM_sys_SendMail 225 if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then 226 echo " EXIT THE JOB." 227 echo 228 if ( $DEBUG_debug ) ; then 229 IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error 230 echo 231 fi 232 # Mail notification 233 #IGCM_sys_SendMailPost 234 # And Good Bye 235 date 236 exit 1 237 else 238 echo "Either inside config.card the variable SpaceName is not in PROD" 239 echo "or insinde the main Job the variable JobType is not in RUN mode" 240 echo " SO WE DO NOT EXIT THE JOB." 241 echo 242 date 243 fi 244 fi 246 245 } 247 246 … … 252 251 function IGCM_debug_Print 253 252 { 254 typeset level=$1 253 typeset level=$1 254 shift 255 256 if [ X"${1}" = X"-e" ]; then 257 typeset cmd_echo="echo -e" 255 258 shift 256 257 if [ X"${1}" = X"-e" ]; then 258 typeset cmd_echo="echo -e" 259 shift 260 else 261 typeset cmd_echo="echo" 262 fi 263 264 if [ ${level} -le ${Verbosity} ] ; then 265 typeset i 266 case "${level}" in 267 1) for i in "$@" ; do 268 ${cmd_echo} "--Debug1-->" ${i} 269 done ;; 270 2) for i in "$@" ; do 271 ${cmd_echo} "--------Debug2-->" ${i} 272 done ;; 273 3) for i in "$@" ; do 274 ${cmd_echo} "--------------Debug3-->" ${i} 275 done ;; 276 esac 277 fi 259 else 260 typeset cmd_echo="echo" 261 fi 262 263 if [ ${level} -le ${Verbosity} ] ; then 264 typeset i 265 case "${level}" in 266 1) for i in "$@" ; do 267 ${cmd_echo} "--Debug1-->" ${i} 268 done ;; 269 2) for i in "$@" ; do 270 ${cmd_echo} "--------Debug2-->" ${i} 271 done ;; 272 3) for i in "$@" ; do 273 ${cmd_echo} "--------------Debug3-->" ${i} 274 done ;; 275 esac 276 fi 278 277 } 279 278 … … 284 283 function IGCM_debug_PrintVariables 285 284 { 286 287 288 289 290 291 292 293 285 typeset level=$1 286 shift 287 288 list=$( set | grep $1 | sed -e "s/'//g" ) 289 290 if [ "X${list}" != X ] ; then 291 IGCM_debug_Print ${level} ${list} 292 fi 294 293 } 295 294 … … 299 298 function IGCM_debug_Check 300 299 { 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 } 300 #--------------------- 301 if [ ! -n "${libIGCM}" ] ; then 302 echo "Check libIGCM_debug ..........................................[ FAILED ]" 303 echo "--Error--> libIGCM variable is not defined" 304 exit 2 305 fi 306 307 #--------------------- 308 if [ ! -n "${Verbosity}" ] ; then 309 echo "Check libIGCM_debug ..........................................[ FAILED ]" 310 echo "--Error--> Verbosity variable is not defined" 311 exit 3 312 fi 313 314 #--------------------- 315 ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1 316 sleep 2 317 318 if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then 319 echo "Check libIGCM_debug ..............................................[ OK ]" 320 rm -f IGCM_debug_Test.ref.failed 321 else 322 echo "Check libIGCM_debug ..........................................[ FAILED ]" 323 echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh" 324 echo " has produced the file IGCM_debug_Test.ref.failed" 325 echo " Please analyse differences with the reference file by typing:" 326 echo " diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref" 327 echo " Report errors to the author: Patrick.Brockmann@cea.fr" 328 exit 4 329 fi 330 #--------------------- 331 } -
trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
r457 r544 16 16 function IGCM_post_Configure 17 17 { 18 IGCM_debug_PushStack "IGCM_post_Configure" 19 20 # Debug Print : 21 echo 22 IGCM_debug_Print 1 "IGCM_post_Configure" 23 # 24 # Initialize 25 # 26 POST=false 27 RebuildFrequency=false 28 TimeSeriesFrequency=false 29 SeasonalFrequency=false 30 # 31 # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS 32 # 33 if [ X${AsynchronousRebuild} = Xtrue ] ; then 34 list_post="RebuildFrequency" 18 IGCM_debug_PushStack "IGCM_post_Configure" 19 20 # Debug Print : 21 echo 22 IGCM_debug_Print 1 "IGCM_post_Configure" 23 # 24 # Initialize 25 # 26 POST=false 27 RebuildFrequency=false 28 TimeSeriesFrequency=false 29 SeasonalFrequency=false 30 # 31 # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS 32 # 33 if [ X${AsynchronousRebuild} = Xtrue ] ; then 34 list_post="RebuildFrequency" 35 fi 36 # 37 if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then 38 list_post="${list_post} TimeSeriesFrequency" 39 fi 40 # 41 if [ X${Seasonal} = Xtrue ] ; then 42 list_post="${list_post} SeasonalFrequency" 43 fi 44 45 # Overrule special cases 46 if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 47 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ 48 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 49 TimeSeriesFrequency=true 50 POST=true 51 fi 52 # 53 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 54 [ ! X${config_Post_RebuildFrequency} = XNONE ] && \ 55 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 56 RebuildFrequency=true 57 POST=true 58 fi 59 60 # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY 61 # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO 62 for post_freq in ${list_post} ; do 63 # Extract frequency from previously defined variable 64 config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) 65 # Offset for Seasonal Average starting period 66 if [ ${post_freq} = SeasonalFrequency ] ; then 67 if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then 68 PeriodOffset=0 69 else 70 PeriodOffset=${config_Post_SeasonalFrequencyOffset} 71 fi 72 else 73 PeriodOffset=0 35 74 fi 36 # 37 if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then 38 list_post="${list_post} TimeSeriesFrequency" 75 # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) 76 # RebuildFrequency needs additionnal information 77 if [ ${post_freq} = RebuildFrequency ] ; then 78 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir 79 else 80 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength 39 81 fi 40 82 # 41 if [ X${Seasonal} = Xtrue ] ; then 42 list_post="${list_post} SeasonalFrequency" 43 fi 44 45 # Overrule special cases 46 if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 47 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ] && \ 48 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 49 TimeSeriesFrequency=true 50 POST=true 51 fi 52 # 53 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 54 [ ! X${config_Post_RebuildFrequency} = XNONE ] && \ 55 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 56 RebuildFrequency=true 57 POST=true 58 fi 59 60 # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY 61 # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO 62 for post_freq in ${list_post} ; do 63 # Extract frequency from previously defined variable 64 config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) 65 # Offset for Seasonal Average starting period 66 if [ ${post_freq} = SeasonalFrequency ] ; then 67 if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then 68 PeriodOffset=0 69 else 70 PeriodOffset=${config_Post_SeasonalFrequencyOffset} 71 fi 72 else 73 PeriodOffset=0 74 fi 75 # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) 76 # RebuildFrequency needs additionnal information 77 if [ ${post_freq} = RebuildFrequency ] ; then 78 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir 79 else 80 IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength 81 fi 82 # 83 IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}" 84 done 85 # 86 IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}" 87 # 88 IGCM_debug_PopStack "IGCM_post_Configure" 83 IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}" 84 done 85 # 86 IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}" 87 # 88 IGCM_debug_PopStack "IGCM_post_Configure" 89 89 } 90 90 91 91 function IGCM_post_Submit 92 92 { 93 IGCM_debug_PushStack "IGCM_post_Submit" 94 95 typeset listVarEnv 96 97 POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 98 99 if [ ${POST} = true ]; then 93 IGCM_debug_PushStack "IGCM_post_Submit" 94 95 typeset listVarEnv 96 97 POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 98 99 if [ ${POST} = true ]; then 100 echo 101 IGCM_debug_Print 1 "IGCM_post_Submit" 102 echo 103 IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}" 104 fi 105 106 #============ TIME SERIES POST-TREATMENT ===========# 107 if [ ${TimeSeriesFrequency} = true ] ; then 108 109 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED" 110 echo 111 112 113 114 # Get information from last execution 115 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted 116 CompletedFlag=${run_PostProcessing_TimeSeriesCompleted} 117 # 118 119 120 121 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 122 # 123 jLoop=${#ListDimension[*]} 124 j=0 125 until [ $j -ge ${jLoop} ]; do 126 Dimension=${ListDimension[${j}]} 127 # 128 if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then 129 # 130 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED" 100 131 echo 101 IGCM_debug_Print 1 "IGCM_post_Submit"102 echo103 IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}"104 fi105 106 #============ TIME SERIES POST-TREATMENT ===========#107 if [ ${TimeSeriesFrequency} = true ] ; then108 109 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED"110 echo111 112 113 114 # Get information from last execution115 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted116 CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}117 132 # 118 119 120 121 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 133 if [ X${Dimension} = X ] ; then 134 TsTask="empty" 135 Script_Post_Output=create_ts.${PeriodDateEnd} 136 else 137 TsTask=${Dimension} 138 Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask} 139 fi 122 140 # 123 jLoop=${#ListDimension[*]} 124 j=0 125 until [ $j -ge ${jLoop} ]; do 126 Dimension=${ListDimension[${j}]} 127 # 128 if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then 129 # 130 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED" 131 echo 132 # 133 if [ X${Dimension} = X ] ; then 134 TsTask="empty" 135 Script_Post_Output=create_ts.${PeriodDateEnd} 136 else 137 TsTask=${Dimension} 138 Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask} 139 fi 140 # 141 if [ ${RebuildFrequency} = true ] ; then 142 # 143 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 144 if [ X${MASTER} = Xtitane ] ; then 145 echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 146 fi 147 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 148 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 149 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 150 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 151 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 152 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 153 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 154 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 155 echo "export DateBegin=${DateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 156 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 157 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 158 echo "export CompletedFlag=${CompletedFlag} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 159 echo "export TsTask=${TsTask} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 160 echo "unset CompToRead " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 161 echo "unset FlagToRead " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 162 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 163 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 164 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 165 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 166 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 167 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 168 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 169 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 170 if [ X${MASTER} = Xtitane ] ; then 171 echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 172 echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 173 fi 174 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 175 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 176 echo "IGCM_sys_QsubPost create_ts " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 177 if [ X${MASTER} = Xtitane ] ; then 178 echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 179 fi 180 fi 181 # 182 else 183 # 184 IGCM_sys_RshPost <<-EOF 141 if [ ${RebuildFrequency} = true ] ; then 142 # 143 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 144 # if [ X${MASTER} = Xtitane ] ; then 145 # echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 146 # fi 147 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 148 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 149 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 150 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 151 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 152 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 153 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 154 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 155 echo "export DateBegin=${DateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 156 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 157 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 158 echo "export CompletedFlag=${CompletedFlag} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 159 echo "export TsTask=${TsTask} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 160 echo "unset CompToRead " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 161 echo "unset FlagToRead " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 162 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 163 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 164 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 165 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 166 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 167 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 168 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 169 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 170 # if [ X${MASTER} = Xtitane ] ; then 171 # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 172 # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 173 # fi 174 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 175 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 176 echo "IGCM_sys_QsubPost create_ts " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 177 # if [ X${MASTER} = Xtitane ] ; then 178 # echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 179 # fi 180 fi 181 else 182 IGCM_sys_RshPost <<-EOF 185 183 export DEBUG_debug=${DEBUG_debug} 186 184 export MODIPSL=${MODIPSL} … … 212 210 IGCM_sys_QsubPost create_ts 213 211 EOF 214 fi 212 fi 213 fi 214 # 215 if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then 216 # 217 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED" 218 echo 219 # Need to Remember This One 220 SavedDateBegin=${DateBegin} 221 # Kind of task create_ts will perform 222 TsTask=Chunck${Dimension} 223 # Number of chunck jobs to configure and submit 224 eval NbJob=\${#CHUNCK${Dimension}_COMP[@]} 225 typeset i 226 i=0 227 until [ $i -ge $NbJob ]; do 228 CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} ) 229 FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} ) 230 NameToRead=$( eval echo \${CHUNCK${Dimension}_NAME[\${i}]} ) 231 ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} ) 232 # Chunck Length (mandatory in Year) 233 YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" ) 234 # 235 IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin 236 # 237 IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd MonthEnd 238 # How many chunck in total since simulation began 239 NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} )) 240 # Tweak special case 241 [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 )) 242 # Starting Year of the current chunck 243 ChunckTsYearBegin=$(( ${NbYearsChunckLoop} * ${YearsChunckLength} + ${YearBegin} )) 244 # Starting date of the current chunck 245 ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01 246 # 247 Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead} 248 # 249 if [ ${RebuildFrequency} = true ] ; then 250 # 251 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 252 # if [ X${MASTER} = Xtitane ] ; then 253 # echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 254 # fi 255 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 256 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 257 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 258 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 259 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 260 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 261 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 262 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 263 echo "export DateBegin=${ChunckTsDateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 264 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 265 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 266 echo "export CompletedFlag=${CompletedFlag} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 267 echo "export TsTask=${TsTask} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 268 echo "export CompToRead=${CompToRead} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 269 echo "export FlagToRead=${FlagToRead} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 270 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 271 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 272 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 273 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 274 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 275 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 276 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 277 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 278 # if [ X${MASTER} = Xtitane ] ; then 279 # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 280 # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 281 # fi 282 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 283 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 284 echo "IGCM_sys_QsubPost create_ts " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 285 # if [ X${MASTER} = Xtitane ] ; then 286 # echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 287 # fi 215 288 fi 216 # 217 if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then 218 # 219 IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED" 220 echo 221 # Need to Remember This One 222 SavedDateBegin=${DateBegin} 223 # Kind of task create_ts will perform 224 TsTask=Chunck${Dimension} 225 # Number of chunck jobs to configure and submit 226 eval NbJob=\${#CHUNCK${Dimension}_COMP[@]} 227 typeset i 228 i=0 229 until [ $i -ge $NbJob ]; do 230 CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} ) 231 FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} ) 232 NameToRead=$( eval echo \${CHUNCK${Dimension}_NAME[\${i}]} ) 233 ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} ) 234 # Chunck Length (mandatory in Year) 235 YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" ) 236 # 237 IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin 238 # 239 IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd MonthEnd 240 # How many chunck in total since simulation began 241 NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} )) 242 # Tweak special case 243 [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 )) 244 # Starting Year of the current chunck 245 ChunckTsYearBegin=$(( ${NbYearsChunckLoop} * ${YearsChunckLength} + ${YearBegin} )) 246 # Starting date of the current chunck 247 ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01 248 # 249 Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead} 250 # 251 if [ ${RebuildFrequency} = true ] ; then 252 # 253 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 254 if [ X${MASTER} = Xtitane ] ; then 255 echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 256 fi 257 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 258 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 259 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 260 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 261 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 262 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 263 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 264 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 265 echo "export DateBegin=${ChunckTsDateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 266 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 267 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 268 echo "export CompletedFlag=${CompletedFlag} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 269 echo "export TsTask=${TsTask} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 270 echo "export CompToRead=${CompToRead} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 271 echo "export FlagToRead=${FlagToRead} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 272 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 273 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 274 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 275 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 276 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 277 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 278 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 279 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 280 if [ X${MASTER} = Xtitane ] ; then 281 echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 282 echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 283 fi 284 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 285 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 286 echo "IGCM_sys_QsubPost create_ts " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 287 if [ X${MASTER} = Xtitane ] ; then 288 echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 289 fi 290 fi 291 # 292 else 293 # 294 IGCM_sys_RshPost <<-EOF 289 else 290 IGCM_sys_RshPost <<-EOF 295 291 export DEBUG_debug=${DEBUG_debug} 296 292 export MODIPSL=${MODIPSL} … … 322 318 IGCM_sys_QsubPost create_ts 323 319 EOF 324 # 325 fi 326 # 327 export DateBegin=${SavedDateBegin} 328 # 329 (( i=i+1 )) 330 # 331 done 332 fi 333 (( j=j+1 )) 320 # 321 fi 322 # 323 export DateBegin=${SavedDateBegin} 324 # 325 (( i=i+1 )) 326 # 334 327 done 335 fi 336 337 #============= SEASONAL POST-TREATMENT ============# 338 if [ ${SeasonalFrequency} = true ] ; then 339 # 340 IGCM_debug_Print 1 "SEASONNAL POST-TREATMENT" 341 echo 328 fi 329 (( j=j+1 )) 330 done 331 fi 332 333 #============= SEASONAL POST-TREATMENT ============# 334 if [ ${SeasonalFrequency} = true ] ; then 335 # 336 IGCM_debug_Print 1 "SEASONNAL POST-TREATMENT" 337 echo 338 # 339 Script_Post_Output=create_se.${PeriodDateEnd} 340 # 341 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 342 343 if [ ${RebuildFrequency} = true ] ; then 344 # 345 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 342 346 # 343 Script_Post_Output=create_se.${PeriodDateEnd} 344 # 345 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 346 347 if [ ${RebuildFrequency} = true ] ; then 348 # 349 if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 350 # 351 if [ X${MASTER} = Xtitane ] ; then 352 echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 353 fi 354 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 355 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 356 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 357 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 358 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 359 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 360 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 361 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 362 echo "export DateBegin=${DateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 363 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 364 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 365 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 366 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 367 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 368 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 369 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 370 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 371 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 372 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 373 if [ X${MASTER} = Xtitane ] ; then 374 echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 375 echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 376 fi 377 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 378 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 379 echo "IGCM_sys_QsubPost create_se " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 380 if [ X${MASTER} = Xtitane ] ; then 381 echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 382 fi 383 # 384 fi 385 else 386 # 387 IGCM_sys_RshPost <<-EOF 347 # if [ X${MASTER} = Xtitane ] ; then 348 # echo "IGCM_sys_RshPost <<-EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 349 # fi 350 echo "export DEBUG_debug=${DEBUG_debug} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 351 echo "export MODIPSL=${MODIPSL} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 352 echo "export libIGCM_SX=${libIGCM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 353 echo "export libIGCM=${libIGCM_POST} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 354 echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 355 echo "export POST_DIR=${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 356 echo "export MASTER=${MASTER} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 357 echo "export RebuildFrequency=${RebuildFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 358 echo "export DateBegin=${DateBegin} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 359 echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 360 echo "export StandAlone=false " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 361 echo "export RESOL_ATM=${RESOL_ATM} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 362 echo "export RESOL_OCE=${RESOL_OCE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 363 echo "export RESOL_ICE=${RESOL_ICE} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 364 echo "export RESOL_MBG=${RESOL_MBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 365 echo "export RESOL_SRF=${RESOL_SRF} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 366 echo "export RESOL_SBG=${RESOL_SBG} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 367 echo "export listVarEnv=${listVarEnv} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 368 echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 369 # if [ X${MASTER} = Xtitane ] ; then 370 # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 371 # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 372 # fi 373 echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 374 echo "IGCM_debug_Verif_Exit_Post " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 375 echo "IGCM_sys_QsubPost create_se " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 376 # if [ X${MASTER} = Xtitane ] ; then 377 # echo "EOF" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 378 # fi 379 fi 380 else 381 IGCM_sys_RshPost <<-EOF 388 382 export DEBUG_debug=${DEBUG_debug} 389 383 export MODIPSL=${MODIPSL} … … 411 405 IGCM_sys_QsubPost create_se 412 406 EOF 413 #414 fi415 407 fi 416 417 #============== REBUILD POST-TREATMENT =============# 418 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 419 # ----------------------------------------------------------------------------------- 420 # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now 421 # ----------------------------------------------------------------------------------- 422 if [ ${DRYRUN} -le 1 ] ; then 423 echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 424 echo "} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 425 fi 426 if [ ${config_Post_RebuildFromArchive} = true ] ; then 427 IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR} 428 else 429 IGCM_sys_Mv REBUILD_${PeriodDateBegin} ${REBUILD_DIR} 430 fi 408 fi 409 410 #============== REBUILD POST-TREATMENT =============# 411 if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 412 # ----------------------------------------------------------------------------------- 413 # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now 414 # ----------------------------------------------------------------------------------- 415 if [ ${DRYRUN} -le 1 ] ; then 416 echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 417 echo "} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 431 418 fi 432 # 433 if [ ${RebuildFrequency} = true ] ; then 434 if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then 435 IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM ARCHIVE" 436 echo 437 # 438 script=rebuild_fromArchive 439 else 440 IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM WORKDIR" 441 echo 442 # 443 script=rebuild_fromWorkdir 444 fi 445 # 446 Script_Post_Output=${script}.${PeriodDateEnd} 447 # 448 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 449 IGCM_sys_RshPost <<-EOF 450 export DEBUG_debug=${DEBUG_debug} 451 export MODIPSL=${MODIPSL} 452 export libIGCM_SX=${libIGCM} 453 export libIGCM=${libIGCM_POST} 454 export SUBMIT_DIR=${SUBMIT_DIR} 455 export REBUILD_DIR=${REBUILD_DIR} 456 export POST_DIR=${POST_DIR} 457 export MASTER=${MASTER} 458 export RebuildFromArchive=${config_Post_RebuildFromArchive} 459 export DateBegin=${DateBegin} 460 export PeriodDateBegin=${PeriodDateBegin} 461 export PeriodDateEnd=${PeriodDateEnd} 462 export NbRebuildDir=${NbRebuildDir} 463 export StandAlone=false 464 export RESOL_ATM=${RESOL_ATM} 465 export RESOL_OCE=${RESOL_OCE} 466 export RESOL_ICE=${RESOL_ICE} 467 export RESOL_MBG=${RESOL_MBG} 468 export RESOL_SRF=${RESOL_SRF} 469 export RESOL_SBG=${RESOL_SBG} 470 export listVarEnv=${listVarEnv} 471 export Script_Post_Output=${Script_Post_Output} 472 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 473 . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 474 IGCM_sys_MkdirWork ${POST_DIR} 475 IGCM_debug_Verif_Exit_Post 476 IGCM_sys_QsubPost ${script} 419 if [ ${config_Post_RebuildFromArchive} = true ] ; then 420 IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR} 421 else 422 IGCM_sys_Mv REBUILD_${PeriodDateBegin} ${REBUILD_DIR} 423 fi 424 fi 425 # 426 if [ ${RebuildFrequency} = true ] ; then 427 if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then 428 IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM ARCHIVE" 429 echo 430 # 431 script=rebuild_fromArchive 432 else 433 IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM WORKDIR" 434 echo 435 # 436 script=rebuild_fromWorkdir 437 fi 438 # 439 Script_Post_Output=${script}.${PeriodDateEnd} 440 # 441 listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 442 IGCM_sys_RshPost <<-EOF 443 export DEBUG_debug=${DEBUG_debug} 444 export MODIPSL=${MODIPSL} 445 export libIGCM_SX=${libIGCM} 446 export libIGCM=${libIGCM_POST} 447 export SUBMIT_DIR=${SUBMIT_DIR} 448 export REBUILD_DIR=${REBUILD_DIR} 449 export POST_DIR=${POST_DIR} 450 export MASTER=${MASTER} 451 export RebuildFromArchive=${config_Post_RebuildFromArchive} 452 export DateBegin=${DateBegin} 453 export PeriodDateBegin=${PeriodDateBegin} 454 export PeriodDateEnd=${PeriodDateEnd} 455 export NbRebuildDir=${NbRebuildDir} 456 export StandAlone=false 457 export RESOL_ATM=${RESOL_ATM} 458 export RESOL_OCE=${RESOL_OCE} 459 export RESOL_ICE=${RESOL_ICE} 460 export RESOL_MBG=${RESOL_MBG} 461 export RESOL_SRF=${RESOL_SRF} 462 export RESOL_SBG=${RESOL_SBG} 463 export listVarEnv=${listVarEnv} 464 export Script_Post_Output=${Script_Post_Output} 465 . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 466 . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 467 IGCM_sys_MkdirWork ${POST_DIR} 468 IGCM_debug_Verif_Exit_Post 469 IGCM_sys_QsubPost ${script} 477 470 EOF 478 479 fi 480 481 IGCM_debug_PopStack "IGCM_post_Submit" 471 fi 472 473 IGCM_debug_PopStack "IGCM_post_Submit" 482 474 } 483 475 … … 485 477 function IGCM_post_CheckModuloFrequency 486 478 { 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 479 IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $* 480 481 # Used by IGCM_config_Check 482 # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d) 483 # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero 484 # Input parameter are the name of the variable, not the frequency value itself 485 # example 486 # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 487 488 typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 489 490 # Get the name of the variable 491 MasterName=$1 492 SlaveName=$2 493 # Get the value the above name points to 494 MasterFrequency=$( eval echo \${${1}} ) 495 SlaveFrequency=$( eval echo \${${2}} ) 496 497 IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" 498 499 case ${MasterFrequency} in 500 *y|*Y) 501 PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 502 case ${SlaveFrequency} in 503 *Y|*y) 504 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 505 if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \ 506 [ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] ); then 507 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 508 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 509 IGCM_debug_Exit "Check your frequency" 510 fi ;; 511 *M|*m) 512 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 513 if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ 514 [ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then 515 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 516 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 517 IGCM_debug_Exit "Check your frequency" 518 fi ;; 519 *D|*d) 520 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 521 NbDays=$( IGCM_date_DaysInYear ${year} ) 522 if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then 523 if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \ 524 [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then 525 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 526 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 527 IGCM_debug_Exit "Check your frequency" 528 fi 529 else 530 IGCM_debug_Print 1 "For ${MasterName} with leap calendar:" 531 IGCM_debug_Print 1 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}" 532 IGCM_debug_Print 1 "No post-treatment. Case not properly handle at this moment by libIGCM. Sorry" 533 IGCM_debug_Exit "Check your frequency ${MasterName} and choose a daily frequency for this one too." 534 fi ;; 535 esac ;; 536 *M|*m) 537 PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 538 case ${SlaveFrequency} in 539 *Y|*y) 540 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 541 if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ 542 [ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then 543 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 544 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 545 IGCM_debug_Exit "Check your frequency" 546 fi ;; 547 *M|*m) 548 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 549 if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ 550 [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then 551 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 552 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 553 IGCM_debug_Exit "Check your frequency" 554 fi ;; 555 *D|*d) 556 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 557 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 558 IGCM_debug_Exit "Check your frequency" ;; 559 esac ;; 560 *D|*d) 561 PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 562 case ${SlaveFrequency} in 563 *Y|*y) 564 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 565 IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" 566 IGCM_debug_Exit "Check your frequency" ;; 567 *M|*m) 568 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 569 IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" 570 IGCM_debug_Exit "Check your frequency" ;; 571 *D|*d) 572 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 573 if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \ 574 [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ; then 575 IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 576 IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" 577 IGCM_debug_Exit "Check your frequency" 578 fi ;; 579 esac ;; 580 NONE|none) 581 ;; 582 *) 583 IGCM_debug_Print 1 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card" 584 IGCM_debug_Exit "Check your ${MasterName} in config.card" ;; 585 esac 586 587 IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" 596 588 } 597 589 … … 599 591 function IGCM_post_ModuloRuntimeFrequency 600 592 { 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 593 IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $* 594 595 # Used by IGCM_post_Configure 596 # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and 597 # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d) 598 # --> turn on post-processing submission when their modulo is zero 599 # Input parameter are the name of the variable, not the frequency value itself 600 # example 601 # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength 602 603 typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 604 605 # Get the name of the variable 606 MasterName=$1 607 SlaveName=$2 608 609 # Get the value the above name points to 610 eval MasterFrequency=\${${1}} 611 eval SlaveFrequency=\${${2}} 612 613 echo 614 IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" 615 616 case ${MasterFrequency} in 617 *y|*Y) 618 PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 619 case ${SlaveFrequency} in 620 *Y|*y) 621 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 622 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ; then 623 if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then 624 eval ${post_freq}=true ; POST=true 625 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) 626 fi 627 fi;; 628 *M|*m) 629 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 630 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then 631 if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then 632 eval ${post_freq}=true ; POST=true 633 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) 634 fi 635 fi;; 636 *D|*d) 637 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 638 NbDays=$( IGCM_date_DaysInYear ${year} ) 639 if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then 640 if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then 641 eval ${post_freq}=true ; POST=true 642 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} )) 643 fi 644 fi;; 645 esac ;; 646 *M|*m) 647 PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 648 case ${SlaveFrequency} in 649 *Y|*y) 650 PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 651 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then 652 if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then 653 eval ${post_freq}=true ; POST=true 654 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) 655 fi 656 fi;; 657 *M|*m) 658 PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 659 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ; then 660 if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} )) -ne 0 ] ; then 661 eval ${post_freq}=true ; POST=true 662 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) 663 fi 664 fi;; 665 *D|*d) 666 IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 667 IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; 668 esac ;; 669 *D|*d) 670 PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 671 case ${SlaveFrequency} in 672 *Y|*y) 673 IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 674 IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; 675 *M|*m) 676 IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 677 IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; 678 *D|*d) 679 PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 680 if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ; then 681 if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then 682 eval ${post_freq}=true ; POST=true 683 [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) 684 fi 685 fi;; 686 esac ;; 687 NONE|none) 688 ;; 689 *) 690 IGCM_debug_Print 1 "KeyWord not allowed for ${post_freq} in config.card" 691 ;; 692 esac 693 694 IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" 703 695 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh
r520 r544 121 121 122 122 #==================================================== 123 #- OUT123 #- R_OUT 124 124 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 125 125 126 126 #==================================================== 127 #- OUT_SCR(ONLY FOR double copy an scratch)128 typeset -r R_ OUT_SCR=${SCRATCHDIR}/IGCM_OUT127 #- R_BUF (ONLY FOR double copy an scratch) 128 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 129 129 130 130 #==================================================== … … 151 151 #D- 152 152 function IGCM_sys_RshMaster { 153 154 155 156 157 158 159 160 161 162 153 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 154 typeset NB_ESSAI DELAI status i 155 # number of tentative 156 NB_ESSAI=10 157 # time delay between tentative 158 DELAI=10 159 # 160 (( i = 0 )) 161 while [ $i -lt $NB_ESSAI ] ; do 162 ssh ${MASTER} exec /bin/ksh <<-EOF 163 163 export libIGCM=${libIGCM_SX} 164 164 export DEBUG_debug=${DEBUG_debug} … … 167 167 ${@} 168 168 EOF 169 170 171 172 173 174 175 176 177 178 179 180 169 status=$? 170 if [ ${status} -gt 0 ]; then 171 IGCM_debug_Print 2 "IGCM_sys_RshMaster : ssh failed ${i}/${NB_ESSAI}" 172 IGCM_debug_Print 2 "IGCM_sys_RshMaster : sleep ${DELAI} seconds and try again." 173 sleep $DELAI 174 else 175 break 176 fi 177 (( i = i + 1 )) 178 done 179 180 IGCM_debug_PopStack "IGCM_sys_RshMaster" 181 181 } 182 182 … … 187 187 #D- 188 188 function IGCM_sys_RshArchive { 189 190 189 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 190 /bin/ksh <<-EOF 191 191 ${@} 192 192 EOF 193 194 195 196 197 193 if [ $? -gt 0 ] ; then 194 echo "IGCM_sys_RshArchive : erreur." 195 IGCM_debug_Exit "IGCM_sys_RshArchive" 196 fi 197 IGCM_debug_PopStack "IGCM_sys_RshArchive" 198 198 } 199 199 … … 204 204 #D- 205 205 function IGCM_sys_RshPost { 206 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 207 if ( $DEBUG_sys ) ; then 208 echo "IGCM_sys_RshPost :" $@ 209 fi 210 /bin/ksh ${@} 211 if [ $? -gt 0 ] ; then 212 echo "IGCM_sys_RshPost : erreur." 213 IGCM_debug_Exit "IGCM_sys_RshPost" 214 fi 215 IGCM_debug_PopStack "IGCM_sys_RshPost" 206 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 207 if ( $DEBUG_sys ) ; then 208 echo "IGCM_sys_RshPost :" $@ 209 fi 210 211 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 212 #cat tmp_IGCM_sys_RshPost_$$ 213 # keep standard input (stdin) for the loop onto temporary file 214 cat >tmp_IGCM_sys_RshPost_$$ 215 216 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 217 if [ $? -gt 0 ] ; then 218 echo "IGCM_sys_RshPost : erreur." 219 IGCM_debug_Exit "IGCM_sys_RshPost" 220 cat tmp_IGCM_sys_RshPost_$$ 221 fi 222 # delete temporary file 223 \rm tmp_IGCM_sys_RshPost_$$ 224 225 IGCM_debug_PopStack "IGCM_sys_RshPost" 216 226 } 217 227 … … 222 232 #D- 223 233 function IGCM_sys_SendMail { 224 225 226 227 228 229 230 231 232 233 234 235 234 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 235 if ( $DEBUG_sys ) ; then 236 echo "IGCM_sys_SendMail :" $@ 237 fi 238 239 if ( ${ExitFlag} ) ; then 240 status=failed 241 else 242 status=completed 243 fi 244 245 ssh mercure <<-EOF 236 246 export LOGIN=${LOGIN} 237 247 export config_UserChoices_JobName=${config_UserChoices_JobName} … … 262 272 EOF 263 273 264 265 266 267 268 274 if [ $? -gt 0 ] ; then 275 echo "IGCM_sys_SendMail : erreur." 276 IGCM_debug_Exit "IGCM_sys_SendMail" 277 fi 278 IGCM_debug_PopStack "IGCM_sys_SendMail" 269 279 } 270 280 … … 275 285 #D- 276 286 function IGCM_sys_Mkdir { 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 287 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 288 if ( $DEBUG_sys ) ; then 289 echo "IGCM_sys_Mkdir :" $@ 290 fi 291 if [ ! -d ${1} ]; then 292 \mkdir -p $1 293 if [ $? -gt 0 ] ; then 294 echo "IGCM_sys_Mkdir : erreur." 295 IGCM_debug_Exit "IGCM_sys_Mkdir" 296 fi 297 fi 298 # vérification : 299 if [ ! -d ${1} ] ; then 300 echo "IGCM_sys_Mkdir : erreur." 301 IGCM_debug_Exit "IGCM_sys_Mkdir" 302 fi 303 IGCM_debug_PopStack "IGCM_sys_Mkdir" 294 304 } 295 305 … … 300 310 #D- 301 311 function IGCM_sys_MkdirArchive { 302 303 304 305 306 307 308 309 310 311 312 313 314 312 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 313 if ( $DEBUG_sys ) ; then 314 echo "IGCM_sys_MkdirArchive :" $@ 315 fi 316 #- creation de repertoire sur le serveur fichier 317 if [ ! -d ${1} ]; then 318 \mkdir -p $1 319 if [ $? -gt 0 ] ; then 320 echo "IGCM_sys_MkdirArchive : erreur." 321 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 322 fi 323 fi 324 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 315 325 } 316 326 … … 321 331 #D- 322 332 function IGCM_sys_MkdirWork { 323 324 325 326 327 328 329 330 331 332 333 334 335 333 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 334 if ( $DEBUG_sys ) ; then 335 echo "IGCM_sys_MkdirWork :" $@ 336 fi 337 #- creation de repertoire sur le serveur fichier 338 if [ ! -d ${1} ]; then 339 \mkdir -p $1 340 if [ $? -gt 0 ] ; then 341 echo "IGCM_sys_MkdirWork : erreur." 342 IGCM_debug_Exit "IGCM_sys_MkdirWork" 343 fi 344 fi 345 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 336 346 } 337 347 … … 342 352 #D- 343 353 function IGCM_sys_Cd { 344 345 346 347 348 349 350 351 352 353 354 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 355 if ( $DEBUG_sys ) ; then 356 echo "IGCM_sys_Cd :" $@ 357 fi 358 \cd $1 359 if [ $? -gt 0 ] ; then 360 echo "IGCM_sys_Cd : erreur." 361 IGCM_debug_Exit "IGCM_sys_Cd" 362 fi 363 IGCM_debug_PopStack "IGCM_sys_Cd" 354 364 } 355 365 … … 360 370 #D- 361 371 function IGCM_sys_Chmod { 362 363 364 365 366 367 368 369 370 371 372 373 374 375 372 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 373 if ( $DEBUG_sys ) ; then 374 echo "IGCM_sys_Chmod :" $@ 375 fi 376 if [ $DRYRUN -le 1 ]; then 377 \chmod $@ 378 if [ $? -gt 0 ] ; then 379 echo "IGCM_sys_Chmod : erreur." 380 IGCM_debug_Exit "IGCM_sys_Chmod" 381 fi 382 else 383 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 384 fi 385 IGCM_debug_PopStack "IGCM_sys_Chmod" 376 386 } 377 387 … … 382 392 #D- 383 393 function IGCM_sys_FileSize { 384 385 386 387 388 389 390 391 392 393 394 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 395 396 typeset sizeF 397 set +A sizeF -- $( ls -la ${1} ) 398 if [ $? -gt 0 ] ; then 399 IGCM_debug_Exit "IGCM_sys_FileSize" 400 fi 401 eval ${2}=${sizeF[4]} 402 403 IGCM_debug_PopStack "IGCM_sys_FileSize" 394 404 } 395 405 … … 400 410 #D- 401 411 function IGCM_sys_TestDir { 402 403 404 405 406 407 408 409 410 412 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 413 if ( $DEBUG_sys ) ; then 414 echo "IGCM_sys_TestDir :" $@ 415 fi 416 typeset ExistFlag 417 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 418 IGCM_debug_PopStack "IGCM_sys_TestDir" 419 420 return ${ExistFlag} 411 421 } 412 422 … … 417 427 #D- 418 428 function IGCM_sys_TestDirArchive { 419 420 421 422 423 424 425 426 427 429 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 430 if ( $DEBUG_sys ) ; then 431 echo "IGCM_sys_TestDirArchive :" $@ 432 fi 433 typeset ExistFlag 434 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 435 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 436 437 return ${ExistFlag} 428 438 } 429 439 … … 434 444 #D- 435 445 function IGCM_sys_TestFileArchive { 436 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 437 if ( $DEBUG_sys ) ; then 438 echo "IGCM_sys_TestFileArchive :" $@ 439 fi 440 typeset ExistFlag 441 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 442 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 443 444 return ${ExistFlag} 446 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 447 if ( $DEBUG_sys ) ; then 448 echo "IGCM_sys_TestFileArchive :" $@ 449 fi 450 typeset ExistFlag 451 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 452 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 453 454 return ${ExistFlag} 455 } 456 457 #D-#================================================== 458 #D-function IGCM_sys_TestFileBuffer 459 #D-* Purpose: Test file that must NOT EXISTS on Buffer 460 #D-* Examples: 461 #D- 462 function IGCM_sys_TestFileBuffer { 463 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 464 typeset ExistFlag 465 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 466 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 467 468 return ${ExistFlag} 445 469 } 446 470 … … 451 475 #D- 452 476 function IGCM_sys_CountFileArchive { 453 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 454 ls ${@} 2>/dev/null | wc -l 455 if [ $? -gt 0 ] ; then 456 echo "IGCM_sys_CountFileArchive : erreur." 457 fi 458 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 477 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 478 ls ${@} 2>/dev/null | wc -l 479 if [ $? -gt 0 ] ; then 480 echo "IGCM_sys_CountFileArchive : erreur." 481 fi 482 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 483 } 484 485 #D-#================================================== 486 #D-function IGCM_sys_CountFileBuffer 487 #D-* Purpose: Count files on Master Scratch filesystem 488 #D-* Examples: 489 #D- 490 function IGCM_sys_CountFileBuffer { 491 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 492 ls ${@} 2>/dev/null | wc -l 493 if [ $? -gt 0 ] ; then 494 echo "IGCM_sys_CountFileBuffer : erreur." 495 fi 496 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 459 497 } 460 498 … … 465 503 #D- 466 504 function IGCM_sys_Tree { 467 468 469 470 471 472 473 474 505 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 506 if ( $DEBUG_sys ) ; then 507 echo "IGCM_sys_Tree :" $@ 508 fi 509 510 \tree -f $@ 511 512 IGCM_debug_PopStack "IGCM_sys_Tree" 475 513 } 476 514 477 515 #D-#================================================== 478 516 #D-function IGCM_sys_Tar 479 #D-* Purpose: master un-tar command517 #D-* Purpose: master tar command 480 518 #D-* Examples: 481 519 #D- 482 520 function IGCM_sys_Tar { 483 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 484 if ( $DEBUG_sys ) ; then 485 echo "IGCM_sys_Tar :" $@ 486 fi 487 \tar cvf $@ 488 if [ $? -gt 0 ] ; then 489 echo "IGCM_sys_Tar : erreur." 490 IGCM_debug_Exit "IGCM_sys_Tar" 491 fi 492 \tar tvf $1 493 494 IGCM_debug_PopStack "IGCM_sys_Tar" 521 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 522 if ( $DEBUG_sys ) ; then 523 echo "IGCM_sys_Tar :" $@ 524 fi 525 \tar cf $@ 526 if [ $? -gt 0 ] ; then 527 echo "IGCM_sys_Tar : erreur." 528 IGCM_debug_Exit "IGCM_sys_Tar" 529 fi 530 IGCM_debug_PopStack "IGCM_sys_Tar" 495 531 } 496 532 … … 501 537 #D- 502 538 function IGCM_sys_UnTar { 503 504 505 506 507 508 509 510 511 512 539 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 540 if ( $DEBUG_sys ) ; then 541 echo "IGCM_sys_UnTar :" $@ 542 fi 543 \tar xvf $1 544 if [ $? -gt 0 ] ; then 545 echo "IGCM_sys_UnTar : erreur." 546 IGCM_debug_Exit "IGCM_sys_UnTar" 547 fi 548 IGCM_debug_PopStack "IGCM_sys_UnTar" 513 549 } 514 550 … … 519 555 #D- 520 556 function IGCM_sys_Qsub { 521 522 523 524 525 526 527 528 529 530 557 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 558 if ( $DEBUG_sys ) ; then 559 echo "IGCM_sys_Qsub :" $@ 560 fi 561 /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output}.e < $1 562 if [ $? -gt 0 ] ; then 563 echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -e ${Script_Output}.e $@" 564 IGCM_debug_Exit "IGCM_sys_Qsub" 565 fi 566 IGCM_debug_PopStack "IGCM_sys_Qsub" 531 567 } 532 568 … … 537 573 #D- 538 574 function IGCM_sys_QsubPost { 539 540 541 542 543 544 545 546 547 548 575 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 576 if ( $DEBUG_sys ) ; then 577 echo "IGCM_sys_QsubPost :" $@ 578 fi 579 /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM}/$1.job 580 if [ $? -gt 0 ] ; then 581 echo "IGCM_sys_QsubPost : erreur " $@ 582 IGCM_debug_Exit "IGCM_sys_QsubPost" 583 fi 584 IGCM_debug_PopStack "IGCM_sys_QsubPost" 549 585 } 550 586 … … 560 596 #D- Error values and explanations can depend on your system version. 561 597 function IGCM_sys_Rsync_out { 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 } 665 598 RET=$1 599 if [ ! $RET ] ; then 600 echo "rsync error !" 601 fi 602 603 if [ $MYLANG = "fr" ]; then 604 case $RET in 605 0) return ;; 606 1) echo "Erreur de rsync ; RERR_SYNTAX : " 607 echo "Erreur de syntaxe ou d'utilisation." 608 return;; 609 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 610 echo "Incompatibilité de protocole." 611 return;; 612 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 613 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 614 echo "répertoires" 615 return;; 616 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 617 echo "Action demandée non supportée : une tentative de manipulation de" 618 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 619 echo "été faite ; ou une option qui est supportée par le client mais" 620 echo "pas par le serveur a été spécifiée." 621 return;; 622 10) echo "Erreur de rsync ; RERR_SOCKETIO" 623 echo "Erreur dans le socket d'entrée sortie" 624 return;; 625 11) echo "Erreur de rsync ; RERR_FILEIO" 626 echo "Erreur d'entrée sortie fichier" 627 return;; 628 12) echo "Erreur de rsync ; RERR_STREAMIO" 629 echo "Erreur dans flux de donnée du protocole rsync" 630 return;; 631 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 632 echo "Erreur avec les diagnostics du programme" 633 return;; 634 14) echo "Erreur de rsync ; RERR_IPC" 635 echo "Erreur dans le code IPC" 636 return;; 637 20) echo "Erreur de rsync ; RERR_SIGNAL" 638 echo "SIGUSR1 ou SIGINT reçu" 639 return;; 640 21) echo "Erreur de rsync ; RERR_WAITCHILD" 641 echo "Une erreur retournée par waitpid()" 642 return;; 643 22) echo "Erreur de rsync ; RERR_MALLOC" 644 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 645 return;; 646 23) echo "" 647 echo "Erreur fichier inexistant" 648 return;; 649 30) echo "Erreur de rsync ; RERR_TIMEOUT" 650 echo "Temps d'attente écoulé dans l'envoi/réception de données" 651 return;; 652 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 653 return;; 654 esac 655 elif [ $MYLANG = "en" ] ; then 656 case $RET in 657 0) return;; 658 1) echo "rsync error : Syntax or usage error " 659 return;; 660 2) echo "rsync error : Protocol incompatibility " 661 return;; 662 3) echo "rsync error : Errors selecting input/output files, dirs" 663 return;; 664 4) echo "rsync error : Requested action not supported: an attempt" 665 echo "was made to manipulate 64-bit files on a platform that cannot support" 666 echo "them; or an option was specified that is supported by the client and" 667 echo "not by the server." 668 return;; 669 5) echo "rsync error : Error starting client-server protocol" 670 return;; 671 10) echo "rsync error : Error in socket I/O " 672 return;; 673 11) echo "rsync error : Error in file I/O " 674 return;; 675 12) echo "rsync error : Error in rsync protocol data stream " 676 return;; 677 13) echo "rsync error : Errors with program diagnostics " 678 return;; 679 14) echo "rsync error : Error in IPC code " 680 return;; 681 20) echo "rsync error : Received SIGUSR1 or SIGINT " 682 return;; 683 21) echo "rsync error : Some error returned by waitpid() " 684 return;; 685 22) echo "rsync error : Error allocating core memory buffers " 686 return;; 687 23) echo "rsync error : Partial transfer due to error" 688 return;; 689 24) echo "rsync error : Partial transfer due to vanished source files" 690 return;; 691 30) echo "rsync error : Timeout in data send/receive " 692 return;; 693 *) echo "rsync error : return code of rsync unknown :" $RET 694 return;; 695 esac 696 else 697 echo "unknown language $MYLANG." 698 return 699 fi 700 } 701 666 702 #D-#================================================== 667 703 #D-function IGCM_sys_Cp … … 670 706 #D- 671 707 function IGCM_sys_Cp { 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 708 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 709 if ( $DEBUG_sys ) ; then 710 echo "IGCM_sys_Cp :" $@ 711 fi 712 713 typeset RET 714 715 echo cp $@ > out_rsync 2>&1 716 \cp $@ >> out_rsync 2>&1 717 RET=$? 718 719 if [ ${RET} -gt 0 ] ; then 720 echo "IGCM_sys_Cp : error." 721 cat out_rsync 722 IGCM_debug_Exit "IGCM_sys_Cp" 723 else 724 \rm out_rsync 725 fi 726 IGCM_debug_PopStack "IGCM_sys_Cp" 691 727 } 692 728 … … 697 733 #D- 698 734 function IGCM_sys_Rm { 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 735 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 736 if ( $DEBUG_sys ) ; then 737 echo "IGCM_sys_Rm :" $@ 738 fi 739 740 typeset RET 741 742 echo rm $@ > out_rsync 2>&1 743 \rm $@ >> out_rsync 2>&1 744 RET=$? 745 746 if [ ${RET} -gt 0 ] ; then 747 echo "IGCM_sys_Rm : error." 748 cat out_rsync 749 IGCM_debug_Exit "IGCM_sys_Rm" 750 else 751 \rm out_rsync 752 fi 753 IGCM_debug_PopStack "IGCM_sys_Rm" 718 754 } 719 755 … … 725 761 #D- 726 762 function IGCM_sys_RmRunDir { 727 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 728 if ( $DEBUG_sys ) ; then 729 echo "IGCM_sys_RmRunDir :" $@ 730 fi 731 732 typeset RET 733 734 echo rm $@ > out_rsync 2>&1 735 \rm $@ >> out_rsync 2>&1 736 RET=$? 737 738 if [ ${RET} -gt 0 ] ; then 739 echo "IGCM_sys_RmRunDir : error." 740 cat out_rsync 741 IGCM_debug_Exit "IGCM_sys_RmRunDir" 742 else 743 \rm out_rsync 744 fi 745 746 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 763 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 764 if ( $DEBUG_sys ) ; then 765 echo "IGCM_sys_RmRunDir :" $@ 766 fi 767 768 typeset RET 769 770 echo rm $@ > out_rsync 2>&1 771 \rm $@ >> out_rsync 2>&1 772 RET=$? 773 774 if [ ${RET} -gt 0 ] ; then 775 echo "IGCM_sys_RmRunDir : error." 776 cat out_rsync 777 IGCM_debug_Exit "IGCM_sys_RmRunDir" 778 else 779 \rm out_rsync 780 fi 781 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 747 782 } 748 783 … … 753 788 #D- 754 789 function IGCM_sys_Mv { 755 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 756 if ( $DEBUG_sys ) ; then 757 echo "IGCM_sys_Mv :" $@ 758 fi 759 760 if [ $DRYRUN = 0 ]; then 761 762 typeset RET 763 764 echo mv $@ > out_rsync 2>&1 765 \mv $@ >> out_rsync 2>&1 766 RET=$? 790 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 791 if ( $DEBUG_sys ) ; then 792 echo "IGCM_sys_Mv :" $@ 793 fi 794 795 if [ $DRYRUN = 0 ]; then 796 797 typeset RET 767 798 768 if [ ${RET} -gt 0 ] ; then 769 echo "IGCM_sys_Mv : error in mv." 770 cat out_rsync 771 IGCM_debug_Exit "IGCM_sys_Mv" 772 else 773 \rm out_rsync 774 fi 799 echo mv $@ > out_rsync 2>&1 800 \mv $@ >> out_rsync 2>&1 801 RET=$? 802 803 if [ ${RET} -gt 0 ] ; then 804 echo "IGCM_sys_Mv : error in mv." 805 cat out_rsync 806 IGCM_debug_Exit "IGCM_sys_Mv" 775 807 else 776 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 777 fi 778 779 IGCM_debug_PopStack "IGCM_sys_Mv" 808 \rm out_rsync 809 fi 810 else 811 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 812 fi 813 814 IGCM_debug_PopStack "IGCM_sys_Mv" 780 815 } 781 816 … … 786 821 #D- 787 822 function IGCM_sys_Put_Dir { 788 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 789 if ( $DEBUG_sys ) ; then 790 echo "IGCM_sys_Put_Dir :" $@ 791 fi 792 if [ $DRYRUN = 0 ]; then 793 if [ ! -d ${1} ] ; then 794 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 795 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 796 return 797 fi 798 799 typeset RET 800 801 # Only if we use rsync 802 #IGCM_sys_TestDirArchive $( dirname $2 ) 803 # 804 #USUAL WAY 805 \cp -r $1 $2 > out_rsync 2>&1 806 RET=$? 807 808 if [ ${RET} -gt 0 ] ; then 809 echo "IGCM_sys_Put_Dir : error." 810 cat out_rsync 811 IGCM_debug_Exit "IGCM_sys_Put_Dir" 812 else 813 \rm out_rsync 814 fi 823 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 824 if ( $DEBUG_sys ) ; then 825 echo "IGCM_sys_Put_Dir :" $@ 826 fi 827 if [ $DRYRUN = 0 ]; then 828 if [ ! -d ${1} ] ; then 829 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 830 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 831 return 832 fi 833 834 typeset RET 835 836 # Only if we use rsync 837 #IGCM_sys_TestDirArchive $( dirname $2 ) 838 # 839 #USUAL WAY 840 \cp -r $1 $2 > out_rsync 2>&1 841 RET=$? 842 843 if [ ${RET} -gt 0 ] ; then 844 echo "IGCM_sys_Put_Dir : error." 845 cat out_rsync 846 IGCM_debug_Exit "IGCM_sys_Put_Dir" 815 847 else 816 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 817 fi 818 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 848 \rm out_rsync 849 fi 850 else 851 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 852 fi 853 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 819 854 } 820 855 821 856 #D-#================================================== 822 857 #D-function IGCM_sys_Get_Dir 823 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)858 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 824 859 #D-* Examples: 825 860 #D- 826 861 function IGCM_sys_Get_Dir { 827 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 828 if ( $DEBUG_sys ) ; then 829 echo "IGCM_sys_Get_Dir :" $@ 830 fi 831 if [ $DRYRUN = 0 ]; then 832 # if [ ! -d ${1} ] ; then 833 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 834 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 835 # return 836 # fi 837 838 typeset RET 839 840 # Only if we use rsync 841 #IGCM_sys_TestDirArchive $( dirname $2 ) 842 # 843 #USUAL WAY 844 # add dmget (to demigrate all offline files) to reduce time of this command : 845 dmget $1/* 846 \cp -r $1 $2 > out_rsync 2>&1 847 RET=$? 848 849 if [ ${RET} -gt 0 ] ; then 850 echo "IGCM_sys_Get_Dir : error." 851 cat out_rsync 852 IGCM_debug_Exit "IGCM_sys_Get_Dir" 853 else 854 \rm out_rsync 855 fi 862 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 863 if ( $DEBUG_sys ) ; then 864 echo "IGCM_sys_Get_Dir :" $@ 865 fi 866 if [ $DRYRUN = 0 ]; then 867 # if [ ! -d ${1} ] ; then 868 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 869 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 870 # return 871 # fi 872 873 typeset RET 874 875 # Only if we use rsync 876 #IGCM_sys_TestDirArchive $( dirname $2 ) 877 # 878 # USUAL WAY 879 # add dmfind/dmget (to demigrate all offline files) : 880 dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 881 \cp -r $1 $2 > out_rsync 2>&1 882 RET=$? 883 884 if [ ${RET} -gt 0 ] ; then 885 echo "IGCM_sys_Get_Dir : error." 886 cat out_rsync 887 IGCM_debug_Exit "IGCM_sys_Get_Dir" 856 888 else 857 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 858 fi 859 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 889 \rm out_rsync 890 fi 891 else 892 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 893 fi 894 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 860 895 } 861 896 … … 866 901 #D- 867 902 function IGCM_sys_Get_Master { 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 903 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 904 if ( $DEBUG_sys ) ; then 905 echo "IGCM_sys_Get_Master :" $@ 906 fi 907 if [ $DRYRUN = 0 ]; then 908 909 typeset TEST NB_ESSAI DELAI status i 910 911 TEST=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 ) 912 if [ ${TEST} -ne 1 ] ; then 913 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}." 914 IGCM_debug_PopStack "IGCM_sys_Get_Master" 915 return 916 fi 917 918 # number of tentative 919 NB_ESSAI=10 920 # time delay between tentative 921 DELAI=10 922 # 923 (( i = 0 )) 924 while [ $i -lt $NB_ESSAI ] ; do 890 925 #USUAL WAY 891 scp -r ${MASTER}:$1 $2 > out_rsync 2>&1 892 status=$? 893 if [ ${status} -gt 0 ]; then 894 IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}" 895 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 896 sleep $DELAI 897 else 898 break 899 fi 900 (( i = i + 1 )) 901 done 902 903 if [ ${status} -gt 0 ] ; then 904 echo "IGCM_sys_Get_Master : error." 905 cat out_rsync 906 IGCM_debug_Exit "IGCM_sys_Get_Master" 907 else 908 \rm out_rsync 909 fi 926 scp -r ${MASTER}:$1 $2 > out_rsync 2>&1 927 status=$? 928 if [ ${status} -gt 0 ]; then 929 IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}" 930 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 931 sleep $DELAI 932 else 933 break 934 fi 935 (( i = i + 1 )) 936 done 937 938 if [ ${status} -gt 0 ] ; then 939 echo "IGCM_sys_Get_Master : error." 940 cat out_rsync 941 IGCM_debug_Exit "IGCM_sys_Get_Master" 910 942 else 911 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 912 fi 913 IGCM_debug_PopStack "IGCM_sys_Get_Master" 943 \rm out_rsync 944 fi 945 else 946 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 947 fi 948 IGCM_debug_PopStack "IGCM_sys_Get_Master" 914 949 } 915 950 916 951 #D-#================================================== 917 952 #D-function IGCM_sys_Put_Rest 918 #D-* Purpose: Put computied restarts on $ (ARCHIVE).953 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 919 954 #D- File and target directory must exist. 920 955 #D-* Examples: 921 956 #D- 922 957 function IGCM_sys_Put_Rest { 923 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 924 if ( $DEBUG_sys ) ; then 925 echo "IGCM_sys_Put_Rest :" $@ 926 fi 927 if [ $DRYRUN = 0 ]; then 928 if [ ! -f ${1} ] ; then 929 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 930 IGCM_debug_Exit "IGCM_sys_Put_Rest" 931 fi 932 933 typeset RET 934 # 935 if [ X${JobType} = XRUN ] ; then 936 IGCM_sys_Chmod 444 ${1} 937 fi 938 # 939 IGCM_sys_TestDirArchive $( dirname $2 ) 940 # 941 # USUAL WAY 942 \cp $1 $2 > out_rsync 2>&1 943 RET=$? 958 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 959 if ( $DEBUG_sys ) ; then 960 echo "IGCM_sys_Put_Rest :" $@ 961 fi 962 if [ $DRYRUN = 0 ]; then 963 if [ ! -f ${1} ] ; then 964 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 965 IGCM_debug_Exit "IGCM_sys_Put_Rest" 966 fi 967 968 typeset RET 969 # 970 if [ X${JobType} = XRUN ] ; then 971 IGCM_sys_Chmod 444 ${1} 972 fi 973 974 # 975 # USUAL WAY 976 \cp $1 $2 > out_rsync 2>&1 977 RET=$? 944 978 945 979 # #RSYNC WITH NETWORK SSH CALL 946 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${ RHOST}:${2} > out_rsync 2>&1947 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${ RHOST}:${2} >> out_rsync 2>&1980 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 981 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 948 982 949 983 # #RSYNC WITH NFS USE … … 957 991 # (( RET=RET+$? )) 958 992 959 if [ ${RET} -gt 0 ] ; then 960 echo "IGCM_sys_Put_Rest : error." 961 cat out_rsync 962 IGCM_debug_Exit "IGCM_sys_Put_Rest" 963 else 964 \rm out_rsync 965 fi 993 if [ ${RET} -gt 0 ] ; then 994 echo "IGCM_sys_Put_Rest : error." 995 cat out_rsync 996 IGCM_debug_Exit "IGCM_sys_Put_Rest" 966 997 else 967 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 968 fi 969 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 998 \rm out_rsync 999 fi 1000 else 1001 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1002 fi 1003 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 970 1004 } 971 1005 972 1006 #D-#================================================== 973 1007 #D-function IGCM_sys_Put_Out 974 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1008 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 975 1009 #D-* Examples: 976 1010 #D- 977 1011 function IGCM_sys_Put_Out { 978 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 979 if ( $DEBUG_sys ) ; then 980 echo "IGCM_sys_Put_Out :" $@ 981 fi 982 if [ $DRYRUN = 0 ]; then 983 if [ ! -f ${1} ] ; then 984 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 985 IGCM_debug_PopStack "IGCM_sys_Put_Out" 986 return 1 987 fi 988 # 989 IGCM_sys_MkdirArchive $( dirname $2 ) 990 # 991 typeset RET exist skip 992 993 #===================================================== 994 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 995 #===================================================== 996 997 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 998 #if [ $? -eq 0 ] ; then 999 # typeset WORKPATH FILEPATH 1000 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" ) 1001 # IGCM_sys_MkdirWork ${WORKPATH} 1002 # FILEPATH=${WORKPATH}/$( basename $2 ) 1003 # # 1004 # IGCM_sys_Cp ${1} ${FILEPATH} 1005 #fi 1006 1007 if [ X${JobType} = XRUN ] ; then 1008 if [ X${3} = X ] ; then 1009 IGCM_sys_Chmod 444 ${1} 1010 fi 1011 fi 1012 1013 exist=false 1012 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1013 if ( $DEBUG_sys ) ; then 1014 echo "IGCM_sys_Put_Out :" $@ 1015 fi 1016 if [ $DRYRUN = 0 ]; then 1017 if [ ! -f ${1} ] ; then 1018 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1019 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1020 return 1 1021 fi 1022 # 1023 IGCM_sys_MkdirArchive $( dirname $2 ) 1024 # 1025 typeset RET exist skip 1026 1027 #===================================================== 1028 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1029 #===================================================== 1030 1031 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 1032 #if [ $? -eq 0 ] ; then 1033 # typeset WORKPATH FILEPATH 1034 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1035 # IGCM_sys_MkdirWork ${WORKPATH} 1036 # FILEPATH=${WORKPATH}/$( basename $2 ) 1037 # # 1038 # IGCM_sys_Cp ${1} ${FILEPATH} 1039 #fi 1040 1041 if [ X${JobType} = XRUN ] ; then 1042 if [ X${3} = X ] ; then 1043 IGCM_sys_Chmod 444 ${1} 1044 fi 1045 fi 1046 1047 exist=false 1048 skip=false 1049 if [ -f $2 ] ; then 1050 IGCM_debug_Print 1 "$2 already exist" 1051 dmget $2 1052 exist=true 1053 if [ "X$( diff $1 $2 )" = X ] ; then 1054 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1055 skip=true 1056 else 1057 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1014 1058 skip=false 1015 if [ -f $2 ] ; then 1016 IGCM_debug_Print 1 "$2 already exist" 1017 dmget $2 1018 exist=true 1019 if [ "X$( diff $1 $2 )" = X ] ; then 1020 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1021 skip=true 1022 else 1023 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1024 skip=false 1025 fi 1026 fi 1059 fi 1060 fi 1027 1061 # 1028 1029 1030 1062 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1063 IGCM_sys_Chmod u+w $2 1064 fi 1031 1065 # USUAL WAY 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1066 if [ X${skip} = Xfalse ] ; then 1067 cp $1 $2 > out_rsync 2>&1 1068 RET=$? 1069 if [ ${RET} -gt 0 ] ; then 1070 echo "IGCM_sys_Put_Out : error." 1071 cat out_rsync 1072 IGCM_debug_Exit "IGCM_sys_Put_Out" 1073 else 1074 \rm out_rsync 1075 fi 1076 fi 1043 1077 1044 1078 # #RSYNC WITH NETWORK RSH CALL … … 1057 1091 1058 1092 1059 1060 1061 1062 1063 1093 else 1094 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1095 fi 1096 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1097 return 0 1064 1098 } 1065 1099 … … 1070 1104 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1071 1105 function IGCM_sys_Get { 1072 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1073 1074 typeset DEST RET dm_liste ifile target file_work 1075 1076 if ( $DEBUG_sys ) ; then 1077 echo "IGCM_sys_Get :" $@ 1078 fi 1079 if [ $DRYRUN -le 2 ]; then 1080 if [ X${1} = X'/l' ] ; then 1081 # test if the first file is present in the old computation : 1082 eval set +A dm_liste \${${2}} 1083 else 1084 eval set +A dm_liste ${1} 1085 fi 1086 eval DEST=\${${#}} 1087 1088 #===================================================== 1089 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1090 #===================================================== 1091 1092 # Is it an R_OUT file (not R_IN) ? 1093 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1094 #if [ $? -eq 0 ] ; then 1095 # # Yes ? then we try to get it in SCRATCHDIR 1096 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" ) 1097 # if [ -f ${file_work[0]} ] ; then 1098 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1099 # IGCM_debug_PopStack "IGCM_sys_Get" 1100 # return 1101 # fi 1102 #fi 1103 1104 # test if the (first) file is present in the old computation : 1105 IGCM_sys_TestFileArchive ${dm_liste[0]} 1106 RET=$? 1107 if [ ${RET} -gt 0 ] ; then 1108 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1109 IGCM_debug_Exit "IGCM_sys_Get" 1110 fi 1111 1112 dmget ${dm_liste[*]} > out_rsync 2>&1 1113 RET=$? 1114 1115 if [ ${RET} -gt 0 ] ; then 1116 echo "WARNING IGCM_sys_Get : demigration error." 1117 cat out_rsync 1118 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1119 fi 1120 1121 #if [ ${RET} -gt 0 ] ; then 1122 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1123 # cat out_rsync 1124 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1125 # sleep 30 1126 # echo "We try another time" 1127 # dmget ${dm_liste[*]} > out_rsync 2>&1 1128 # RET=$? 1129 # if [ ${RET} -gt 0 ] ; then 1130 # echo "ERROR IGCM_sys_Get : again demigration error :" 1131 # cat out_rsync 1132 # IGCM_debug_Exit "IGCM_sys_Get" 1133 # fi 1134 # else 1135 # echo "ERROR IGCM_sys_Get : demigration error :" 1136 # cat out_rsync 1137 # IGCM_debug_Exit "IGCM_sys_Get" 1138 # fi 1139 #fi 1140 1141 #USUAL WAY 1142 (( RET=0 )) 1143 if [ X${1} = X'/l' ] ; then 1144 (( RET=0 )) 1145 for target in ${dm_liste[*]} ; do 1146 local_file=$( basename ${target} ) 1147 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1148 (( RET = RET + $? )) 1149 done 1150 else 1151 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1152 RET=$? 1153 fi 1106 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1107 1108 typeset DEST RET dm_liste ifile target file_work 1109 1110 if ( $DEBUG_sys ) ; then 1111 echo "IGCM_sys_Get :" $@ 1112 fi 1113 if [ $DRYRUN -le 2 ]; then 1114 if [ X${1} = X'/l' ] ; then 1115 # test if the first file is present in the old computation : 1116 eval set +A dm_liste \${${2}} 1117 else 1118 eval set +A dm_liste ${1} 1119 fi 1120 eval DEST=\${${#}} 1121 1122 #===================================================== 1123 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1124 #===================================================== 1125 1126 # Is it an R_OUT file (not R_IN) ? 1127 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1128 #if [ $? -eq 0 ] ; then 1129 # # Yes ? then we try to get it in SCRATCHDIR 1130 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1131 # if [ -f ${file_work[0]} ] ; then 1132 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1133 # IGCM_debug_PopStack "IGCM_sys_Get" 1134 # return 1135 # fi 1136 #fi 1137 1138 # test if the (first) file is present in the old computation : 1139 IGCM_sys_TestFileArchive ${dm_liste[0]} 1140 RET=$? 1141 if [ ${RET} -gt 0 ] ; then 1142 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1143 IGCM_debug_Exit "IGCM_sys_Get" 1144 fi 1145 1146 dmget ${dm_liste[*]} > out_rsync 2>&1 1147 RET=$? 1148 if [ ${RET} -gt 0 ] ; then 1149 echo "WARNING IGCM_sys_Get : demigration error." 1150 cat out_rsync 1151 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1152 fi 1153 1154 #if [ ${RET} -gt 0 ] ; then 1155 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1156 # cat out_rsync 1157 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1158 # sleep 30 1159 # echo "We try another time" 1160 # dmget ${dm_liste[*]} > out_rsync 2>&1 1161 # RET=$? 1162 # if [ ${RET} -gt 0 ] ; then 1163 # echo "ERROR IGCM_sys_Get : again demigration error :" 1164 # cat out_rsync 1165 # IGCM_debug_Exit "IGCM_sys_Get" 1166 # fi 1167 # else 1168 # echo "ERROR IGCM_sys_Get : demigration error :" 1169 # cat out_rsync 1170 # IGCM_debug_Exit "IGCM_sys_Get" 1171 # fi 1172 #fi 1173 1174 #USUAL WAY 1175 if [ X${1} = X'/l' ] ; then 1176 (( RET=0 )) 1177 for target in ${dm_liste[*]} ; do 1178 local_file=$( basename ${target} ) 1179 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1180 (( RET = RET + $? )) 1181 done 1182 else 1183 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1184 RET=$? 1185 fi 1154 1186 1155 1187 # #RSYNC WITH NETWORK SSH CALL … … 1167 1199 # (( RET=RET+$? )) 1168 1200 1169 if [ ${RET} -gt 0 ] ; then 1170 echo "IGCM_sys_Get : copy error." 1171 cat out_rsync 1172 IGCM_debug_Exit "IGCM_sys_Get" 1173 else 1174 \rm out_rsync 1175 fi 1201 if [ ${RET} -gt 0 ] ; then 1202 echo "IGCM_sys_Get : copy error." 1203 cat out_rsync 1204 IGCM_debug_Exit "IGCM_sys_Get" 1176 1205 else 1177 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1178 fi 1179 IGCM_debug_PopStack "IGCM_sys_Get" 1206 \rm out_rsync 1207 fi 1208 else 1209 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1210 fi 1211 IGCM_debug_PopStack "IGCM_sys_Get" 1212 } 1213 1214 #D-#================================================== 1215 #D-function IGCM_sys_GetBuffer 1216 #D-* Purpose: Get a file from ${SCRATCHDIR} 1217 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1218 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1219 function IGCM_sys_GetBuffer { 1220 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1221 1222 typeset DEST RET buf_liste ifile target file_work 1223 1224 if ( $DEBUG_sys ) ; then 1225 echo "IGCM_sys_GetBuffer :" $@ 1226 fi 1227 if [ $DRYRUN -le 2 ]; then 1228 if [ X${1} = X'/l' ] ; then 1229 # test if the first file is present in the old computation : 1230 eval set +A buf_liste \${${2}} 1231 else 1232 eval set +A buf_liste ${1} 1233 fi 1234 eval DEST=\${${#}} 1235 1236 #USUAL WAY 1237 if [ X${1} = X'/l' ] ; then 1238 (( RET=0 )) 1239 for target in ${buf_liste[*]} ; do 1240 local_file=$( basename ${target} ) 1241 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1242 (( RET = RET + $? )) 1243 done 1244 else 1245 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1246 RET=$? 1247 fi 1248 1249 if [ ${RET} -gt 0 ] ; then 1250 echo "IGCM_sys_GetBuffer : copy error." 1251 cat out_rsync 1252 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1253 else 1254 \rm out_rsync 1255 fi 1256 else 1257 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1258 fi 1259 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1260 } 1261 1262 #D-#================================================== 1263 #D-function IGCM_sys_GetDate_FichWork 1264 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1265 #D-* Examples: 1266 #D- 1267 function IGCM_sys_GetDate_FichWork { 1268 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1269 if ( $DEBUG_sys ) ; then 1270 echo "IGCM_sys_GetDate_FichWork :" $@ 1271 fi 1272 # donne la date filesys d'un fichier sur la machine work 1273 IGCM_debug_PopStack "IGCM_sys_FichWork" 1274 } 1275 1276 #D-#================================================== 1277 #D-function IGCM_sys_GetDate_FichArchive 1278 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1279 #D-* Examples: 1280 #D- 1281 function IGCM_sys_GetDate_FichArchive { 1282 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1283 if ( $DEBUG_sys ) ; then 1284 echo "IGCM_sys_GetDate_FichArchive :" $@ 1285 fi 1286 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1180 1287 } 1181 1288 1182 1289 #D-#================================================== 1183 1290 #D-function IGCM_sys_Dods_Rm 1184 #D-* Purpose: DO NOTHING ! Put $ (ARCHIVE)files on DODS internet protocole.1291 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1185 1292 #D-* Examples: 1186 1293 #D- 1187 1294 function IGCM_sys_Dods_Rm { 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 dods_rm public/${LOGIN}/${R_DODS}/${1} #> out_dods_rm 2>&11200 1201 1295 if ( $DEBUG_sys ) ; then 1296 echo "IGCM_sys_Dods_Rm :" $@ 1297 fi 1298 typeset RET 1299 RET=0 1300 if [ $DRYRUN = 0 ]; then 1301 if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then 1302 echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." 1303 echo "Nothing has been done." 1304 return 1305 fi 1306 dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1307 RET=$? 1308 1202 1309 # if [ ${RET} -gt 0 ] ; then 1203 1310 # echo "IGCM_sys_Dods_Rm : error." … … 1208 1315 # fi 1209 1316 1210 else 1211 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1212 fi 1213 return $RET 1214 } 1215 1317 else 1318 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1319 fi 1320 return $RET 1321 } 1216 1322 1217 1323 #D-#================================================== … … 1221 1327 #D- 1222 1328 function IGCM_sys_Dods_Cp { 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1329 if ( $DEBUG_sys ) ; then 1330 echo "IGCM_sys_Dods_Cp :" $@ 1331 fi 1332 typeset RET 1333 RET=0 1334 if [ $DRYRUN = 0 ]; then 1335 if [ ! -d ${R_SAVE}/${1} ] ; then 1336 echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." 1337 echo "Nothing has been done." 1338 return 1339 fi 1340 # 1341 dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1342 RET=$? 1343 1238 1344 # if [ ${RET} -gt 0 ] ; then 1239 1345 # echo "IGCM_sys_Dods_Cp : error." … … 1244 1350 # fi 1245 1351 1246 1247 1248 1249 1352 else 1353 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1354 fi 1355 return $RET 1250 1356 } 1251 1357 … … 1256 1362 #D- 1257 1363 function IGCM_sys_Put_Dods { 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1364 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1365 if ( $DEBUG_sys ) ; then 1366 echo "IGCM_sys_Put_Dods :" $@ 1367 fi 1368 if [ $DRYRUN = 0 ]; then 1369 if [ ! -d ${R_SAVE}/${1} ] ; then 1370 echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." 1371 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1372 return 1373 fi 1374 1375 typeset RET 1270 1376 # 1271 cd ${R_SAVE} 1272 IGCM_sys_Dods_Rm ${1} 1273 IGCM_sys_Dods_Cp ${1} 1274 RET=0 1275 1276 if [ ${RET} -gt 0 ] ; then 1277 echo "IGCM_sys_Put_Dods : error." 1278 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1279 fi 1280 else 1281 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1282 fi 1283 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1284 } 1285 1286 ############################################################## A FINIR !! 1287 1288 #D-#================================================== 1289 #D-function IGCM_sys_GetDate_FichWork 1290 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1291 #D-* Examples: 1292 #D- 1293 function IGCM_sys_GetDate_FichWork { 1294 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1295 if ( $DEBUG_sys ) ; then 1296 echo "IGCM_sys_GetDate_FichWork :" $@ 1297 fi 1298 # donne la date filesys d'un fichier sur la machine work 1299 IGCM_debug_PopStack "IGCM_sys_FichWork" 1300 } 1301 1302 #D-#================================================== 1303 #D-function IGCM_sys_GetDate_FichArchive 1304 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1305 #D-* Examples: 1306 #D- 1307 function IGCM_sys_GetDate_FichArchive { 1308 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1309 if ( $DEBUG_sys ) ; then 1310 echo "IGCM_sys_GetDate_FichArchive :" $@ 1311 fi 1312 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1377 cd ${R_SAVE} 1378 IGCM_sys_Dods_Rm ${1} 1379 IGCM_sys_Dods_Cp ${1} 1380 RET=0 1381 1382 if [ ${RET} -gt 0 ] ; then 1383 echo "IGCM_sys_Put_Dods : error." 1384 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1385 fi 1386 else 1387 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1388 fi 1389 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1313 1390 } 1314 1391 … … 1317 1394 1318 1395 function IGCM_sys_rebuild { 1319 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1320 if ( $DEBUG_sys ) ; then 1321 echo "IGCM_sys_rebuild :" $@ 1322 fi 1323 /home/cont003/p86ipsl/CESIUM/bin/rebuild -f -o $@ 1324 if [ $? -gt 0 ] ; then 1325 echo "IGCM_sys_rebuild : erreur ${@}." 1326 IGCM_debug_Exit "rebuild" 1327 fi 1328 1329 IGCM_debug_PopStack "IGCM_sys_rebuild" 1396 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1397 if ( $DEBUG_sys ) ; then 1398 echo "IGCM_sys_rebuild :" $@ 1399 fi 1400 /home/cont003/p86ipsl/CESIUM/bin/rebuild -f -o $@ 1401 if [ $? -gt 0 ] ; then 1402 echo "IGCM_sys_rebuild : erreur ${@}." 1403 IGCM_debug_Exit "rebuild" 1404 fi 1405 1406 IGCM_debug_PopStack "IGCM_sys_rebuild" 1407 } 1408 1409 1410 ############################################################ 1411 # Activate Running Environnment Variables 1412 1413 function IGCM_sys_activ_variables { 1414 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1415 if ( $DEBUG_sys ) ; then 1416 echo "IGCM_sys_activ_variables" 1417 fi 1418 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1419 } 1420 1421 ############################################################ 1422 # Desactivate Running Environnment Variables 1423 1424 function IGCM_sys_desactiv_variables { 1425 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1426 if ( $DEBUG_sys ) ; then 1427 echo "IGCM_sys_desactiv_variables" 1428 fi 1429 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1430 } 1431 1432 ############################################################ 1433 # Build run file 1434 1435 function IGCM_sys_build_run_file { 1436 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1437 if ( $DEBUG_sys ) ; then 1438 echo "IGCM_sys_build_run_file" 1439 fi 1440 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1330 1441 } 1331 1442 … … 1334 1445 1335 1446 function IGCM_sys_ncap2 { 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1447 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1448 if ( $DEBUG_sys ) ; then 1449 echo "IGCM_sys_ncap2 :" $@ 1450 fi 1451 ncap2 "$@" 1452 if [ $? -gt 0 ] ; then 1453 echo "IGCM_sys_ncap2 : erreur ${@}." 1454 IGCM_debug_Exit "ncap2" 1455 fi 1456 1457 IGCM_debug_PopStack "IGCM_sys_ncap2" 1347 1458 } 1348 1459 1349 1460 function IGCM_sys_ncatted { 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1461 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1462 if ( $DEBUG_sys ) ; then 1463 echo "IGCM_sys_ncatted :" $@ 1464 fi 1465 ncatted "$@" 1466 if [ $? -gt 0 ] ; then 1467 echo "IGCM_sys_ncatted : erreur ${@}." 1468 IGCM_debug_Exit "ncatted" 1469 fi 1470 1471 IGCM_debug_PopStack "IGCM_sys_ncatted" 1361 1472 } 1362 1473 1363 1474 function IGCM_sys_ncbo { 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1475 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1476 if ( $DEBUG_sys ) ; then 1477 echo "IGCM_sys_ncbo :" $@ 1478 fi 1479 ncbo $@ 1480 if [ $? -gt 0 ] ; then 1481 echo "IGCM_sys_ncbo : erreur ${@}." 1482 IGCM_debug_Exit "ncbo" 1483 fi 1484 1485 IGCM_debug_PopStack "IGCM_sys_ncbo" 1375 1486 } 1376 1487 1377 1488 function IGCM_sys_ncdiff { 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1489 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1490 if ( $DEBUG_sys ) ; then 1491 echo "IGCM_sys_ncdiff :" $@ 1492 fi 1493 ncdiff $@ 1494 if [ $? -gt 0 ] ; then 1495 echo "IGCM_sys_ncdiff : erreur ${@}." 1496 IGCM_debug_Exit "ncdiff" 1497 fi 1498 1499 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1389 1500 } 1390 1501 1391 1502 function IGCM_sys_ncea { 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1503 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1504 if ( $DEBUG_sys ) ; then 1505 echo "IGCM_sys_ncea :" $@ 1506 fi 1507 ncea $@ 1508 if [ $? -gt 0 ] ; then 1509 echo "IGCM_sys_ncea : erreur ${@}." 1510 IGCM_debug_Exit "ncea" 1511 fi 1512 1513 IGCM_debug_PopStack "IGCM_sys_ncea" 1403 1514 } 1404 1515 1405 1516 function IGCM_sys_ncecat { 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1517 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1518 if ( $DEBUG_sys ) ; then 1519 echo "IGCM_sys_ncecat :" $@ 1520 fi 1521 ncecat $@ 1522 if [ $? -gt 0 ] ; then 1523 echo "IGCM_sys_ncecat : erreur ${@}." 1524 IGCM_debug_Exit "ncecat" 1525 fi 1526 1527 IGCM_debug_PopStack "IGCM_sys_ncecat" 1417 1528 } 1418 1529 1419 1530 function IGCM_sys_ncflint { 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1531 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1532 if ( $DEBUG_sys ) ; then 1533 echo "IGCM_sys_ncflint :" $@ 1534 fi 1535 ncflint $@ 1536 if [ $? -gt 0 ] ; then 1537 echo "IGCM_sys_ncflint : erreur ${@}." 1538 IGCM_debug_Exit "ncflint" 1539 fi 1540 1541 IGCM_debug_PopStack "IGCM_sys_ncflint" 1431 1542 } 1432 1543 1433 1544 function IGCM_sys_ncks { 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1545 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1546 if ( $DEBUG_sys ) ; then 1547 echo "IGCM_sys_ncks :" $@ 1548 fi 1549 ncks $@ 1550 if [ $? -gt 0 ] ; then 1551 echo "IGCM_sys_ncks : erreur ${@}." 1552 IGCM_debug_Exit "ncks" 1553 fi 1554 1555 IGCM_debug_PopStack "IGCM_sys_ncks" 1445 1556 } 1446 1557 1447 1558 function IGCM_sys_ncpdq { 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1559 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1560 if ( $DEBUG_sys ) ; then 1561 echo "IGCM_sys_ncpdq :" $@ 1562 fi 1563 ncpdq $@ 1564 if [ $? -gt 0 ] ; then 1565 echo "IGCM_sys_ncpdq : erreur ${@}." 1566 IGCM_debug_Exit "ncpdq" 1567 fi 1568 1569 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1459 1570 } 1460 1571 1461 1572 function IGCM_sys_ncra { 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1573 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1574 if ( $DEBUG_sys ) ; then 1575 echo "IGCM_sys_ncra :" $@ 1576 fi 1577 ncra $@ 1578 if [ $? -gt 0 ] ; then 1579 echo "IGCM_sys_ncra : erreur ${@}." 1580 IGCM_debug_Exit "ncra" 1581 fi 1582 1583 IGCM_debug_PopStack "IGCM_sys_ncra" 1473 1584 } 1474 1585 1475 1586 function IGCM_sys_ncrcat { 1476 1477 1478 1479 1480 1481 1482 1587 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1588 if ( $DEBUG_sys ) ; then 1589 echo "IGCM_sys_ncrcat :" $@ 1590 fi 1591 ncrcat $@ 1592 if [ $? -gt 0 ] ; then 1593 echo "IGCM_sys_ncrcat : erreur ${@}." 1483 1594 # IGCM_debug_Exit "ncrcat" 1484 1485 1486 1595 fi 1596 1597 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1487 1598 } 1488 1599 1489 1600 function IGCM_sys_ncrename { 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1601 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1602 if ( $DEBUG_sys ) ; then 1603 echo "IGCM_sys_ncrename :" $@ 1604 fi 1605 ncrename $@ 1606 if [ $? -gt 0 ] ; then 1607 echo "IGCM_sys_ncrename : erreur ${@}." 1608 IGCM_debug_Exit "ncrename" 1609 fi 1610 1611 IGCM_debug_PopStack "IGCM_sys_ncrename" 1501 1612 } 1502 1613 1503 1614 function IGCM_sys_ncwa { 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1615 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1616 if ( $DEBUG_sys ) ; then 1617 echo "IGCM_sys_ncwa :" $@ 1618 fi 1619 ncwa $@ 1620 if [ $? -gt 0 ] ; then 1621 echo "IGCM_sys_ncwa : erreur ${@}." 1622 IGCM_debug_Exit "ncwa" 1623 fi 1624 1625 IGCM_debug_PopStack "IGCM_sys_ncwa" 1515 1626 } 1516 1627 … … 1519 1630 1520 1631 function IGCM_sys_cdo { 1521 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1522 1523 \cdo $@ 1524 if [ $? -gt 0 ] ; then 1525 echo "IGCM_sys_cdo : erreur ${@}." 1526 IGCM_debug_PopStack "IGCM_sys_cdo" 1527 return 1 1528 else 1529 IGCM_debug_PopStack "IGCM_sys_cdo" 1530 return 0 1531 fi 1532 1632 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1633 if ( $DEBUG_sys ) ; then 1634 echo "IGCM_sys_cdo :" $@ 1635 fi 1636 \cdo $@ 1637 if [ $? -gt 0 ] ; then 1638 echo "IGCM_sys_cdo : erreur ${@}." 1533 1639 IGCM_debug_PopStack "IGCM_sys_cdo" 1534 } 1535 1536 ############################################################ 1537 # Activate Running Environnment Variables 1538 1539 function IGCM_sys_activ_variables { 1540 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1541 if ( $DEBUG_sys ) ; then 1542 echo "IGCM_sys_activ_variables" 1543 fi 1544 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1545 } 1546 1547 ############################################################ 1548 # Desactivate Running Environnment Variables 1549 1550 function IGCM_sys_desactiv_variables { 1551 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1552 if ( $DEBUG_sys ) ; then 1553 echo "IGCM_sys_desactiv_variables" 1554 fi 1555 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1556 } 1557 1558 ############################################################ 1559 # Build run file 1560 1561 function IGCM_sys_build_run_file { 1562 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1563 if ( $DEBUG_sys ) ; then 1564 echo "IGCM_sys_build_run_file" 1565 fi 1566 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1567 } 1640 return 1 1641 else 1642 IGCM_debug_PopStack "IGCM_sys_cdo" 1643 return 0 1644 fi 1645 1646 IGCM_debug_PopStack "IGCM_sys_cdo" 1647 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
r520 r544 62 62 63 63 #===================================================== 64 # Host and user names 64 # Host and user names 65 65 # $hostname ou hostname 66 66 typeset HOST=${HOST:=$( hostname )} … … 111 111 112 112 #==================================================== 113 #- OUT113 #- R_OUT 114 114 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 115 115 116 116 #==================================================== 117 #- OUT_SCR (ONLY FOR double copy an scratch) 118 typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT 117 #- R_BUF (ONLY FOR double copy an scratch) 118 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 119 120 #==================================================== 121 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 122 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 119 123 120 124 #==================================================== … … 125 129 #- RUN_DIR_PATH : Temporary working directory (=> TMP) 126 130 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${CSCRATCHDIR}/TMPDIR_IGCM/${JOBID}} 127 128 #====================================================129 #- BIG_DIR : BIG_DIR to store files waiting for rebuild130 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}131 131 132 132 #==================================================== … … 144 144 #D- 145 145 function IGCM_sys_RshMaster { 146 147 146 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 147 /bin/ksh <<-EOF 148 148 export libIGCM=${libIGCM} 149 149 export DEBUG_debug=${DEBUG_debug} … … 152 152 ${@} 153 153 EOF 154 155 156 157 158 154 if [ $? -gt 0 ] ; then 155 echo "IGCM_sys_RshMaster : erreur." 156 IGCM_debug_Exit "IGCM_sys_RshMaster" 157 fi 158 IGCM_debug_PopStack "IGCM_sys_RshMaster" 159 159 } 160 160 … … 165 165 #D- 166 166 function IGCM_sys_RshArchive { 167 168 167 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 168 /bin/ksh <<-EOF 169 169 ${@} 170 170 EOF 171 172 173 174 175 171 if [ $? -gt 0 ] ; then 172 echo "IGCM_sys_RshArchive : erreur." 173 IGCM_debug_Exit "IGCM_sys_RshArchive" 174 fi 175 IGCM_debug_PopStack "IGCM_sys_RshArchive" 176 176 } 177 177 … … 182 182 #D- 183 183 function IGCM_sys_RshPost { 184 185 186 187 188 189 190 191 192 193 184 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 185 if ( $DEBUG_sys ) ; then 186 echo "IGCM_sys_RshPost :" $@ 187 fi 188 /bin/ksh ${@} 189 if [ $? -gt 0 ] ; then 190 echo "IGCM_sys_RshPost : erreur." 191 IGCM_debug_Exit "IGCM_sys_RshPost" 192 fi 193 IGCM_debug_PopStack "IGCM_sys_RshPost" 194 194 } 195 195 … … 200 200 #D- 201 201 function IGCM_sys_SendMail { 202 203 204 205 206 207 208 209 210 211 212 202 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 203 if ( $DEBUG_sys ) ; then 204 echo "IGCM_sys_SendMail :" $@ 205 fi 206 207 if ( ${ExitFlag} ) ; then 208 status=failed 209 else 210 status=completed 211 fi 212 cat << END_MAIL > job_end.mail 213 213 Dear ${LOGIN}, 214 214 … … 220 220 END_MAIL 221 221 222 223 224 225 226 227 228 229 230 231 232 233 234 222 if [ X"${config_UserChoices_MailName}" != X ] ; then 223 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 224 elif [ -f ~/.forward ] ; then 225 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 226 else 227 mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail 228 fi 229 230 if [ $? -gt 0 ] ; then 231 echo "IGCM_sys_SendMail : erreur." 232 IGCM_debug_Exit "IGCM_sys_SendMail" 233 fi 234 IGCM_debug_PopStack "IGCM_sys_SendMail" 235 235 } 236 236 … … 241 241 #D- 242 242 function IGCM_sys_Mkdir { 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 243 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 244 if ( $DEBUG_sys ) ; then 245 echo "IGCM_sys_Mkdir :" $@ 246 fi 247 if [ ! -d ${1} ]; then 248 \mkdir -p $1 249 if [ $? -gt 0 ] ; then 250 echo "IGCM_sys_Mkdir : erreur." 251 IGCM_debug_Exit "IGCM_sys_Mkdir" 252 fi 253 fi 254 # vérification : 255 if [ ! -d ${1} ] ; then 256 echo "IGCM_sys_Mkdir : erreur." 257 IGCM_debug_Exit "IGCM_sys_Mkdir" 258 fi 259 IGCM_debug_PopStack "IGCM_sys_Mkdir" 260 260 } 261 261 … … 266 266 #D- 267 267 function IGCM_sys_MkdirArchive { 268 269 270 271 272 273 274 275 276 277 278 279 280 268 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 269 if ( $DEBUG_sys ) ; then 270 echo "IGCM_sys_MkdirArchive :" $@ 271 fi 272 #- creation de repertoire sur le serveur fichier 273 if [ ! -d ${1} ]; then 274 \mkdir -p $1 275 if [ $? -gt 0 ] ; then 276 echo "IGCM_sys_MkdirArchive : erreur." 277 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 278 fi 279 fi 280 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 281 281 } 282 282 … … 287 287 #D- 288 288 function IGCM_sys_MkdirWork { 289 290 291 292 293 294 295 296 297 298 299 300 301 289 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 290 if ( $DEBUG_sys ) ; then 291 echo "IGCM_sys_MkdirWork :" $@ 292 fi 293 #- creation de repertoire sur le serveur fichier 294 if [ ! -d ${1} ]; then 295 \mkdir -p $1 296 if [ $? -gt 0 ] ; then 297 echo "IGCM_sys_MkdirWork : erreur." 298 IGCM_debug_Exit "IGCM_sys_MkdirWork" 299 fi 300 fi 301 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 302 302 } 303 303 … … 308 308 #D- 309 309 function IGCM_sys_Cd { 310 311 312 313 314 315 316 317 318 319 310 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 311 if ( $DEBUG_sys ) ; then 312 echo "IGCM_sys_Cd :" $@ 313 fi 314 \cd $1 315 if [ $? -gt 0 ] ; then 316 echo "IGCM_sys_Cd : erreur." 317 IGCM_debug_Exit "IGCM_sys_Cd" 318 fi 319 IGCM_debug_PopStack "IGCM_sys_Cd" 320 320 } 321 321 … … 326 326 #D- 327 327 function IGCM_sys_Chmod { 328 329 330 331 332 333 334 335 336 337 338 339 340 341 328 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 329 if ( $DEBUG_sys ) ; then 330 echo "IGCM_sys_Chmod :" $@ 331 fi 332 if [ $DRYRUN -le 1 ]; then 333 \chmod $@ 334 if [ $? -gt 0 ] ; then 335 echo "IGCM_sys_Chmod : erreur." 336 IGCM_debug_Exit "IGCM_sys_Chmod" 337 fi 338 else 339 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 340 fi 341 IGCM_debug_PopStack "IGCM_sys_Chmod" 342 342 } 343 343 … … 348 348 #D- 349 349 function IGCM_sys_FileSize { 350 351 352 353 354 355 356 357 358 359 350 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 351 352 typeset sizeF 353 set +A sizeF -- $( ls -la ${1} ) 354 if [ $? -gt 0 ] ; then 355 IGCM_debug_Exit "IGCM_sys_FileSize" 356 fi 357 eval ${2}=${sizeF[4]} 358 359 IGCM_debug_PopStack "IGCM_sys_FileSize" 360 360 } 361 361 … … 366 366 #D- 367 367 function IGCM_sys_TestDir { 368 369 370 371 372 373 374 375 376 368 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 369 if ( $DEBUG_sys ) ; then 370 echo "IGCM_sys_TestDir :" $@ 371 fi 372 typeset ExistFlag 373 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 374 IGCM_debug_PopStack "IGCM_sys_TestDir" 375 376 return ${ExistFlag} 377 377 } 378 378 … … 383 383 #D- 384 384 function IGCM_sys_TestDirArchive { 385 386 387 388 389 390 391 392 393 385 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 386 if ( $DEBUG_sys ) ; then 387 echo "IGCM_sys_TestDirArchive :" $@ 388 fi 389 typeset ExistFlag 390 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 391 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 392 393 return ${ExistFlag} 394 394 } 395 395 … … 400 400 #D- 401 401 function IGCM_sys_TestFileArchive { 402 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 403 if ( $DEBUG_sys ) ; then 404 echo "IGCM_sys_TestFileArchive :" $@ 405 fi 406 typeset ExistFlag 407 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 408 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 409 410 return ${ExistFlag} 402 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 403 if ( $DEBUG_sys ) ; then 404 echo "IGCM_sys_TestFileArchive :" $@ 405 fi 406 typeset ExistFlag 407 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 408 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 409 410 return ${ExistFlag} 411 } 412 413 #D-#================================================== 414 #D-function IGCM_sys_TestFileBuffer 415 #D-* Purpose: Test file that must NOT EXISTS on Buffer 416 #D-* Examples: 417 #D- 418 function IGCM_sys_TestFileBuffer { 419 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 420 typeset ExistFlag 421 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 422 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 423 424 return ${ExistFlag} 411 425 } 412 426 … … 417 431 #D- 418 432 function IGCM_sys_CountFileArchive { 419 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 420 ls ${@} 2>/dev/null | wc -l 421 if [ $? -gt 0 ] ; then 422 echo "IGCM_sys_CountFileArchive : erreur." 423 fi 424 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 433 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 434 ls ${@} 2>/dev/null | wc -l 435 if [ $? -gt 0 ] ; then 436 echo "IGCM_sys_CountFileArchive : erreur." 437 fi 438 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 439 } 440 441 #D-#================================================== 442 #D-function IGCM_sys_CountFileBuffer 443 #D-* Purpose: Count files on Scratch filesystem 444 #D-* Examples: 445 #D- 446 function IGCM_sys_CountFileBuffer { 447 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 448 ls ${@} 2>/dev/null | wc -l 449 if [ $? -gt 0 ] ; then 450 echo "IGCM_sys_CountFileBuffer : erreur." 451 fi 452 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 425 453 } 426 454 … … 431 459 #D- 432 460 function IGCM_sys_Tree { 433 434 435 436 437 438 439 440 461 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 462 if ( $DEBUG_sys ) ; then 463 echo "IGCM_sys_Tree :" $@ 464 fi 465 466 \tree -f $@ 467 468 IGCM_debug_PopStack "IGCM_sys_Tree" 441 469 } 442 470 443 471 #D-#================================================== 444 472 #D-function IGCM_sys_Tar 445 #D-* Purpose: master un-tar command473 #D-* Purpose: master tar command 446 474 #D-* Examples: 447 475 #D- 448 476 function IGCM_sys_Tar { 449 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 450 if ( $DEBUG_sys ) ; then 451 echo "IGCM_sys_Tar :" $@ 452 fi 453 \tar cvf $@ 454 if [ $? -gt 0 ] ; then 455 echo "IGCM_sys_Tar : erreur." 456 IGCM_debug_Exit "IGCM_sys_Tar" 457 fi 458 \tar tvf $1 459 460 IGCM_debug_PopStack "IGCM_sys_Tar" 477 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 478 if ( $DEBUG_sys ) ; then 479 echo "IGCM_sys_Tar :" $@ 480 fi 481 \tar cf $@ 482 if [ $? -gt 0 ] ; then 483 echo "IGCM_sys_Tar : erreur." 484 IGCM_debug_Exit "IGCM_sys_Tar" 485 fi 486 IGCM_debug_PopStack "IGCM_sys_Tar" 461 487 } 462 488 … … 467 493 #D- 468 494 function IGCM_sys_UnTar { 469 470 471 472 473 474 475 476 477 478 495 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 496 if ( $DEBUG_sys ) ; then 497 echo "IGCM_sys_UnTar :" $@ 498 fi 499 \tar xvf $1 500 if [ $? -gt 0 ] ; then 501 echo "IGCM_sys_UnTar : erreur." 502 IGCM_debug_Exit "IGCM_sys_UnTar" 503 fi 504 IGCM_debug_PopStack "IGCM_sys_UnTar" 479 505 } 480 506 … … 485 511 #D- 486 512 function IGCM_sys_QsubPost { 487 488 489 490 491 492 493 494 495 496 513 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 514 if ( $DEBUG_sys ) ; then 515 echo "IGCM_sys_QsubPost :" $@ 516 fi 517 /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv} 518 if [ $? -gt 0 ] ; then 519 echo "IGCM_sys_QsubPost : erreur " $@ 520 IGCM_debug_Exit "IGCM_sys_QsubPost" 521 fi 522 IGCM_debug_PopStack "IGCM_sys_QsubPost" 497 523 } 498 524 … … 508 534 #D- Error values and explanations can depend on your system version. 509 535 function IGCM_sys_Rsync_out { 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 } 613 536 RET=$1 537 if [ ! $RET ] ; then 538 echo "rsync error !" 539 fi 540 541 if [ $MYLANG = "fr" ]; then 542 case $RET in 543 0) return ;; 544 1) echo "Erreur de rsync ; RERR_SYNTAX : " 545 echo "Erreur de syntaxe ou d'utilisation." 546 return;; 547 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 548 echo "Incompatibilité de protocole." 549 return;; 550 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 551 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 552 echo "répertoires" 553 return;; 554 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 555 echo "Action demandée non supportée : une tentative de manipulation de" 556 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 557 echo "été faite ; ou une option qui est supportée par le client mais" 558 echo "pas par le serveur a été spécifiée." 559 return;; 560 10) echo "Erreur de rsync ; RERR_SOCKETIO" 561 echo "Erreur dans le socket d'entrée sortie" 562 return;; 563 11) echo "Erreur de rsync ; RERR_FILEIO" 564 echo "Erreur d'entrée sortie fichier" 565 return;; 566 12) echo "Erreur de rsync ; RERR_STREAMIO" 567 echo "Erreur dans flux de donnée du protocole rsync" 568 return;; 569 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 570 echo "Erreur avec les diagnostics du programme" 571 return;; 572 14) echo "Erreur de rsync ; RERR_IPC" 573 echo "Erreur dans le code IPC" 574 return;; 575 20) echo "Erreur de rsync ; RERR_SIGNAL" 576 echo "SIGUSR1 ou SIGINT reçu" 577 return;; 578 21) echo "Erreur de rsync ; RERR_WAITCHILD" 579 echo "Une erreur retournée par waitpid()" 580 return;; 581 22) echo "Erreur de rsync ; RERR_MALLOC" 582 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 583 return;; 584 23) echo "" 585 echo "Erreur fichier inexistant" 586 return;; 587 30) echo "Erreur de rsync ; RERR_TIMEOUT" 588 echo "Temps d'attente écoulé dans l'envoi/réception de données" 589 return;; 590 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 591 return;; 592 esac 593 elif [ $MYLANG = "en" ] ; then 594 case $RET in 595 0) return;; 596 1) echo "rsync error : Syntax or usage error " 597 return;; 598 2) echo "rsync error : Protocol incompatibility " 599 return;; 600 3) echo "rsync error : Errors selecting input/output files, dirs" 601 return;; 602 4) echo "rsync error : Requested action not supported: an attempt" 603 echo "was made to manipulate 64-bit files on a platform that cannot support" 604 echo "them; or an option was specified that is supported by the client and" 605 echo "not by the server." 606 return;; 607 5) echo "rsync error : Error starting client-server protocol" 608 return;; 609 10) echo "rsync error : Error in socket I/O " 610 return;; 611 11) echo "rsync error : Error in file I/O " 612 return;; 613 12) echo "rsync error : Error in rsync protocol data stream " 614 return;; 615 13) echo "rsync error : Errors with program diagnostics " 616 return;; 617 14) echo "rsync error : Error in IPC code " 618 return;; 619 20) echo "rsync error : Received SIGUSR1 or SIGINT " 620 return;; 621 21) echo "rsync error : Some error returned by waitpid() " 622 return;; 623 22) echo "rsync error : Error allocating core memory buffers " 624 return;; 625 23) echo "rsync error : Partial transfer due to error" 626 return;; 627 24) echo "rsync error : Partial transfer due to vanished source files" 628 return;; 629 30) echo "rsync error : Timeout in data send/receive " 630 return;; 631 *) echo "rsync error : return code of rsync unknown :" $RET 632 return;; 633 esac 634 else 635 echo "unknown language $MYLANG." 636 return 637 fi 638 } 639 614 640 #D-#================================================== 615 641 #D-function IGCM_sys_Cp … … 618 644 #D- 619 645 function IGCM_sys_Cp { 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 646 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 647 if ( $DEBUG_sys ) ; then 648 echo "IGCM_sys_Cp :" $@ 649 fi 650 651 typeset RET 652 653 echo cp $@ > out_rsync 2>&1 654 \cp $@ >> out_rsync 2>&1 655 RET=$? 656 657 if [ ${RET} -gt 0 ] ; then 658 echo "IGCM_sys_Cp : error." 659 cat out_rsync 660 IGCM_debug_Exit "IGCM_sys_Cp" 661 else 662 \rm out_rsync 663 fi 664 IGCM_debug_PopStack "IGCM_sys_Cp" 639 665 } 640 666 … … 645 671 #D- 646 672 function IGCM_sys_Rm { 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 673 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 674 if ( $DEBUG_sys ) ; then 675 echo "IGCM_sys_Rm :" $@ 676 fi 677 678 typeset RET 679 680 echo rm $@ > out_rsync 2>&1 681 \rm $@ >> out_rsync 2>&1 682 RET=$? 683 684 if [ ${RET} -gt 0 ] ; then 685 echo "IGCM_sys_Rm : error." 686 cat out_rsync 687 IGCM_debug_Exit "IGCM_sys_Rm" 688 else 689 \rm out_rsync 690 fi 691 IGCM_debug_PopStack "IGCM_sys_Rm" 666 692 } 667 693 … … 673 699 #D- 674 700 function IGCM_sys_RmRunDir { 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 701 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 702 if ( $DEBUG_sys ) ; then 703 echo "IGCM_sys_RmRunDir :" $@ 704 fi 705 706 typeset RET 707 708 echo rm $@ > out_rsync 2>&1 709 \rm $@ >> out_rsync 2>&1 710 RET=$? 711 712 if [ ${RET} -gt 0 ] ; then 713 echo "IGCM_sys_RmRunDir : error." 714 cat out_rsync 715 IGCM_debug_Exit "IGCM_sys_RmRunDir" 716 else 717 \rm out_rsync 718 fi 719 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 694 720 } 695 721 … … 700 726 #D- 701 727 function IGCM_sys_Mv { 702 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 703 if ( $DEBUG_sys ) ; then 704 echo "IGCM_sys_Mv :" $@ 705 fi 706 707 if [ $DRYRUN = 0 ]; then 708 709 typeset RET 710 711 echo mv $@ > out_rsync 2>&1 712 \mv $@ >> out_rsync 2>&1 713 RET=$? 728 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 729 if ( $DEBUG_sys ) ; then 730 echo "IGCM_sys_Mv :" $@ 731 fi 732 733 if [ $DRYRUN = 0 ]; then 734 735 typeset RET 714 736 715 if [ ${RET} -gt 0 ] ; then 716 echo "IGCM_sys_Mv : error in mv." 717 cat out_rsync 718 IGCM_debug_Exit "IGCM_sys_Mv" 719 else 720 \rm out_rsync 721 fi 737 echo mv $@ > out_rsync 2>&1 738 \mv $@ >> out_rsync 2>&1 739 RET=$? 740 741 if [ ${RET} -gt 0 ] ; then 742 echo "IGCM_sys_Mv : error in mv." 743 cat out_rsync 744 IGCM_debug_Exit "IGCM_sys_Mv" 722 745 else 723 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 724 fi 725 726 IGCM_debug_PopStack "IGCM_sys_Mv" 746 \rm out_rsync 747 fi 748 else 749 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 750 fi 751 752 IGCM_debug_PopStack "IGCM_sys_Mv" 727 753 } 728 754 … … 733 759 #D- 734 760 function IGCM_sys_Put_Dir { 735 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 736 if ( $DEBUG_sys ) ; then 737 echo "IGCM_sys_Put_Dir :" $@ 738 fi 739 if [ $DRYRUN = 0 ]; then 740 if [ ! -d ${1} ] ; then 741 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 742 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 743 return 744 fi 745 746 typeset RET 747 748 # Only if we use rsync 749 #IGCM_sys_TestDirArchive $( dirname $2 ) 750 # 751 #USUAL WAY 752 \cp -r $1 $2 > out_rsync 2>&1 753 RET=$? 754 755 if [ ${RET} -gt 0 ] ; then 756 echo "IGCM_sys_Put_Dir : error." 757 cat out_rsync 758 IGCM_debug_Exit "IGCM_sys_Put_Dir" 759 else 760 \rm out_rsync 761 fi 761 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 762 if ( $DEBUG_sys ) ; then 763 echo "IGCM_sys_Put_Dir :" $@ 764 fi 765 if [ $DRYRUN = 0 ]; then 766 if [ ! -d ${1} ] ; then 767 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 768 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 769 return 770 fi 771 772 typeset RET 773 774 # Only if we use rsync 775 #IGCM_sys_TestDirArchive $( dirname $2 ) 776 # 777 #USUAL WAY 778 \cp -r $1 $2 > out_rsync 2>&1 779 RET=$? 780 781 if [ ${RET} -gt 0 ] ; then 782 echo "IGCM_sys_Put_Dir : error." 783 cat out_rsync 784 IGCM_debug_Exit "IGCM_sys_Put_Dir" 762 785 else 763 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 764 fi 765 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 786 \rm out_rsync 787 fi 788 else 789 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 790 fi 791 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 766 792 } 767 793 … … 772 798 #D- 773 799 function IGCM_sys_Get_Dir { 774 775 776 777 778 800 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 801 if ( $DEBUG_sys ) ; then 802 echo "IGCM_sys_Get_Dir :" $@ 803 fi 804 if [ $DRYRUN = 0 ]; then 779 805 # if [ ! -d ${1} ] ; then 780 806 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." … … 783 809 # fi 784 810 785 typeset RET 786 787 # Only if we use rsync 788 #IGCM_sys_TestDirArchive $( dirname $2 ) 789 # 790 #USUAL WAY 791 # add dmget (to demigrate all offline files) to reduce time of this command : 792 dmget $1/* 793 \cp -r $1 $2 > out_rsync 2>&1 794 RET=$? 795 796 if [ ${RET} -gt 0 ] ; then 797 echo "IGCM_sys_Get_Dir : error." 798 cat out_rsync 799 IGCM_debug_Exit "IGCM_sys_Get_Dir" 800 else 801 \rm out_rsync 802 fi 811 typeset RET 812 813 # Only if we use rsync 814 #IGCM_sys_TestDirArchive $( dirname $2 ) 815 # 816 #USUAL WAY 817 # add dmget (to demigrate all offline files) to reduce time of this command : 818 dmget $1/* 819 \cp -r $1 $2 > out_rsync 2>&1 820 RET=$? 821 822 if [ ${RET} -gt 0 ] ; then 823 echo "IGCM_sys_Get_Dir : error." 824 cat out_rsync 825 IGCM_debug_Exit "IGCM_sys_Get_Dir" 803 826 else 804 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 805 fi 806 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 827 \rm out_rsync 828 fi 829 else 830 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 831 fi 832 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 807 833 } 808 834 … … 813 839 #D- 814 840 function IGCM_sys_Get_Master { 815 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 816 if ( $DEBUG_sys ) ; then 817 echo "IGCM_sys_Get_Master :" $@ 818 fi 819 if [ $DRYRUN = 0 ]; then 820 if [ ! -d ${1} ] ; then 821 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 822 IGCM_debug_PopStack "IGCM_sys_Get_Master" 823 return 824 fi 825 826 typeset RET 827 828 #USUAL WAY 829 \cp -r $1 $2 > out_rsync 2>&1 830 RET=$? 831 832 if [ ${RET} -gt 0 ] ; then 833 echo "IGCM_sys_Get_Master : error." 834 cat out_rsync 835 IGCM_debug_Exit "IGCM_sys_Get_Master" 836 else 837 \rm out_rsync 838 fi 841 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 842 if ( $DEBUG_sys ) ; then 843 echo "IGCM_sys_Get_Master :" $@ 844 fi 845 if [ $DRYRUN = 0 ]; then 846 if [ ! -d ${1} ] ; then 847 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 848 IGCM_debug_PopStack "IGCM_sys_Get_Master" 849 return 850 fi 851 852 typeset RET 853 854 #USUAL WAY 855 \cp -r $1 $2 > out_rsync 2>&1 856 RET=$? 857 858 if [ ${RET} -gt 0 ] ; then 859 echo "IGCM_sys_Get_Master : error." 860 cat out_rsync 861 IGCM_debug_Exit "IGCM_sys_Get_Master" 839 862 else 840 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 841 fi 842 IGCM_debug_PopStack "IGCM_sys_Get_Master" 863 \rm out_rsync 864 fi 865 else 866 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 867 fi 868 IGCM_debug_PopStack "IGCM_sys_Get_Master" 843 869 } 844 870 845 871 #D-#================================================== 846 872 #D-function IGCM_sys_Put_Rest 847 #D-* Purpose: Put computied restarts on $ (ARCHIVE).873 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 848 874 #D- File and target directory must exist. 849 875 #D-* Examples: 850 876 #D- 851 877 function IGCM_sys_Put_Rest { 852 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 853 if ( $DEBUG_sys ) ; then 854 echo "IGCM_sys_Put_Rest :" $@ 855 fi 856 if [ $DRYRUN = 0 ]; then 857 if [ ! -f ${1} ] ; then 858 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 859 IGCM_debug_Exit "IGCM_sys_Put_Rest" 860 fi 861 862 typeset RET 863 # 864 if [ X${JobType} = XRUN ] ; then 865 IGCM_sys_Chmod 444 ${1} 866 fi 867 # 868 IGCM_sys_TestDirArchive $( dirname $2 ) 869 # 870 # USUAL WAY 871 putfer $1 $2 > out_rsync 2>&1 872 RET=$? 878 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 879 if ( $DEBUG_sys ) ; then 880 echo "IGCM_sys_Put_Rest :" $@ 881 fi 882 if [ $DRYRUN = 0 ]; then 883 if [ ! -f ${1} ] ; then 884 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 885 IGCM_debug_Exit "IGCM_sys_Put_Rest" 886 fi 887 888 typeset RET 889 # 890 if [ X${JobType} = XRUN ] ; then 891 IGCM_sys_Chmod 444 ${1} 892 fi 893 894 # 895 # USUAL WAY 896 \cp $1 $2 > out_rsync 2>&1 897 RET=$? 873 898 874 899 # #RSYNC WITH NETWORK SSH CALL 875 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${ RHOST}:${2} > out_rsync 2>&1876 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${ RHOST}:${2} >> out_rsync 2>&1900 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 901 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 877 902 878 903 # #RSYNC WITH NFS USE … … 886 911 # (( RET=RET+$? )) 887 912 888 if [ ${RET} -gt 0 ] ; then 889 echo "IGCM_sys_Put_Rest : error." 890 cat out_rsync 891 IGCM_debug_Exit "IGCM_sys_Put_Rest" 892 else 893 \rm out_rsync 894 fi 913 if [ ${RET} -gt 0 ] ; then 914 echo "IGCM_sys_Put_Rest : error." 915 cat out_rsync 916 IGCM_debug_Exit "IGCM_sys_Put_Rest" 895 917 else 896 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 897 fi 898 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 918 \rm out_rsync 919 fi 920 else 921 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 922 fi 923 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 924 } 925 926 #D-#================================================== 927 #D-function IGCM_sys_PutBuffer_Rest 928 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 929 #D- File and target directory must exist. 930 #D-* Examples: 931 #D- 932 function IGCM_sys_PutBuffer_Rest { 933 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 934 if ( $DEBUG_sys ) ; then 935 echo "IGCM_sys_PutBuffer_Rest :" $@ 936 fi 937 if [ $DRYRUN = 0 ]; then 938 if [ ! -f ${1} ] ; then 939 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 940 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 941 fi 942 943 typeset RET 944 # 945 if [ X${JobType} = XRUN ] ; then 946 IGCM_sys_Chmod 444 ${1} 947 fi 948 949 # 950 # USUAL WAY 951 \cp $1 $2 > out_rsync 2>&1 952 RET=$? 953 954 if [ ${RET} -gt 0 ] ; then 955 echo "IGCM_sys_PutBuffer_Rest : error." 956 cat out_rsync 957 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 958 else 959 \rm out_rsync 960 fi 961 else 962 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 963 fi 964 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 899 965 } 900 966 901 967 #D-#================================================== 902 968 #D-function IGCM_sys_Put_Out 903 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly969 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 904 970 #D-* Examples: 905 971 #D- 906 972 function IGCM_sys_Put_Out { 907 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 908 if ( $DEBUG_sys ) ; then 909 echo "IGCM_sys_Put_Out :" $@ 910 fi 911 if [ $DRYRUN = 0 ]; then 912 if [ ! -f ${1} ] ; then 913 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 914 IGCM_debug_PopStack "IGCM_sys_Put_Out" 915 return 1 916 fi 917 # 918 IGCM_sys_MkdirArchive $( dirname $2 ) 919 # 920 typeset RET exist skip 921 922 #===================================================== 923 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 924 #===================================================== 925 926 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 927 #if [ $? -eq 0 ] ; then 928 # typeset WORKPATH FILEPATH 929 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" ) 930 # IGCM_sys_MkdirWork ${WORKPATH} 931 # FILEPATH=${WORKPATH}/$( basename $2 ) 932 # # 933 # IGCM_sys_Cp ${1} ${FILEPATH} 934 #fi 935 936 if [ X${JobType} = XRUN ] ; then 937 if [ X${3} = X ] ; then 938 IGCM_sys_Chmod 444 ${1} 939 fi 940 fi 941 942 exist=false 973 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 974 if ( $DEBUG_sys ) ; then 975 echo "IGCM_sys_Put_Out :" $@ 976 fi 977 if [ $DRYRUN = 0 ]; then 978 if [ ! -f ${1} ] ; then 979 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 980 IGCM_debug_PopStack "IGCM_sys_Put_Out" 981 return 1 982 fi 983 # 984 IGCM_sys_MkdirArchive $( dirname $2 ) 985 # 986 typeset RET exist skip 987 988 #===================================================== 989 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 990 #===================================================== 991 992 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 993 #if [ $? -eq 0 ] ; then 994 # typeset WORKPATH FILEPATH 995 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 996 # IGCM_sys_MkdirWork ${WORKPATH} 997 # FILEPATH=${WORKPATH}/$( basename $2 ) 998 # # 999 # IGCM_sys_Cp ${1} ${FILEPATH} 1000 #fi 1001 1002 if [ X${JobType} = XRUN ] ; then 1003 if [ X${3} = X ] ; then 1004 IGCM_sys_Chmod 444 ${1} 1005 fi 1006 fi 1007 1008 exist=false 1009 skip=false 1010 if [ -f $2 ] ; then 1011 IGCM_debug_Print 1 "$2 already exist" 1012 dmget $2 1013 exist=true 1014 if [ "X$( diff $1 $2 )" = X ] ; then 1015 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1016 skip=true 1017 else 1018 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 943 1019 skip=false 944 if [ -f $2 ] ; then 945 IGCM_debug_Print 1 "$2 already exist" 946 dmget $2 947 exist=true 948 if [ "X$( diff $1 $2 )" = X ] ; then 949 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 950 skip=true 951 else 952 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 953 skip=false 954 fi 955 fi 956 # 957 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 958 IGCM_sys_Chmod u+w $2 959 fi 960 # USUAL WAY 961 if [ X${skip} = Xfalse ] ; then 962 \cp $1 $2 > out_rsync 2>&1 963 RET=$? 964 if [ ${RET} -gt 0 ] ; then 965 echo "IGCM_sys_Put_Out : error." 966 cat out_rsync 967 IGCM_debug_Exit "IGCM_sys_Put_Out" 968 else 969 \rm out_rsync 970 fi 971 fi 972 973 # #RSYNC WITH NETWORK RSH CALL 974 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 975 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 1020 fi 1021 fi 1022 # 1023 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1024 IGCM_sys_Chmod u+w $2 1025 fi 1026 # USUAL WAY 1027 if [ X${skip} = Xfalse ] ; then 1028 \cp $1 $2 > out_rsync 2>&1 1029 RET=$? 1030 if [ ${RET} -gt 0 ] ; then 1031 echo "IGCM_sys_Put_Out : error." 1032 cat out_rsync 1033 IGCM_debug_Exit "IGCM_sys_Put_Out" 1034 else 1035 \rm out_rsync 1036 fi 1037 fi 1038 1039 # #RSYNC WITH NETWORK SSH CALL 1040 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1041 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 976 1042 977 1043 # #RSYNC WITH NFS USE … … 985 1051 # (( RET=RET+$? )) 986 1052 1053 else 1054 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1055 fi 1056 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1057 return 0 1058 } 1059 1060 #D-#================================================== 1061 #D-function IGCM_sys_PutBuffer_Out 1062 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1063 #D-* Examples: 1064 #D- 1065 function IGCM_sys_PutBuffer_Out { 1066 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1067 if ( $DEBUG_sys ) ; then 1068 echo "IGCM_sys_PutBuffer_Out :" $@ 1069 fi 1070 if [ $DRYRUN = 0 ]; then 1071 if [ ! -f ${1} ] ; then 1072 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1073 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1074 return 1 1075 fi 1076 # 1077 IGCM_sys_Mkdir $( dirname $2 ) 1078 # 1079 typeset RET 1080 1081 if [ X${JobType} = XRUN ] ; then 1082 if [ X${3} = X ] ; then 1083 IGCM_sys_Chmod 444 ${1} 1084 fi 1085 fi 1086 # 1087 # USUAL WAY 1088 \cp $1 $2 > out_rsync 2>&1 1089 RET=$? 1090 1091 if [ ${RET} -gt 0 ] ; then 1092 echo "IGCM_sys_PutBuffer_Out : error." 1093 cat out_rsync 1094 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 987 1095 else 988 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 989 fi 990 IGCM_debug_PopStack "IGCM_sys_Put_Out" 991 return 0 1096 \rm out_rsync 1097 fi 1098 else 1099 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1100 fi 1101 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1102 return 0 992 1103 } 993 1104 … … 998 1109 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 999 1110 function IGCM_sys_Get { 1000 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1001 1002 typeset DEST RET dm_liste ifile target file_work 1003 1004 if ( $DEBUG_sys ) ; then 1005 echo "IGCM_sys_Get :" $@ 1006 fi 1007 if [ $DRYRUN -le 2 ]; then 1008 if [ X${1} = X'/l' ] ; then 1009 # test if the first file is present in the old computation : 1010 eval set +A dm_liste \${${2}} 1011 else 1012 eval set +A dm_liste ${1} 1013 fi 1014 eval DEST=\${${#}} 1015 1016 #===================================================== 1017 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1018 #===================================================== 1019 1020 # Is it an R_OUT file (not R_IN) ? 1021 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1022 #if [ $? -eq 0 ] ; then 1023 # # Yes ? then we try to get it in SCRATCHDIR 1024 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" ) 1025 # if [ -f ${file_work[0]} ] ; then 1026 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1027 # IGCM_debug_PopStack "IGCM_sys_Get" 1028 # return 1029 # fi 1030 #fi 1031 1032 # test if the (first) file is present in the old computation : 1033 IGCM_sys_TestFileArchive ${dm_liste[0]} 1034 RET=$? 1035 if [ ${RET} -gt 0 ] ; then 1036 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1037 IGCM_debug_Exit "IGCM_sys_Get" 1038 fi 1039 1040 dmget ${dm_liste[*]} > out_rsync 2>&1 1041 RET=$? 1042 1043 if [ ${RET} -gt 0 ] ; then 1044 echo "WARNING IGCM_sys_Get : demigration error." 1045 cat out_rsync 1046 echo "WARNING IGCM_sys_Get : will later stop if the cp fails." 1047 fi 1048 1049 #if [ ${RET} -gt 0 ] ; then 1050 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1051 # cat out_rsync 1052 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1053 # sleep 30 1054 # echo "We try another time" 1055 # dmget ${dm_liste[*]} > out_rsync 2>&1 1056 # RET=$? 1057 # if [ ${RET} -gt 0 ] ; then 1058 # echo "ERROR IGCM_sys_Get : again demigration error :" 1059 # cat out_rsync 1060 # IGCM_debug_Exit "IGCM_sys_Get" 1061 # fi 1062 # else 1063 # echo "ERROR IGCM_sys_Get : demigration error :" 1064 # cat out_rsync 1065 # IGCM_debug_Exit "IGCM_sys_Get" 1066 # fi 1067 #fi 1068 1069 #USUAL WAY 1070 (( RET=0 )) 1071 if [ X${1} = X'/l' ] ; then 1072 (( RET=0 )) 1073 for target in ${dm_liste[*]} ; do 1074 local_file=$( basename ${target} ) 1075 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1076 (( RET = RET + $? )) 1077 done 1078 else 1079 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1080 RET=$? 1081 fi 1082 1083 # #RSYNC WITH NETWORK RSH CALL 1084 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1085 # ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1111 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1112 1113 typeset DEST RET dm_liste ifile target file_work 1114 1115 if ( $DEBUG_sys ) ; then 1116 echo "IGCM_sys_Get :" $@ 1117 fi 1118 if [ $DRYRUN -le 2 ]; then 1119 if [ X${1} = X'/l' ] ; then 1120 # test if the first file is present in the old computation : 1121 eval set +A dm_liste \${${2}} 1122 else 1123 eval set +A dm_liste ${1} 1124 fi 1125 eval DEST=\${${#}} 1126 1127 #===================================================== 1128 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1129 #===================================================== 1130 1131 # Is it an R_OUT file (not R_IN) ? 1132 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1133 #if [ $? -eq 0 ] ; then 1134 # # Yes ? then we try to get it in SCRATCHDIR 1135 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1136 # if [ -f ${file_work[0]} ] ; then 1137 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1138 # IGCM_debug_PopStack "IGCM_sys_Get" 1139 # return 1140 # fi 1141 #fi 1142 1143 # test if the (first) file is present in the old computation : 1144 IGCM_sys_TestFileArchive ${dm_liste[0]} 1145 RET=$? 1146 if [ ${RET} -gt 0 ] ; then 1147 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1148 IGCM_debug_Exit "IGCM_sys_Get" 1149 fi 1150 1151 dmget ${dm_liste[*]} > out_rsync 2>&1 1152 RET=$? 1153 1154 if [ ${RET} -gt 0 ] ; then 1155 echo "WARNING IGCM_sys_Get : demigration error." 1156 cat out_rsync 1157 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1158 fi 1159 1160 #if [ ${RET} -gt 0 ] ; then 1161 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1162 # cat out_rsync 1163 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1164 # sleep 30 1165 # echo "We try another time" 1166 # dmget ${dm_liste[*]} > out_rsync 2>&1 1167 # RET=$? 1168 # if [ ${RET} -gt 0 ] ; then 1169 # echo "ERROR IGCM_sys_Get : again demigration error :" 1170 # cat out_rsync 1171 # IGCM_debug_Exit "IGCM_sys_Get" 1172 # fi 1173 # else 1174 # echo "ERROR IGCM_sys_Get : demigration error :" 1175 # cat out_rsync 1176 # IGCM_debug_Exit "IGCM_sys_Get" 1177 # fi 1178 #fi 1179 1180 #USUAL WAY 1181 if [ X${1} = X'/l' ] ; then 1182 (( RET=0 )) 1183 for target in ${dm_liste[*]} ; do 1184 local_file=$( basename ${target} ) 1185 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1186 (( RET = RET + $? )) 1187 done 1188 else 1189 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1190 RET=$? 1191 fi 1192 1193 # #RSYNC WITH NETWORK SSH CALL 1194 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1195 # ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1086 1196 1087 1197 # #RSYNC WITH NFS USE … … 1095 1205 # (( RET=RET+$? )) 1096 1206 1097 if [ ${RET} -gt 0 ] ; then 1098 echo "IGCM_sys_Get : copy error." 1099 cat out_rsync 1100 # IGCM_debug_Exit "IGCM_sys_Get" 1101 else 1102 \rm out_rsync 1103 fi 1207 if [ ${RET} -gt 0 ] ; then 1208 echo "IGCM_sys_Get : copy error." 1209 cat out_rsync 1210 # IGCM_debug_Exit "IGCM_sys_Get" 1104 1211 else 1105 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1106 fi 1107 IGCM_debug_PopStack "IGCM_sys_Get" 1212 \rm out_rsync 1213 fi 1214 else 1215 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1216 fi 1217 IGCM_debug_PopStack "IGCM_sys_Get" 1218 } 1219 1220 #D-#================================================== 1221 #D-function IGCM_sys_GetBuffer 1222 #D-* Purpose: Get a file from ${SCRATCHDIR} 1223 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1224 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1225 function IGCM_sys_GetBuffer { 1226 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1227 1228 typeset DEST RET buf_liste ifile target file_work 1229 1230 if ( $DEBUG_sys ) ; then 1231 echo "IGCM_sys_GetBuffer :" $@ 1232 fi 1233 if [ $DRYRUN -le 2 ]; then 1234 if [ X${1} = X'/l' ] ; then 1235 # test if the first file is present in the old computation : 1236 eval set +A buf_liste \${${2}} 1237 else 1238 eval set +A buf_liste ${1} 1239 fi 1240 eval DEST=\${${#}} 1241 1242 #USUAL WAY 1243 if [ X${1} = X'/l' ] ; then 1244 (( RET=0 )) 1245 for target in ${buf_liste[*]} ; do 1246 local_file=$( basename ${target} ) 1247 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1248 (( RET = RET + $? )) 1249 done 1250 else 1251 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1252 RET=$? 1253 fi 1254 1255 if [ ${RET} -gt 0 ] ; then 1256 echo "IGCM_sys_GetBuffer : copy error." 1257 cat out_rsync 1258 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1259 else 1260 \rm out_rsync 1261 fi 1262 else 1263 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1264 fi 1265 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1266 } 1267 1268 #D-#================================================== 1269 #D-function IGCM_sys_GetDate_FichWork 1270 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1271 #D-* Examples: 1272 #D- 1273 function IGCM_sys_GetDate_FichWork { 1274 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1275 if ( $DEBUG_sys ) ; then 1276 echo "IGCM_sys_GetDate_FichWork :" $@ 1277 fi 1278 # donne la date filesys d'un fichier sur la machine work 1279 IGCM_debug_PopStack "IGCM_sys_FichWork" 1280 } 1281 1282 #D-#================================================== 1283 #D-function IGCM_sys_GetDate_FichArchive 1284 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1285 #D-* Examples: 1286 #D- 1287 function IGCM_sys_GetDate_FichArchive { 1288 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1289 if ( $DEBUG_sys ) ; then 1290 echo "IGCM_sys_GetDate_FichArchive :" $@ 1291 fi 1292 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1108 1293 } 1109 1294 … … 1114 1299 #D- 1115 1300 function IGCM_sys_Dods_Rm { 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1301 if ( $DEBUG_sys ) ; then 1302 echo "IGCM_sys_Dods_Rm :" $@ 1303 fi 1304 typeset RET 1305 RET=0 1306 if [ $DRYRUN = 0 ]; then 1307 if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then 1308 echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." 1309 echo "Nothing has been done." 1310 return 1311 fi 1312 dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1313 RET=$? 1314 1130 1315 # if [ ${RET} -gt 0 ] ; then 1131 1316 # echo "IGCM_sys_Dods_Rm : error." … … 1136 1321 # fi 1137 1322 1138 else 1139 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1140 fi 1141 return $RET 1142 } 1143 1323 else 1324 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1325 fi 1326 return $RET 1327 } 1144 1328 1145 1329 #D-#================================================== … … 1149 1333 #D- 1150 1334 function IGCM_sys_Dods_Cp { 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1335 if ( $DEBUG_sys ) ; then 1336 echo "IGCM_sys_Dods_Cp :" $@ 1337 fi 1338 typeset RET 1339 RET=0 1340 if [ $DRYRUN = 0 ]; then 1341 if [ ! -d ${R_SAVE}/${1} ] ; then 1342 echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." 1343 echo "Nothing has been done." 1344 return 1345 fi 1346 # 1347 dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1348 RET=$? 1349 1166 1350 # if [ ${RET} -gt 0 ] ; then 1167 1351 # echo "IGCM_sys_Dods_Cp : error." … … 1172 1356 # fi 1173 1357 1174 1175 1176 1177 1358 else 1359 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1360 fi 1361 return $RET 1178 1362 } 1179 1363 … … 1184 1368 #D- 1185 1369 function IGCM_sys_Put_Dods { 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1370 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1371 if ( $DEBUG_sys ) ; then 1372 echo "IGCM_sys_Put_Dods :" $@ 1373 fi 1374 if [ $DRYRUN = 0 ]; then 1375 if [ ! -d ${R_SAVE}/${1} ] ; then 1376 echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." 1377 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1378 return 1379 fi 1380 1381 typeset RET 1198 1382 # 1199 cd ${R_SAVE} 1200 IGCM_sys_Dods_Rm ${1} 1201 IGCM_sys_Dods_Cp ${1} 1202 RET=0 1203 1204 if [ ${RET} -gt 0 ] ; then 1205 echo "IGCM_sys_Put_Dods : error." 1206 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1207 fi 1208 else 1209 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1210 fi 1211 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1212 } 1213 1214 ############################################################## A FINIR !! 1215 1216 #D-#================================================== 1217 #D-function IGCM_sys_GetDate_FichWork 1218 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1219 #D-* Examples: 1220 #D- 1221 function IGCM_sys_GetDate_FichWork { 1222 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1223 if ( $DEBUG_sys ) ; then 1224 echo "IGCM_sys_GetDate_FichWork :" $@ 1225 fi 1226 # donne la date filesys d'un fichier sur la machine work 1227 IGCM_debug_PopStack "IGCM_sys_FichWork" 1228 } 1229 1230 #D-#================================================== 1231 #D-function IGCM_sys_GetDate_FichArchive 1232 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1233 #D-* Examples: 1234 #D- 1235 function IGCM_sys_GetDate_FichArchive { 1236 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1237 if ( $DEBUG_sys ) ; then 1238 echo "IGCM_sys_GetDate_FichArchive :" $@ 1239 fi 1240 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1383 cd ${R_SAVE} 1384 IGCM_sys_Dods_Rm ${1} 1385 IGCM_sys_Dods_Cp ${1} 1386 RET=0 1387 1388 if [ ${RET} -gt 0 ] ; then 1389 echo "IGCM_sys_Put_Dods : error." 1390 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1391 fi 1392 else 1393 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1394 fi 1395 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1241 1396 } 1242 1397 … … 1245 1400 1246 1401 function IGCM_sys_rebuild { 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1402 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1403 if ( $DEBUG_sys ) ; then 1404 echo "IGCM_sys_rebuild :" $@ 1405 fi 1406 /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@ 1407 if [ $? -gt 0 ] ; then 1408 echo "IGCM_sys_rebuild : erreur ${@}." 1409 IGCM_debug_Exit "rebuild" 1410 fi 1411 1412 IGCM_debug_PopStack "IGCM_sys_rebuild" 1258 1413 } 1259 1414 … … 1262 1417 1263 1418 function IGCM_sys_ncap2 { 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1419 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1420 if ( $DEBUG_sys ) ; then 1421 echo "IGCM_sys_ncap2 :" $@ 1422 fi 1423 ncap2 "$@" 1424 if [ $? -gt 0 ] ; then 1425 echo "IGCM_sys_ncap2 : erreur ${@}." 1426 IGCM_debug_Exit "ncap2" 1427 fi 1428 1429 IGCM_debug_PopStack "IGCM_sys_ncap2" 1275 1430 } 1276 1431 1277 1432 function IGCM_sys_ncatted { 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1433 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1434 if ( $DEBUG_sys ) ; then 1435 echo "IGCM_sys_ncatted :" $@ 1436 fi 1437 ncatted "$@" 1438 if [ $? -gt 0 ] ; then 1439 echo "IGCM_sys_ncatted : erreur ${@}." 1440 IGCM_debug_Exit "ncatted" 1441 fi 1442 1443 IGCM_debug_PopStack "IGCM_sys_ncatted" 1289 1444 } 1290 1445 1291 1446 function IGCM_sys_ncbo { 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1447 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1448 if ( $DEBUG_sys ) ; then 1449 echo "IGCM_sys_ncbo :" $@ 1450 fi 1451 ncbo $@ 1452 if [ $? -gt 0 ] ; then 1453 echo "IGCM_sys_ncbo : erreur ${@}." 1454 IGCM_debug_Exit "ncbo" 1455 fi 1456 1457 IGCM_debug_PopStack "IGCM_sys_ncbo" 1303 1458 } 1304 1459 1305 1460 function IGCM_sys_ncdiff { 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1461 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1462 if ( $DEBUG_sys ) ; then 1463 echo "IGCM_sys_ncdiff :" $@ 1464 fi 1465 ncdiff $@ 1466 if [ $? -gt 0 ] ; then 1467 echo "IGCM_sys_ncdiff : erreur ${@}." 1468 IGCM_debug_Exit "ncdiff" 1469 fi 1470 1471 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1317 1472 } 1318 1473 1319 1474 function IGCM_sys_ncea { 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1475 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1476 if ( $DEBUG_sys ) ; then 1477 echo "IGCM_sys_ncea :" $@ 1478 fi 1479 ncea $@ 1480 if [ $? -gt 0 ] ; then 1481 echo "IGCM_sys_ncea : erreur ${@}." 1482 IGCM_debug_Exit "ncea" 1483 fi 1484 1485 IGCM_debug_PopStack "IGCM_sys_ncea" 1331 1486 } 1332 1487 1333 1488 function IGCM_sys_ncecat { 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1489 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1490 if ( $DEBUG_sys ) ; then 1491 echo "IGCM_sys_ncecat :" $@ 1492 fi 1493 ncecat $@ 1494 if [ $? -gt 0 ] ; then 1495 echo "IGCM_sys_ncecat : erreur ${@}." 1496 IGCM_debug_Exit "ncecat" 1497 fi 1498 1499 IGCM_debug_PopStack "IGCM_sys_ncecat" 1345 1500 } 1346 1501 1347 1502 function IGCM_sys_ncflint { 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1503 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1504 if ( $DEBUG_sys ) ; then 1505 echo "IGCM_sys_ncflint :" $@ 1506 fi 1507 ncflint $@ 1508 if [ $? -gt 0 ] ; then 1509 echo "IGCM_sys_ncflint : erreur ${@}." 1510 IGCM_debug_Exit "ncflint" 1511 fi 1512 1513 IGCM_debug_PopStack "IGCM_sys_ncflint" 1359 1514 } 1360 1515 1361 1516 function IGCM_sys_ncks { 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1517 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1518 if ( $DEBUG_sys ) ; then 1519 echo "IGCM_sys_ncks :" $@ 1520 fi 1521 ncks $@ 1522 if [ $? -gt 0 ] ; then 1523 echo "IGCM_sys_ncks : erreur ${@}." 1524 IGCM_debug_Exit "ncks" 1525 fi 1526 1527 IGCM_debug_PopStack "IGCM_sys_ncks" 1373 1528 } 1374 1529 1375 1530 function IGCM_sys_ncpdq { 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1531 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1532 if ( $DEBUG_sys ) ; then 1533 echo "IGCM_sys_ncpdq :" $@ 1534 fi 1535 ncpdq $@ 1536 if [ $? -gt 0 ] ; then 1537 echo "IGCM_sys_ncpdq : erreur ${@}." 1538 IGCM_debug_Exit "ncpdq" 1539 fi 1540 1541 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1387 1542 } 1388 1543 1389 1544 function IGCM_sys_ncra { 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1545 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1546 if ( $DEBUG_sys ) ; then 1547 echo "IGCM_sys_ncra :" $@ 1548 fi 1549 ncra $@ 1550 if [ $? -gt 0 ] ; then 1551 echo "IGCM_sys_ncra : erreur ${@}." 1552 IGCM_debug_Exit "ncra" 1553 fi 1554 1555 IGCM_debug_PopStack "IGCM_sys_ncra" 1401 1556 } 1402 1557 1403 1558 function IGCM_sys_ncrcat { 1404 1405 1406 1407 1408 1409 1410 1559 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1560 if ( $DEBUG_sys ) ; then 1561 echo "IGCM_sys_ncrcat :" $@ 1562 fi 1563 ncrcat $@ 1564 if [ $? -gt 0 ] ; then 1565 echo "IGCM_sys_ncrcat : erreur ${@}." 1411 1566 # IGCM_debug_Exit "ncrcat" 1412 1413 1414 1567 fi 1568 1569 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1415 1570 } 1416 1571 1417 1572 function IGCM_sys_ncrename { 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1573 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1574 if ( $DEBUG_sys ) ; then 1575 echo "IGCM_sys_ncrename :" $@ 1576 fi 1577 ncrename $@ 1578 if [ $? -gt 0 ] ; then 1579 echo "IGCM_sys_ncrename : erreur ${@}." 1580 IGCM_debug_Exit "ncrename" 1581 fi 1582 1583 IGCM_debug_PopStack "IGCM_sys_ncrename" 1429 1584 } 1430 1585 1431 1586 function IGCM_sys_ncwa { 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1587 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1588 if ( $DEBUG_sys ) ; then 1589 echo "IGCM_sys_ncwa :" $@ 1590 fi 1591 ncwa $@ 1592 if [ $? -gt 0 ] ; then 1593 echo "IGCM_sys_ncwa : erreur ${@}." 1594 IGCM_debug_Exit "ncwa" 1595 fi 1596 1597 IGCM_debug_PopStack "IGCM_sys_ncwa" 1443 1598 } 1444 1599 … … 1447 1602 1448 1603 function IGCM_sys_cdo { 1449 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1450 1451 \cdo $@ 1452 if [ $? -gt 0 ] ; then 1453 echo "IGCM_sys_cdo : erreur ${@}." 1454 IGCM_debug_PopStack "IGCM_sys_cdo" 1455 return 1 1456 else 1457 IGCM_debug_PopStack "IGCM_sys_cdo" 1458 return 0 1459 fi 1460 1604 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1605 if ( $DEBUG_sys ) ; then 1606 echo "IGCM_sys_cdo :" $@ 1607 fi 1608 \cdo $@ 1609 if [ $? -gt 0 ] ; then 1610 echo "IGCM_sys_cdo : erreur ${@}." 1461 1611 IGCM_debug_PopStack "IGCM_sys_cdo" 1612 return 1 1613 else 1614 IGCM_debug_PopStack "IGCM_sys_cdo" 1615 return 0 1616 fi 1617 1618 IGCM_debug_PopStack "IGCM_sys_cdo" 1462 1619 } 1463 1620 … … 1466 1623 1467 1624 function IGCM_sys_activ_variables { 1468 1469 1470 1471 1472 1625 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1626 if ( $DEBUG_sys ) ; then 1627 echo "IGCM_sys_activ_variables" 1628 fi 1629 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1473 1630 } 1474 1631 … … 1477 1634 1478 1635 function IGCM_sys_desactiv_variables { 1479 1480 1481 1482 1483 1636 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1637 if ( $DEBUG_sys ) ; then 1638 echo "IGCM_sys_desactiv_variables" 1639 fi 1640 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1484 1641 } 1485 1642 … … 1488 1645 1489 1646 function IGCM_sys_build_run_file { 1490 1491 1492 1493 1494 1495 } 1647 IGCM_debug_PushStack "IGCM_sys_build_run_file" 1648 if ( $DEBUG_sys ) ; then 1649 echo "IGCM_sys_build_run_file" 1650 fi 1651 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1652 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex8.ksh
r539 r544 137 137 138 138 #==================================================== 139 #- OUT139 #- R_OUT 140 140 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 141 142 #==================================================== 143 #- R_BUF (ONLY FOR double copy an scratch) 144 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 145 146 #==================================================== 147 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 148 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 141 149 142 150 #==================================================== … … 149 157 150 158 #==================================================== 151 #- BIG_DIR : BIG_DIR to store files waiting for rebuild152 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}153 154 #====================================================155 159 #- HOST_MPIRUN_COMMAND 156 160 typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"} … … 166 170 #D- 167 171 function IGCM_sys_RshMaster { 168 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 169 ssh -t ${MASTER} /bin/ksh <<-EOF 170 export libIGCM=${libIGCM} 171 export DEBUG_debug=${DEBUG_debug} 172 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 173 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh 172 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 173 ssh -t ${MASTER} /bin/ksh <<-EOF 174 export libIGCM=${libIGCM} 175 export DEBUG_debug=${DEBUG_debug} 176 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 177 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh 178 ${@} 179 EOF 180 if [ $? -gt 0 ] ; then 181 echo "IGCM_sys_RshMaster : erreur." 182 IGCM_debug_Exit "IGCM_sys_RshMaster" 183 fi 184 IGCM_debug_PopStack "IGCM_sys_RshMaster" 185 } 186 187 #D-#================================================== 188 #D-function IGCM_sys_RshArchive 189 #D-* Purpose: Archive rsh command 190 #D-* Examples: 191 #D- 192 function IGCM_sys_RshArchive { 193 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 194 /bin/ksh <<-EOF 174 195 ${@} 175 196 EOF 176 if [ $? -gt 0 ] ; then 177 echo "IGCM_sys_RshMaster : erreur." 178 IGCM_debug_Exit "IGCM_sys_RshMaster" 179 fi 180 IGCM_debug_PopStack "IGCM_sys_RshMaster" 181 } 182 183 #D-#================================================== 184 #D-function IGCM_sys_RshArchive 185 #D-* Purpose: Archive rsh command 186 #D-* Examples: 187 #D- 188 function IGCM_sys_RshArchive { 189 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 190 /bin/ksh <<-EOF 191 ${@} 192 EOF 193 if [ $? -gt 0 ] ; then 194 echo "IGCM_sys_RshArchive : erreur." 195 IGCM_debug_Exit "IGCM_sys_RshArchive" 196 fi 197 IGCM_debug_PopStack "IGCM_sys_RshArchive" 197 if [ $? -gt 0 ] ; then 198 echo "IGCM_sys_RshArchive : erreur." 199 IGCM_debug_Exit "IGCM_sys_RshArchive" 200 fi 201 IGCM_debug_PopStack "IGCM_sys_RshArchive" 198 202 } 199 203 … … 204 208 #D- 205 209 function IGCM_sys_RshPost { 206 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 207 if ( $DEBUG_sys ) ; then 208 echo "IGCM_sys_RshPost :" $@ 209 fi 210 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 211 if ( $DEBUG_sys ) ; then 212 echo "IGCM_sys_RshPost :" $@ 213 fi 214 215 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 216 #cat tmp_IGCM_sys_RshPost_$$ 217 # keep standard input (stdin) for the loop onto temporary file 218 cat >tmp_IGCM_sys_RshPost_$$ 219 220 # ============ FRONTEND START ============ # 221 222 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 223 if [ $? -gt 0 ] ; then 224 echo "IGCM_sys_RshPost : erreur." 225 IGCM_debug_Exit "IGCM_sys_RshPost" 226 fi 227 \rm tmp_IGCM_sys_RshPost_$$ 228 229 # ============ FRONTEND END ============ # 210 230 211 231 # ============ CESIUM START ============ # 212 # typeset NB_ESSAI DELAI status 213 # #nombre d'essai avant abandon 214 # NB_ESSAI=5 215 # #temps entre chaque essai 216 # DELAI=10 217 # i=0 218 # while [ $i -ne $NB_ESSAI ] ; do 219 # ssh -t mercure ssh cesium /bin/ksh ${@} 2>/dev/null 220 # status=$? 221 # if [ ${status} -ne 0 ]; 222 # then 223 # sleep $DELAI 224 # else 225 # break 226 # fi 227 # let i=$i+1 228 # done 232 # typeset NB_ESSAI DELAI status i 233 # # number of tentative 234 # NB_ESSAI=10 235 # # time delay between tentative 236 # DELAI=10 237 # (( i = 0 )) 238 # while [ $i -lt $NB_ESSAI ] ; do 239 # ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 240 # status=$? 241 # if [ ${status} -gt 0 ]; then 242 # IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}" 243 # IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again." 244 # sleep $DELAI 245 # else 246 # break 247 # fi 248 # (( i = i + 1 )) 249 # done 250 # # delete temporary file 251 # /bin/rm tmp_IGCM_sys_RshPost_$$ 229 252 # ============ CESIUM END ============ # 230 253 231 /bin/ksh ${@} 232 if [ $? -gt 0 ] ; then 233 echo "IGCM_sys_RshPost : erreur." 234 IGCM_debug_Exit "IGCM_sys_RshPost" 235 fi 236 IGCM_debug_PopStack "IGCM_sys_RshPost" 254 IGCM_debug_PopStack "IGCM_sys_RshPost" 237 255 } 238 256 … … 243 261 #D- 244 262 function IGCM_sys_SendMail { 245 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 246 if ( $DEBUG_sys ) ; then 247 echo "IGCM_sys_SendMail :" $@ 248 fi 249 250 if ( ${ExitFlag} ) ; then 251 status=failed 252 # Nothing fo now 253 else 254 status=completed 255 fi 256 257 ssh ${MASTER} /bin/ksh <<-EOF 258 export LOGIN=${LOGIN} 259 export config_UserChoices_JobName=${config_UserChoices_JobName} 260 export config_UserChoices_MailName=${config_UserChoices_MailName} 261 export DateBegin=${DateBegin} 262 export DateEnd=${DateEnd} 263 export R_SAVE=${R_SAVE} 264 export SUBMIT_DIR=${SUBMIT_DIR} 265 export status=${status} 266 267 cat << END_MAIL > job_end.mail 268 Dear ${LOGIN}, 263 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 264 if ( $DEBUG_sys ) ; then 265 echo "IGCM_sys_SendMail :" $@ 266 fi 267 268 if ( ${ExitFlag} ) ; then 269 status=failed 270 else 271 status=completed 272 fi 273 274 ssh ${MASTER} /bin/ksh <<-EOF 275 export LOGIN=${LOGIN} 276 export config_UserChoices_JobName=${config_UserChoices_JobName} 277 export config_UserChoices_MailName=${config_UserChoices_MailName} 278 export DateBegin=${DateBegin} 279 export DateEnd=${DateEnd} 280 export R_SAVE=${R_SAVE} 281 export SUBMIT_DIR=${SUBMIT_DIR} 282 export status=${status} 283 284 cat << END_MAIL > job_end.mail 285 Dear ${LOGIN}, 269 286 270 287 Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. … … 275 292 END_MAIL 276 293 277 if [ ! -z ${config_UserChoices_MailName}] ; then278 279 280 281 282 283 284 294 if [ X"${config_UserChoices_MailName}" != X ] ; then 295 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 296 elif [ -f ~/.forward ] ; then 297 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 298 fi 299 300 sleep 10 301 rm -f job_end.mail 285 302 EOF 286 303 287 288 289 290 291 304 if [ $? -gt 0 ] ; then 305 echo "IGCM_sys_SendMail : erreur." 306 IGCM_debug_Exit "IGCM_sys_SendMail" 307 fi 308 IGCM_debug_PopStack "IGCM_sys_SendMail" 292 309 } 293 310 … … 298 315 #D- 299 316 function IGCM_sys_Mkdir { 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 318 if ( $DEBUG_sys ) ; then 319 echo "IGCM_sys_Mkdir :" $@ 320 fi 321 if [ ! -d ${1} ]; then 322 \mkdir -p $1 323 if [ $? -gt 0 ] ; then 324 echo "IGCM_sys_Mkdir : erreur." 325 IGCM_debug_Exit "IGCM_sys_Mkdir" 326 fi 327 fi 328 # vérification : 329 if [ ! -d ${1} ] ; then 330 echo "IGCM_sys_Mkdir : erreur." 331 IGCM_debug_Exit "IGCM_sys_Mkdir" 332 fi 333 IGCM_debug_PopStack "IGCM_sys_Mkdir" 317 334 } 318 335 … … 323 340 #D- 324 341 function IGCM_sys_MkdirArchive { 325 326 327 328 329 330 331 332 333 334 335 336 337 342 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 343 if ( $DEBUG_sys ) ; then 344 echo "IGCM_sys_MkdirArchive :" $@ 345 fi 346 #- creation de repertoire sur le serveur fichier 347 if [ ! -d ${1} ]; then 348 \mkdir -p $1 349 if [ $? -gt 0 ] ; then 350 echo "IGCM_sys_MkdirArchive : erreur." 351 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 352 fi 353 fi 354 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 338 355 } 339 356 … … 344 361 #D- 345 362 function IGCM_sys_MkdirWork { 346 347 348 349 350 351 352 353 354 355 356 357 358 363 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 364 if ( $DEBUG_sys ) ; then 365 echo "IGCM_sys_MkdirWork :" $@ 366 fi 367 #- creation de repertoire sur le serveur fichier 368 if [ ! -d ${1} ]; then 369 \mkdir -p $1 370 if [ $? -gt 0 ] ; then 371 echo "IGCM_sys_MkdirWork : erreur." 372 IGCM_debug_Exit "IGCM_sys_MkdirWork" 373 fi 374 fi 375 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 359 376 } 360 377 … … 365 382 #D- 366 383 function IGCM_sys_Cd { 367 368 369 370 371 372 373 374 375 376 384 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 385 if ( $DEBUG_sys ) ; then 386 echo "IGCM_sys_Cd :" $@ 387 fi 388 \cd $1 389 if [ $? -gt 0 ] ; then 390 echo "IGCM_sys_Cd : erreur." 391 IGCM_debug_Exit "IGCM_sys_Cd" 392 fi 393 IGCM_debug_PopStack "IGCM_sys_Cd" 377 394 } 378 395 … … 383 400 #D- 384 401 function IGCM_sys_Chmod { 385 386 387 388 389 390 391 392 393 394 395 396 397 398 402 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 403 if ( $DEBUG_sys ) ; then 404 echo "IGCM_sys_Chmod :" $@ 405 fi 406 if [ $DRYRUN -le 1 ]; then 407 \chmod $@ 408 if [ $? -gt 0 ] ; then 409 echo "IGCM_sys_Chmod : erreur." 410 IGCM_debug_Exit "IGCM_sys_Chmod" 411 fi 412 else 413 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 414 fi 415 IGCM_debug_PopStack "IGCM_sys_Chmod" 399 416 } 400 417 … … 405 422 #D- 406 423 function IGCM_sys_FileSize { 407 408 409 410 411 412 413 414 415 416 424 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 425 426 typeset sizeF 427 set +A sizeF -- $( ls -la ${1} ) 428 if [ $? -gt 0 ] ; then 429 IGCM_debug_Exit "IGCM_sys_FileSize" 430 fi 431 eval ${2}=${sizeF[4]} 432 433 IGCM_debug_PopStack "IGCM_sys_FileSize" 417 434 } 418 435 … … 423 440 #D- 424 441 function IGCM_sys_TestDir { 425 426 427 428 429 430 431 432 433 442 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 443 if ( $DEBUG_sys ) ; then 444 echo "IGCM_sys_TestDir :" $@ 445 fi 446 typeset ExistFlag 447 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 448 IGCM_debug_PopStack "IGCM_sys_TestDir" 449 450 return ${ExistFlag} 434 451 } 435 452 … … 440 457 #D- 441 458 function IGCM_sys_TestDirArchive { 442 443 444 445 446 447 448 449 450 459 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 460 if ( $DEBUG_sys ) ; then 461 echo "IGCM_sys_TestDirArchive :" $@ 462 fi 463 typeset ExistFlag 464 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 465 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 466 467 return ${ExistFlag} 451 468 } 452 469 … … 457 474 #D- 458 475 function IGCM_sys_TestFileArchive { 459 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 460 typeset ExistFlag 461 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 462 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 463 464 return ${ExistFlag} 476 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 477 if ( $DEBUG_sys ) ; then 478 echo "IGCM_sys_TestFileArchive :" $@ 479 fi 480 typeset ExistFlag 481 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 482 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 483 484 return ${ExistFlag} 485 } 486 487 #D-#================================================== 488 #D-function IGCM_sys_TestFileBuffer 489 #D-* Purpose: Test file that must NOT EXISTS on Buffer 490 #D-* Examples: 491 #D- 492 function IGCM_sys_TestFileBuffer { 493 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 494 typeset ExistFlag 495 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 496 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 497 498 return ${ExistFlag} 465 499 } 466 500 … … 471 505 #D- 472 506 function IGCM_sys_CountFileArchive { 473 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 474 ls ${@} 2>/dev/null | wc -l 475 if [ $? -gt 0 ] ; then 476 echo "IGCM_sys_CountFileArchive : erreur." 477 fi 478 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 507 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 508 ls ${@} 2>/dev/null | wc -l 509 if [ $? -gt 0 ] ; then 510 echo "IGCM_sys_CountFileArchive : erreur." 511 fi 512 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 513 } 514 515 #D-#================================================== 516 #D-function IGCM_sys_CountFileBuffer 517 #D-* Purpose: Count files on Scratch filesystem 518 #D-* Examples: 519 #D- 520 function IGCM_sys_CountFileBuffer { 521 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 522 ls ${@} 2>/dev/null | wc -l 523 if [ $? -gt 0 ] ; then 524 echo "IGCM_sys_CountFileBuffer : erreur." 525 fi 526 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 479 527 } 480 528 … … 485 533 #D- 486 534 function IGCM_sys_Tree { 487 488 489 490 491 492 493 494 535 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 536 if ( $DEBUG_sys ) ; then 537 echo "IGCM_sys_Tree :" $@ 538 fi 539 540 \ls -lR ${@} 541 542 IGCM_debug_PopStack "IGCM_sys_Tree" 495 543 } 496 544 497 545 #D-#================================================== 498 546 #D-function IGCM_sys_Tar 499 #D-* Purpose: master un-tar command547 #D-* Purpose: master tar command 500 548 #D-* Examples: 501 549 #D- 502 550 function IGCM_sys_Tar { 503 504 505 506 507 508 509 510 511 512 551 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 552 if ( $DEBUG_sys ) ; then 553 echo "IGCM_sys_Tar :" $@ 554 fi 555 \tar cf $@ 556 if [ $? -gt 0 ] ; then 557 echo "IGCM_sys_Tar : erreur." 558 IGCM_debug_Exit "IGCM_sys_Tar" 559 fi 560 IGCM_debug_PopStack "IGCM_sys_Tar" 513 561 } 514 562 … … 519 567 #D- 520 568 function IGCM_sys_UnTar { 521 522 523 524 525 526 527 528 529 530 569 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 570 if ( $DEBUG_sys ) ; then 571 echo "IGCM_sys_UnTar :" $@ 572 fi 573 \tar xvf $1 574 if [ $? -gt 0 ] ; then 575 echo "IGCM_sys_UnTar : erreur." 576 IGCM_debug_Exit "IGCM_sys_UnTar" 577 fi 578 IGCM_debug_PopStack "IGCM_sys_UnTar" 531 579 } 532 580 … … 537 585 #D- 538 586 function IGCM_sys_Qsub { 539 540 541 542 543 544 545 546 547 548 587 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 588 if ( $DEBUG_sys ) ; then 589 echo "IGCM_sys_Qsub :" $@ 590 fi 591 /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 592 if [ $? -gt 0 ] ; then 593 echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@." 594 IGCM_debug_Exit "IGCM_sys_Qsub" 595 fi 596 IGCM_debug_PopStack "IGCM_sys_Qsub" 549 597 } 550 598 … … 555 603 #D- 556 604 function IGCM_sys_QsubPost { 557 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 558 if ( $DEBUG_sys ) ; then 559 echo "IGCM_sys_QsubPost :" $@ 560 fi 561 # ============ CESIUM START ============ # 562 #/usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 563 # ============ CESIUM END ============ # 564 /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv} 565 if [ $? -gt 0 ] ; then 566 echo "IGCM_sys_QsubPost : erreur " $@ 567 IGCM_debug_Exit "IGCM_sys_QsubPost" 568 fi 569 IGCM_debug_PopStack "IGCM_sys_QsubPost" 605 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 606 if ( $DEBUG_sys ) ; then 607 echo "IGCM_sys_QsubPost :" $@ 608 fi 609 610 # ============ FRONTEND START ============ # 611 612 /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv} 613 614 # ============ FRONTEND END ============ # 615 616 # ============ CESIUM START ============ # 617 618 # typeset NB_ESSAI DELAI status i 619 # # number of tentative 620 # NB_ESSAI=10 621 # # time delay between tentative 622 # DELAI=10 623 # (( i = 0 )) 624 # while [ $i -lt $NB_ESSAI ] ; do 625 # /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 626 # status=$? 627 # if [ ${status} -gt 0 ]; then 628 # sleep $DELAI 629 # else 630 # break 631 # fi 632 # (( i = i + 1 )) 633 # done 634 635 # ============ CESIUM END ============ # 636 637 if [ $? -gt 0 ] ; then 638 echo "IGCM_sys_QsubPost : erreur " $@ 639 IGCM_debug_Exit "IGCM_sys_QsubPost" 640 fi 641 IGCM_debug_PopStack "IGCM_sys_QsubPost" 570 642 } 571 643 … … 581 653 #D- Error values and explanations can depend on your system version. 582 654 function IGCM_sys_Rsync_out { 583 RET=$1 584 if [ ! $RET ] ; then 585 echo "rsync error !" 586 fi 587 588 if [ $MYLANG = "fr" ]; then 589 case $RET in 590 0) return ;; 591 1) echo "Erreur de rsync ; RERR_SYNTAX : " 592 echo "Erreur de syntaxe ou d'utilisation." 593 return;; 594 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 595 echo "Incompatibilité de protocole." 596 return;; 597 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 598 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 599 echo "répertoires" 600 return;; 601 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 602 echo "Action demandée non supportée : une tentative de manipulation de" 603 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 604 echo "été faite ; ou une option qui est supportée par le client mais" 605 echo "pas par le serveur a été spécifiée." 606 return;; 607 10) echo "Erreur de rsync ; RERR_SOCKETIO" 608 echo "Erreur dans le socket d'entrée sortie" 609 return;; 610 11) echo "Erreur de rsync ; RERR_FILEIO" 611 echo "Erreur d'entrée sortie fichier" 612 return;; 613 12) echo "Erreur de rsync ; RERR_STREAMIO" 614 echo "Erreur dans flux de donnée du protocole rsync" 615 return;; 616 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 617 echo "Erreur avec les diagnostics du programme" 618 return;; 619 14) echo "Erreur de rsync ; RERR_IPC" 620 echo "Erreur dans le code IPC" 621 return;; 622 20) echo "Erreur de rsync ; RERR_SIGNAL" 623 echo "SIGUSR1 ou SIGINT reçu" 624 return;; 625 21) echo "Erreur de rsync ; RERR_WAITCHILD" 626 echo "Une erreur retournée par waitpid()" 627 return;; 628 22) echo "Erreur de rsync ; RERR_MALLOC" 629 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 630 return;; 631 23) echo "" 632 echo "Erreur fichier inexistant" 633 return;; 634 30) echo "Erreur de rsync ; RERR_TIMEOUT" 635 echo "Temps d'attente écoulé dans l'envoi/réception de données" 636 return;; 637 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 638 return;; 639 esac 640 elif [ $MYLANG = "en" ] ; then 641 case $RET in 642 0) return;; 643 1) echo "rsync error : Syntax or usage error " 644 return;; 645 2) echo "rsync error : Protocol incompatibility " 646 return;; 647 3) echo "rsync error : Errors selecting input/output files, dirs" 648 return;; 649 4) echo "rsync error : Requested action not supported: an attempt" 650 echo "was made to manipulate 64-bit files on a platform that cannot support" 651 echo "them; or an option was specified that is supported by the client and" 652 echo "not by the server." 653 return;; 654 5) echo "rsync error : Error starting client-server protocol" 655 return;; 656 10) echo "rsync error : Error in socket I/O " 657 return;; 658 11) echo "rsync error : Error in file I/O " 659 return;; 660 12) echo "rsync error : Error in rsync protocol data stream " 661 return;; 662 13) echo "rsync error : Errors with program diagnostics " 663 return;; 664 14) echo "rsync error : Error in IPC code " 665 return;; 666 20) echo "rsync error : Received SIGUSR1 or SIGINT " 667 return;; 668 21) echo "rsync error : Some error returned by waitpid() " 669 return;; 670 22) echo "rsync error : Error allocating core memory buffers " 671 return;; 672 23) echo "rsync error : Partial transfer due to error" 673 return;; 674 24) echo "rsync error : Partial transfer due to vanished source files" 675 return;; 676 30) echo "rsync error : Timeout in data send/receive " 677 return;; 678 *) echo "rsync error : return code of rsync unknown :" $RET 679 return;; 680 esac 681 else 682 echo "unknown language $MYLANG." 683 return 684 fi 685 } 686 655 RET=$1 656 if [ ! $RET ] ; then 657 echo "rsync error !" 658 fi 659 660 if [ $MYLANG = "fr" ]; then 661 case $RET in 662 0) return ;; 663 1) echo "Erreur de rsync ; RERR_SYNTAX : " 664 echo "Erreur de syntaxe ou d'utilisation." 665 return;; 666 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 667 echo "Incompatibilité de protocole." 668 return;; 669 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 670 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 671 echo "répertoires" 672 return;; 673 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 674 echo "Action demandée non supportée : une tentative de manipulation de" 675 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 676 echo "été faite ; ou une option qui est supportée par le client mais" 677 echo "pas par le serveur a été spécifiée." 678 return;; 679 10) echo "Erreur de rsync ; RERR_SOCKETIO" 680 echo "Erreur dans le socket d'entrée sortie" 681 return;; 682 11) echo "Erreur de rsync ; RERR_FILEIO" 683 echo "Erreur d'entrée sortie fichier" 684 return;; 685 12) echo "Erreur de rsync ; RERR_STREAMIO" 686 echo "Erreur dans flux de donnée du protocole rsync" 687 return;; 688 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 689 echo "Erreur avec les diagnostics du programme" 690 return;; 691 14) echo "Erreur de rsync ; RERR_IPC" 692 echo "Erreur dans le code IPC" 693 return;; 694 20) echo "Erreur de rsync ; RERR_SIGNAL" 695 echo "SIGUSR1 ou SIGINT reçu" 696 return;; 697 21) echo "Erreur de rsync ; RERR_WAITCHILD" 698 echo "Une erreur retournée par waitpid()" 699 return;; 700 22) echo "Erreur de rsync ; RERR_MALLOC" 701 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 702 return;; 703 23) echo "" 704 echo "Erreur fichier inexistant" 705 return;; 706 30) echo "Erreur de rsync ; RERR_TIMEOUT" 707 echo "Temps d'attente écoulé dans l'envoi/réception de données" 708 return;; 709 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 710 return;; 711 esac 712 elif [ $MYLANG = "en" ] ; then 713 case $RET in 714 0) return;; 715 1) echo "rsync error : Syntax or usage error " 716 return;; 717 2) echo "rsync error : Protocol incompatibility " 718 return;; 719 3) echo "rsync error : Errors selecting input/output files, dirs" 720 return;; 721 4) echo "rsync error : Requested action not supported: an attempt" 722 echo "was made to manipulate 64-bit files on a platform that cannot support" 723 echo "them; or an option was specified that is supported by the client and" 724 echo "not by the server." 725 return;; 726 5) echo "rsync error : Error starting client-server protocol" 727 return;; 728 10) echo "rsync error : Error in socket I/O " 729 return;; 730 11) echo "rsync error : Error in file I/O " 731 return;; 732 12) echo "rsync error : Error in rsync protocol data stream " 733 return;; 734 13) echo "rsync error : Errors with program diagnostics " 735 return;; 736 14) echo "rsync error : Error in IPC code " 737 return;; 738 20) echo "rsync error : Received SIGUSR1 or SIGINT " 739 return;; 740 21) echo "rsync error : Some error returned by waitpid() " 741 return;; 742 22) echo "rsync error : Error allocating core memory buffers " 743 return;; 744 23) echo "rsync error : Partial transfer due to error" 745 return;; 746 24) echo "rsync error : Partial transfer due to vanished source files" 747 return;; 748 30) echo "rsync error : Timeout in data send/receive " 749 return;; 750 *) echo "rsync error : return code of rsync unknown :" $RET 751 return;; 752 esac 753 else 754 echo "unknown language $MYLANG." 755 return 756 fi 757 } 687 758 688 759 #D-#================================================== … … 692 763 #D- 693 764 function IGCM_sys_Mirror_libIGCM { 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 765 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 766 if ( $DEBUG_sys ) ; then 767 echo "IGCM_sys_Mirror_libIGCM" 768 fi 769 770 typeset RET DEST 771 772 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 773 774 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 775 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 776 RET=$? 777 778 if [ ${RET} -gt 0 ] ; then 779 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 780 cat out_rsync 781 fi 782 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 712 783 } 713 784 … … 715 786 #- Call IGCM_sys_Mirror_libIGCM now ! 716 787 if ( $MirrorlibIGCM ) ; then 717 788 IGCM_sys_Mirror_libIGCM 718 789 fi 719 790 … … 724 795 #D- 725 796 function IGCM_sys_Cp { 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 797 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 798 if ( $DEBUG_sys ) ; then 799 echo "IGCM_sys_Cp :" $@ 800 fi 801 802 typeset RET 803 804 echo cp $@ > out_rsync 2>&1 805 \cp $@ >> out_rsync 2>&1 806 RET=$? 807 808 if [ ${RET} -gt 0 ] ; then 809 echo "IGCM_sys_Cp : error." 810 cat out_rsync 811 IGCM_debug_Exit "IGCM_sys_Cp" 812 else 813 \rm out_rsync 814 fi 815 IGCM_debug_PopStack "IGCM_sys_Cp" 745 816 } 746 817 … … 751 822 #D- 752 823 function IGCM_sys_Rm { 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 824 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 825 if ( $DEBUG_sys ) ; then 826 echo "IGCM_sys_Rm :" $@ 827 fi 828 829 typeset RET 830 831 echo rm $@ > out_rsync 2>&1 832 \rm $@ >> out_rsync 2>&1 833 RET=$? 834 835 if [ ${RET} -gt 0 ] ; then 836 echo "IGCM_sys_Rm : error." 837 cat out_rsync 838 IGCM_debug_Exit "IGCM_sys_Rm" 839 else 840 \rm out_rsync 841 fi 842 IGCM_debug_PopStack "IGCM_sys_Rm" 772 843 } 773 844 … … 778 849 #D- 779 850 function IGCM_sys_Mv { 780 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 781 if ( $DEBUG_sys ) ; then 782 echo "IGCM_sys_Mv :" $@ 783 fi 784 785 if [ $DRYRUN = 0 ]; then 786 787 typeset RET 788 789 echo mv $@ > out_rsync 2>&1 790 \mv $@ >> out_rsync 2>&1 791 RET=$? 851 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 852 if ( $DEBUG_sys ) ; then 853 echo "IGCM_sys_Mv :" $@ 854 fi 855 856 if [ $DRYRUN = 0 ]; then 857 858 typeset RET 792 859 793 if [ ${RET} -gt 0 ] ; then 794 echo "IGCM_sys_Mv : error in mv." 795 cat out_rsync 796 IGCM_debug_Exit "IGCM_sys_Mv" 797 else 798 \rm out_rsync 799 fi 860 echo mv $@ > out_rsync 2>&1 861 \mv $@ >> out_rsync 2>&1 862 RET=$? 863 864 if [ ${RET} -gt 0 ] ; then 865 echo "IGCM_sys_Mv : error in mv." 866 cat out_rsync 867 IGCM_debug_Exit "IGCM_sys_Mv" 800 868 else 801 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 802 fi 803 804 IGCM_debug_PopStack "IGCM_sys_Mv" 869 \rm out_rsync 870 fi 871 else 872 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 873 fi 874 875 IGCM_debug_PopStack "IGCM_sys_Mv" 805 876 } 806 877 … … 811 882 #D- 812 883 function IGCM_sys_Put_Dir { 813 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 814 if ( $DEBUG_sys ) ; then 815 echo "IGCM_sys_Put_Dir :" $@ 816 fi 817 if [ $DRYRUN = 0 ]; then 818 if [ ! -d ${1} ] ; then 819 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 820 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 821 return 822 fi 823 824 typeset RET 825 826 # Only if we use rsync 827 #IGCM_sys_TestDirArchive $( dirname $2 ) 828 # 829 #USUAL WAY 830 \cp -r $1 $2 > out_rsync 2>&1 831 RET=$? 832 833 if [ ${RET} -gt 0 ] ; then 834 echo "IGCM_sys_Put_Dir : error." 835 cat out_rsync 836 IGCM_debug_Exit "IGCM_sys_Put_Dir" 837 else 838 \rm out_rsync 839 fi 884 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 885 if ( $DEBUG_sys ) ; then 886 echo "IGCM_sys_Put_Dir :" $@ 887 fi 888 if [ $DRYRUN = 0 ]; then 889 if [ ! -d ${1} ] ; then 890 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 891 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 892 return 893 fi 894 895 typeset RET 896 897 # Only if we use rsync 898 #IGCM_sys_TestDirArchive $( dirname $2 ) 899 # 900 #USUAL WAY 901 \cp -r $1 $2 > out_rsync 2>&1 902 RET=$? 903 904 if [ ${RET} -gt 0 ] ; then 905 echo "IGCM_sys_Put_Dir : error." 906 cat out_rsync 907 IGCM_debug_Exit "IGCM_sys_Put_Dir" 840 908 else 841 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 842 fi 843 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 909 \rm out_rsync 910 fi 911 else 912 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 913 fi 914 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 844 915 } 845 916 846 917 #D-#================================================== 847 918 #D-function IGCM_sys_Get_Dir 848 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)919 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 849 920 #D-* Examples: 850 921 #D- 851 922 function IGCM_sys_Get_Dir { 852 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 853 if ( $DEBUG_sys ) ; then 854 echo "IGCM_sys_Get_Dir :" $@ 855 fi 856 if [ $DRYRUN = 0 ]; then 857 if [ ! -d ${1} ] ; then 858 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 859 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 860 return 861 fi 862 863 typeset RET 864 865 # Only if we use rsync 866 #IGCM_sys_TestDirArchive $( dirname $2 ) 867 # 868 #USUAL WAY 869 \cp -r $1 $2 > out_rsync 2>&1 870 RET=$? 871 872 if [ ${RET} -gt 0 ] ; then 873 echo "IGCM_sys_Get_Dir : error." 874 cat out_rsync 875 IGCM_debug_Exit "IGCM_sys_Get_Dir" 876 else 877 \rm out_rsync 878 fi 923 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 924 if ( $DEBUG_sys ) ; then 925 echo "IGCM_sys_Get_Dir :" $@ 926 fi 927 if [ $DRYRUN = 0 ]; then 928 # if [ ! -d ${1} ] ; then 929 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 930 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 931 # return 932 # fi 933 934 typeset RET 935 936 # Only if we use rsync 937 #IGCM_sys_TestDirArchive $( dirname $2 ) 938 # 939 # USUAL WAY 940 # add dmfind/dmget (to demigrate all offline files) : 941 dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 942 \cp -r $1 $2 > out_rsync 2>&1 943 RET=$? 944 945 if [ ${RET} -gt 0 ] ; then 946 echo "IGCM_sys_Get_Dir : error." 947 cat out_rsync 948 IGCM_debug_Exit "IGCM_sys_Get_Dir" 879 949 else 880 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 881 fi 882 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 950 \rm out_rsync 951 fi 952 else 953 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 954 fi 955 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 883 956 } 884 957 885 958 #D-#================================================== 886 959 #D-function IGCM_sys_Put_Rest 887 #D-* Purpose: Put computied restarts on $ (ARCHIVE).960 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 888 961 #D- File and target directory must exist. 889 962 #D-* Examples: 890 963 #D- 891 964 function IGCM_sys_Put_Rest { 892 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 893 if ( $DEBUG_sys ) ; then 894 echo "IGCM_sys_Put_Rest :" $@ 895 fi 896 if [ $DRYRUN = 0 ]; then 897 if [ ! -f ${1} ] ; then 898 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 899 IGCM_debug_Exit "IGCM_sys_Put_Rest" 900 fi 901 902 typeset RET 903 # 904 if [ X${JobType} = XRUN ] ; then 905 IGCM_sys_Chmod 444 ${1} 906 fi 907 # 908 IGCM_sys_TestDirArchive $( dirname $2 ) 909 # 910 # USUAL WAY 911 putfer $1 $2 > out_rsync 2>&1 912 RET=$? 965 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 966 if ( $DEBUG_sys ) ; then 967 echo "IGCM_sys_Put_Rest :" $@ 968 fi 969 if [ $DRYRUN = 0 ]; then 970 if [ ! -f ${1} ] ; then 971 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 972 IGCM_debug_Exit "IGCM_sys_Put_Rest" 973 fi 974 975 typeset RET 976 # 977 if [ X${JobType} = XRUN ] ; then 978 IGCM_sys_Chmod 444 ${1} 979 fi 980 981 # 982 # USUAL WAY 983 \cp $1 $2 > out_rsync 2>&1 984 RET=$? 913 985 914 986 # #RSYNC WITH NETWORK SSH CALL … … 926 998 # (( RET=RET+$? )) 927 999 928 if [ ${RET} -gt 0 ] ; then 929 echo "IGCM_sys_Put_Rest : error." 930 cat out_rsync 931 IGCM_debug_Exit "IGCM_sys_Put_Rest" 932 else 933 \rm out_rsync 934 fi 1000 if [ ${RET} -gt 0 ] ; then 1001 echo "IGCM_sys_Put_Rest : error." 1002 cat out_rsync 1003 IGCM_debug_Exit "IGCM_sys_Put_Rest" 935 1004 else 936 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 937 fi 938 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1005 \rm out_rsync 1006 fi 1007 else 1008 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1009 fi 1010 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1011 } 1012 1013 #D-#================================================== 1014 #D-function IGCM_sys_PutBuffer_Rest 1015 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 1016 #D- File and target directory must exist. 1017 #D-* Examples: 1018 #D- 1019 function IGCM_sys_PutBuffer_Rest { 1020 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 1021 if ( $DEBUG_sys ) ; then 1022 echo "IGCM_sys_PutBuffer_Rest :" $@ 1023 fi 1024 if [ $DRYRUN = 0 ]; then 1025 if [ ! -f ${1} ] ; then 1026 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 1027 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1028 fi 1029 1030 typeset RET 1031 # 1032 if [ X${JobType} = XRUN ] ; then 1033 IGCM_sys_Chmod 444 ${1} 1034 fi 1035 1036 # 1037 # USUAL WAY 1038 \cp $1 $2 > out_rsync 2>&1 1039 RET=$? 1040 1041 if [ ${RET} -gt 0 ] ; then 1042 echo "IGCM_sys_PutBuffer_Rest : error." 1043 cat out_rsync 1044 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1045 else 1046 \rm out_rsync 1047 fi 1048 else 1049 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1050 fi 1051 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 939 1052 } 940 1053 941 1054 #D-#================================================== 942 1055 #D-function IGCM_sys_Put_Out 943 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1056 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 944 1057 #D-* Examples: 945 1058 #D- 946 1059 function IGCM_sys_Put_Out { 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )970 971 972 973 974 975 976 977 978 979 980 981 982 983 putfer$1 $2 > out_rsync 2>&1984 1060 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1061 if ( $DEBUG_sys ) ; then 1062 echo "IGCM_sys_Put_Out :" $@ 1063 fi 1064 if [ $DRYRUN = 0 ]; then 1065 if [ ! -f ${1} ] ; then 1066 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1067 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1068 return 1 1069 fi 1070 # 1071 IGCM_sys_MkdirArchive $( dirname $2 ) 1072 # 1073 typeset RET 1074 1075 #===================================================== 1076 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1077 #===================================================== 1078 1079 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 1080 #if [ $? -eq 0 ] ; then 1081 # typeset WORKPATH FILEPATH 1082 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1083 # IGCM_sys_MkdirWork ${WORKPATH} 1084 # FILEPATH=${WORKPATH}/$( basename $2 ) 1085 # # 1086 # IGCM_sys_Cp ${1} ${FILEPATH} 1087 #fi 1088 1089 if [ X${JobType} = XRUN ] ; then 1090 if [ X${3} = X ] ; then 1091 IGCM_sys_Chmod 444 ${1} 1092 fi 1093 fi 1094 # 1095 # USUAL WAY 1096 \cp $1 $2 > out_rsync 2>&1 1097 RET=$? 985 1098 986 1099 # #RSYNC WITH NETWORK SSH CALL … … 998 1111 # (( RET=RET+$? )) 999 1112 1000 if [ ${RET} -gt 0 ] ; then 1001 echo "IGCM_sys_Put_Out : error." 1002 cat out_rsync 1003 IGCM_debug_Exit "IGCM_sys_Put_Out" 1004 else 1005 \rm out_rsync 1006 fi 1113 if [ ${RET} -gt 0 ] ; then 1114 echo "IGCM_sys_Put_Out : error." 1115 cat out_rsync 1116 IGCM_debug_Exit "IGCM_sys_Put_Out" 1007 1117 else 1008 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1009 fi 1010 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1011 return 0 1118 \rm out_rsync 1119 fi 1120 else 1121 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1122 fi 1123 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1124 return 0 1125 } 1126 1127 #D-#================================================== 1128 #D-function IGCM_sys_PutBuffer_Out 1129 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1130 #D-* Examples: 1131 #D- 1132 function IGCM_sys_PutBuffer_Out { 1133 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1134 if ( $DEBUG_sys ) ; then 1135 echo "IGCM_sys_PutBuffer_Out :" $@ 1136 fi 1137 if [ $DRYRUN = 0 ]; then 1138 if [ ! -f ${1} ] ; then 1139 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1140 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1141 return 1 1142 fi 1143 # 1144 IGCM_sys_Mkdir $( dirname $2 ) 1145 # 1146 typeset RET 1147 1148 if [ X${JobType} = XRUN ] ; then 1149 if [ X${3} = X ] ; then 1150 IGCM_sys_Chmod 444 ${1} 1151 fi 1152 fi 1153 # 1154 # USUAL WAY 1155 \cp $1 $2 > out_rsync 2>&1 1156 RET=$? 1157 1158 if [ ${RET} -gt 0 ] ; then 1159 echo "IGCM_sys_PutBuffer_Out : error." 1160 cat out_rsync 1161 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1162 else 1163 \rm out_rsync 1164 fi 1165 else 1166 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1167 fi 1168 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1169 return 0 1012 1170 } 1013 1171 … … 1018 1176 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1019 1177 function IGCM_sys_Get { 1020 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1021 1022 typeset DEST RET dm_liste ifile target file_work 1023 1024 if ( $DEBUG_sys ) ; then 1025 echo "IGCM_sys_Get :" $@ 1026 fi 1027 if [ $DRYRUN -le 2 ]; then 1028 if [ X${1} = X'/l' ] ; then 1029 # test if the first file is present in the old computation : 1030 eval set +A dm_liste \${${2}} 1031 else 1032 eval set +A dm_liste ${1} 1033 fi 1034 eval DEST=\${${#}} 1035 1036 #===================================================== 1037 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1038 #===================================================== 1039 1040 # Is it an R_OUT file (not R_IN) ? 1041 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1042 #if [ $? -eq 0 ] ; then 1043 # # Yes ? then we try to get it in SCRATCHDIR 1044 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|" ) 1045 # if [ -f ${file_work[0]} ] ; then 1046 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1047 # IGCM_debug_PopStack "IGCM_sys_Get" 1048 # return 1049 # fi 1050 #fi 1051 1052 # test if the (first) file is present in the old computation : 1053 IGCM_sys_TestFileArchive ${dm_liste[0]} 1054 RET=$? 1055 if [ ${RET} -gt 0 ] ; then 1056 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1057 IGCM_debug_Exit "IGCM_sys_Get" 1058 IGCM_debug_PopStack "IGCM_sys_Get" 1059 return 1060 fi 1061 1062 dmget ${dm_liste[*]} > out_rsync 2>&1 1063 RET=$? 1064 if [ ${RET} -gt 0 ] ; then 1065 echo "IGCM_sys_Get : demigration error." 1066 cat out_rsync 1067 IGCM_debug_Exit "IGCM_sys_Get" 1068 fi 1069 1070 #USUAL WAY 1071 if [ X${1} = X'/l' ] ; then 1072 (( RET=0 )) 1073 for target in ${dm_liste[*]} ; do 1074 local_file=$( basename ${target} ) 1075 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1076 (( RET = RET + $? )) 1077 done 1078 else 1079 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1080 RET=$? 1081 fi 1178 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1179 1180 typeset DEST RET dm_liste ifile target file_work 1181 1182 if ( $DEBUG_sys ) ; then 1183 echo "IGCM_sys_Get :" $@ 1184 fi 1185 if [ $DRYRUN -le 2 ]; then 1186 if [ X${1} = X'/l' ] ; then 1187 # test if the first file is present in the old computation : 1188 eval set +A dm_liste \${${2}} 1189 else 1190 eval set +A dm_liste ${1} 1191 fi 1192 eval DEST=\${${#}} 1193 1194 #===================================================== 1195 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1196 #===================================================== 1197 1198 # Is it an R_OUT file (not R_IN) ? 1199 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1200 #if [ $? -eq 0 ] ; then 1201 # # Yes ? then we try to get it in SCRATCHDIR 1202 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1203 # if [ -f ${file_work[0]} ] ; then 1204 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1205 # IGCM_debug_PopStack "IGCM_sys_Get" 1206 # return 1207 # fi 1208 #fi 1209 1210 # test if the (first) file is present in the old computation : 1211 IGCM_sys_TestFileArchive ${dm_liste[0]} 1212 RET=$? 1213 if [ ${RET} -gt 0 ] ; then 1214 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1215 IGCM_debug_Exit "IGCM_sys_Get" 1216 fi 1217 1218 dmget ${dm_liste[*]} > out_rsync 2>&1 1219 RET=$? 1220 if [ ${RET} -gt 0 ] ; then 1221 echo "WARNING IGCM_sys_Get : demigration error." 1222 cat out_rsync 1223 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1224 fi 1225 1226 #if [ ${RET} -gt 0 ] ; then 1227 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1228 # cat out_rsync 1229 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1230 # sleep 30 1231 # echo "We try another time" 1232 # dmget ${dm_liste[*]} > out_rsync 2>&1 1233 # RET=$? 1234 # if [ ${RET} -gt 0 ] ; then 1235 # echo "ERROR IGCM_sys_Get : again demigration error :" 1236 # cat out_rsync 1237 # IGCM_debug_Exit "IGCM_sys_Get" 1238 # fi 1239 # else 1240 # echo "ERROR IGCM_sys_Get : demigration error :" 1241 # cat out_rsync 1242 # IGCM_debug_Exit "IGCM_sys_Get" 1243 # fi 1244 #fi 1245 1246 #USUAL WAY 1247 if [ X${1} = X'/l' ] ; then 1248 (( RET=0 )) 1249 for target in ${dm_liste[*]} ; do 1250 local_file=$( basename ${target} ) 1251 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1252 (( RET = RET + $? )) 1253 done 1254 else 1255 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1256 RET=$? 1257 fi 1082 1258 1083 1259 # #RSYNC WITH NETWORK SSH CALL … … 1095 1271 # (( RET=RET+$? )) 1096 1272 1097 if [ ${RET} -gt 0 ] ; then 1098 echo "IGCM_sys_Get : copy error." 1099 cat out_rsync 1100 IGCM_debug_Exit "IGCM_sys_Get" 1101 else 1102 \rm out_rsync 1103 fi 1273 if [ ${RET} -gt 0 ] ; then 1274 echo "IGCM_sys_Get : copy error." 1275 cat out_rsync 1276 IGCM_debug_Exit "IGCM_sys_Get" 1104 1277 else 1105 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1106 fi 1107 IGCM_debug_PopStack "IGCM_sys_Get" 1278 \rm out_rsync 1279 fi 1280 else 1281 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1282 fi 1283 IGCM_debug_PopStack "IGCM_sys_Get" 1284 } 1285 1286 #D-#================================================== 1287 #D-function IGCM_sys_GetBuffer 1288 #D-* Purpose: Get a file from ${SCRATCHDIR} 1289 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1290 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1291 function IGCM_sys_GetBuffer { 1292 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1293 1294 typeset DEST RET buf_liste ifile target file_work 1295 1296 if ( $DEBUG_sys ) ; then 1297 echo "IGCM_sys_GetBuffer :" $@ 1298 fi 1299 if [ $DRYRUN -le 2 ]; then 1300 if [ X${1} = X'/l' ] ; then 1301 # test if the first file is present in the old computation : 1302 eval set +A buf_liste \${${2}} 1303 else 1304 eval set +A buf_liste ${1} 1305 fi 1306 eval DEST=\${${#}} 1307 1308 #USUAL WAY 1309 if [ X${1} = X'/l' ] ; then 1310 (( RET=0 )) 1311 for target in ${buf_liste[*]} ; do 1312 local_file=$( basename ${target} ) 1313 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1314 (( RET = RET + $? )) 1315 done 1316 else 1317 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1318 RET=$? 1319 fi 1320 1321 if [ ${RET} -gt 0 ] ; then 1322 echo "IGCM_sys_GetBuffer : copy error." 1323 cat out_rsync 1324 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1325 else 1326 \rm out_rsync 1327 fi 1328 else 1329 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1330 fi 1331 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1108 1332 } 1109 1333 … … 1114 1338 #D- 1115 1339 function IGCM_sys_GetDate_FichWork { 1116 1117 1118 1119 1120 1121 1122 1340 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1341 if ( $DEBUG_sys ) ; then 1342 echo "IGCM_sys_GetDate_FichWork :" $@ 1343 fi 1344 typeset dateF 1345 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1346 eval ${2}=${dateF[5]} 1123 1347 1124 1348 # donne la date filesys d'un fichier sur la machine work 1125 1349 IGCM_debug_PopStack "IGCM_sys_FichWork" 1126 1350 } 1127 1351 … … 1132 1356 #D- 1133 1357 function IGCM_sys_GetDate_FichArchive { 1134 1135 1136 1137 1138 1139 1140 1141 1142 1358 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1359 if ( $DEBUG_sys ) ; then 1360 echo "IGCM_sys_GetDate_FichArchive :" $@ 1361 fi 1362 typeset dateF 1363 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1364 eval ${2}=${dateF[5]} 1365 1366 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1143 1367 } 1144 1368 … … 1147 1371 1148 1372 function IGCM_sys_rebuild { 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1373 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1374 if ( $DEBUG_sys ) ; then 1375 echo "IGCM_sys_rebuild :" $@ 1376 fi 1377 /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ 1378 if [ $? -gt 0 ] ; then 1379 echo "IGCM_sys_rebuild : erreur ${@}." 1380 IGCM_debug_Exit "rebuild" 1381 fi 1382 1383 IGCM_debug_PopStack "IGCM_sys_rebuild" 1160 1384 } 1161 1385 … … 1164 1388 1165 1389 function IGCM_sys_activ_variables { 1166 1167 1168 1169 1390 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1391 if ( $DEBUG_sys ) ; then 1392 echo "IGCM_sys_activ_variables" 1393 fi 1170 1394 1171 1395 # -------------------------------------------------------------------- … … 1174 1398 1175 1399 #D-- MPISUSPEND 1176 1400 export MPISUSPEND=${MPISUSPEND:=OFF} 1177 1401 1178 1402 #D-- MPIPROGINF #other choices : ALL_DETAIL2 1179 1403 export MPIPROGINF=ALL 1180 1404 #D- activate ftrace (with -ftrace) 1181 1405 export F_FTRACE=YES 1182 1406 #D- communication information (with -ftrace) 1183 1407 export MPICOMMINF=DETAIL 1184 1408 1185 1409 # -------------------------------------------------------------------- … … 1188 1412 1189 1413 #D- max number of character/line in output job 1190 1414 export F_SYSLEN=5000 1191 1415 #D- number of error that can be admitted on the NEC 1192 1416 export F_ERRCNT=0 1193 1417 #D- global performance 1194 1418 export F_PROGINF=DETAIL 1195 1419 1196 1420 #D- I/O performance (FORTRAN I/O only not netCDF) 1197 1421 export F_FILEINF=${F_FILEINF:=NO} 1198 1422 #D- netCDF I/O performance 1199 1200 1201 1423 export NC_FILEINF=${NC_FILEINF:=NO} 1424 1425 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1202 1426 } 1203 1427 … … 1206 1430 1207 1431 function IGCM_sys_desactiv_variables { 1208 1209 1210 1211 1432 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1433 if ( $DEBUG_sys ) ; then 1434 echo "IGCM_sys_desactiv_variables" 1435 fi 1212 1436 # -------------------------------------------------------------------- 1213 1437 #D- MPI specifications … … 1215 1439 1216 1440 #D-- MPIPROGINF 1217 1441 export MPIPROGINF=NO 1218 1442 1219 1443 # -------------------------------------------------------------------- … … 1222 1446 1223 1447 #D- global performance 1224 1225 1226 1448 export F_PROGINF=NO 1449 1450 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1227 1451 } 1228 1452 … … 1231 1455 1232 1456 function IGCM_sys_build_run_file { 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1457 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1458 if ( $DEBUG_sys ) ; then 1459 echo "IGCM_sys_build_run_file " $@ 1460 fi 1461 (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 )) 1462 (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 1463 (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 1464 1465 if [ $1 = MPI2 ]; then 1466 cat <<EOF > run_file 1243 1467 -p 1 -np 1 -e ./oasis 1244 1468 EOF 1245 1246 1247 1248 1249 1469 (( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 )) 1470 config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"' 1471 1472 elif [ $1 = MPI1 ]; then 1473 cat <<EOF > run_file 1250 1474 -p $NUM_PROC_OASIS -e ./oasis 1251 1475 -p $NUM_PROC_ATM -e ./lmdz.x 1252 1476 -p $NUM_PROC_OCE -e ./opa.xx 1253 1477 EOF 1254 1255 fi 1256 1257 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1258 1259 } 1478 fi 1479 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1480 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh
r540 r544 9 9 # IPSL (2006) 10 10 # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC 11 # History:12 # Modification:13 11 # 14 12 #************************************************************** … … 107 105 #==================================================== 108 106 #- Mirror libIGCM from mercure to cesium if needed 109 ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $ 2}' )107 ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' ) 110 108 if [ ! ${ROOTSYS} = "home" ] ; then 111 109 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} 112 110 else 113 111 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 114 112 fi 115 113 … … 117 115 #- libIGCM_POST 118 116 if ( ${MirrorlibIGCM} ) ; then 119 120 117 PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 118 typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 121 119 else 122 120 typeset -r libIGCM_POST=${libIGCM} 123 121 fi 124 122 … … 139 137 140 138 #==================================================== 141 #- OUT139 #- R_OUT 142 140 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 141 142 #==================================================== 143 #- R_BUF (ONLY FOR double copy an scratch) 144 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 145 146 #==================================================== 147 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 148 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 143 149 144 150 #==================================================== … … 151 157 152 158 #==================================================== 153 #- BIG_DIR : BIG_DIR to store files waiting for rebuild154 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}155 156 #====================================================157 159 #- HOST_MPIRUN_COMMAND 158 160 typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"} … … 168 170 #D- 169 171 function IGCM_sys_RshMaster { 170 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 171 ssh -t ${MASTER} /bin/ksh <<-EOF 172 export libIGCM=${libIGCM} 173 export DEBUG_debug=${DEBUG_debug} 174 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 175 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh 172 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 173 ssh -t ${MASTER} /bin/ksh <<-EOF 174 export libIGCM=${libIGCM} 175 export DEBUG_debug=${DEBUG_debug} 176 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 177 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh 178 ${@} 179 EOF 180 if [ $? -gt 0 ] ; then 181 echo "IGCM_sys_RshMaster : erreur." 182 IGCM_debug_Exit "IGCM_sys_RshMaster" 183 fi 184 IGCM_debug_PopStack "IGCM_sys_RshMaster" 185 } 186 187 #D-#================================================== 188 #D-function IGCM_sys_RshArchive 189 #D-* Purpose: Archive rsh command 190 #D-* Examples: 191 #D- 192 function IGCM_sys_RshArchive { 193 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 194 /bin/ksh <<-EOF 176 195 ${@} 177 196 EOF 178 if [ $? -gt 0 ] ; then 179 echo "IGCM_sys_RshMaster : erreur." 180 IGCM_debug_Exit "IGCM_sys_RshMaster" 181 fi 182 IGCM_debug_PopStack "IGCM_sys_RshMaster" 183 } 184 185 #D-#================================================== 186 #D-function IGCM_sys_RshArchive 187 #D-* Purpose: Archive rsh command 188 #D-* Examples: 189 #D- 190 function IGCM_sys_RshArchive { 191 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 192 /bin/ksh <<-EOF 193 ${@} 194 EOF 195 if [ $? -gt 0 ] ; then 196 echo "IGCM_sys_RshArchive : erreur." 197 IGCM_debug_Exit "IGCM_sys_RshArchive" 198 fi 199 IGCM_debug_PopStack "IGCM_sys_RshArchive" 197 if [ $? -gt 0 ] ; then 198 echo "IGCM_sys_RshArchive : erreur." 199 IGCM_debug_Exit "IGCM_sys_RshArchive" 200 fi 201 IGCM_debug_PopStack "IGCM_sys_RshArchive" 200 202 } 201 203 … … 206 208 #D- 207 209 function IGCM_sys_RshPost { 208 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 209 if ( $DEBUG_sys ) ; then 210 echo "IGCM_sys_RshPost :" $@ 211 fi 210 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 211 if ( $DEBUG_sys ) ; then 212 echo "IGCM_sys_RshPost :" $@ 213 fi 214 215 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 216 #cat tmp_IGCM_sys_RshPost_$$ 217 # keep standard input (stdin) for the loop onto temporary file 218 cat >tmp_IGCM_sys_RshPost_$$ 219 220 # ============ FRONTEND START ============ # 221 222 # /bin/ksh <tmp_IGCM_sys_RshPost_$$ 223 # if [ $? -gt 0 ] ; then 224 # echo "IGCM_sys_RshPost : erreur." 225 # IGCM_debug_Exit "IGCM_sys_RshPost" 226 # fi 227 # \rm tmp_IGCM_sys_RshPost_$$ 228 229 # ============ FRONTEND END ============ # 212 230 213 231 # ============ CESIUM START ============ # 214 typeset NB_ESSAI DELAI status i 215 # keep standard input for the loop onto temporary file 216 cat >tmp_IGCM_sys_RshPost_$$ 217 # number of tentative 218 NB_ESSAI=10 219 # time delay between tentative 220 DELAI=10 221 (( i = 0 )) 222 while [ $i -lt $NB_ESSAI ] ; do 223 ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 224 status=$? 225 if [ ${status} -gt 0 ]; then 226 IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}" 227 IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again." 228 sleep $DELAI 229 else 230 break 231 fi 232 (( i = i + 1 )) 233 done 234 # delete temporary file 235 /bin/rm tmp_IGCM_sys_RshPost_$$ 232 typeset NB_ESSAI DELAI status i 233 # number of tentative 234 NB_ESSAI=10 235 # time delay between tentative 236 DELAI=10 237 (( i = 0 )) 238 while [ $i -lt $NB_ESSAI ] ; do 239 ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 240 status=$? 241 if [ ${status} -gt 0 ]; then 242 IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}" 243 IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again." 244 sleep $DELAI 245 else 246 break 247 fi 248 (( i = i + 1 )) 249 done 250 # delete temporary file 251 /bin/rm tmp_IGCM_sys_RshPost_$$ 236 252 # ============ CESIUM END ============ # 237 253 238 # Uncomment for frontend 239 # /bin/ksh ${@} 240 # if [ $? -gt 0 ] ; then 241 # echo "IGCM_sys_RshPost : erreur." 242 # IGCM_debug_Exit "IGCM_sys_RshPost" 243 # fi 244 245 IGCM_debug_PopStack "IGCM_sys_RshPost" 254 IGCM_debug_PopStack "IGCM_sys_RshPost" 246 255 } 247 256 … … 252 261 #D- 253 262 function IGCM_sys_SendMail { 254 255 256 257 258 259 260 261 262 263 264 265 Dear ${LOGIN},263 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 264 if ( $DEBUG_sys ) ; then 265 echo "IGCM_sys_SendMail :" $@ 266 fi 267 268 if ( ${ExitFlag} ) ; then 269 status=failed 270 else 271 status=completed 272 fi 273 cat << END_MAIL > job_end.mail 274 Dear ${LOGIN}, 266 275 267 276 Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. … … 272 281 END_MAIL 273 282 274 275 276 277 278 279 280 281 282 283 284 285 286 283 if [ X"${config_UserChoices_MailName}" != X ] ; then 284 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 285 elif [ -f ~/.forward ] ; then 286 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 287 else 288 mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail 289 fi 290 291 if [ $? -gt 0 ] ; then 292 echo "IGCM_sys_SendMail : erreur." 293 IGCM_debug_Exit "IGCM_sys_SendMail" 294 fi 295 IGCM_debug_PopStack "IGCM_sys_SendMail" 287 296 } 288 297 … … 293 302 #D- 294 303 function IGCM_sys_Mkdir { 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 304 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 305 if ( $DEBUG_sys ) ; then 306 echo "IGCM_sys_Mkdir :" $@ 307 fi 308 if [ ! -d ${1} ]; then 309 \mkdir -p $1 310 if [ $? -gt 0 ] ; then 311 echo "IGCM_sys_Mkdir : erreur." 312 IGCM_debug_Exit "IGCM_sys_Mkdir" 313 fi 314 fi 315 # vérification : 316 if [ ! -d ${1} ] ; then 317 echo "IGCM_sys_Mkdir : erreur." 318 IGCM_debug_Exit "IGCM_sys_Mkdir" 319 fi 320 IGCM_debug_PopStack "IGCM_sys_Mkdir" 312 321 } 313 322 … … 318 327 #D- 319 328 function IGCM_sys_MkdirArchive { 320 321 322 323 324 325 326 327 328 329 330 331 332 329 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 330 if ( $DEBUG_sys ) ; then 331 echo "IGCM_sys_MkdirArchive :" $@ 332 fi 333 #- creation de repertoire sur le serveur fichier 334 if [ ! -d ${1} ]; then 335 \mkdir -p $1 336 if [ $? -gt 0 ] ; then 337 echo "IGCM_sys_MkdirArchive : erreur." 338 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 339 fi 340 fi 341 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 333 342 } 334 343 … … 339 348 #D- 340 349 function IGCM_sys_MkdirWork { 341 342 343 344 345 346 347 348 349 350 351 352 353 350 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 351 if ( $DEBUG_sys ) ; then 352 echo "IGCM_sys_MkdirWork :" $@ 353 fi 354 #- creation de repertoire sur le serveur fichier 355 if [ ! -d ${1} ]; then 356 \mkdir -p $1 357 if [ $? -gt 0 ] ; then 358 echo "IGCM_sys_MkdirWork : erreur." 359 IGCM_debug_Exit "IGCM_sys_MkdirWork" 360 fi 361 fi 362 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 354 363 } 355 364 … … 360 369 #D- 361 370 function IGCM_sys_Cd { 362 363 364 365 366 367 368 369 370 371 371 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 372 if ( $DEBUG_sys ) ; then 373 echo "IGCM_sys_Cd :" $@ 374 fi 375 \cd $1 376 if [ $? -gt 0 ] ; then 377 echo "IGCM_sys_Cd : erreur." 378 IGCM_debug_Exit "IGCM_sys_Cd" 379 fi 380 IGCM_debug_PopStack "IGCM_sys_Cd" 372 381 } 373 382 … … 378 387 #D- 379 388 function IGCM_sys_Chmod { 380 381 382 383 384 385 386 387 388 389 390 391 392 393 389 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 390 if ( $DEBUG_sys ) ; then 391 echo "IGCM_sys_Chmod :" $@ 392 fi 393 if [ $DRYRUN -le 1 ]; then 394 \chmod $@ 395 if [ $? -gt 0 ] ; then 396 echo "IGCM_sys_Chmod : erreur." 397 IGCM_debug_Exit "IGCM_sys_Chmod" 398 fi 399 else 400 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 401 fi 402 IGCM_debug_PopStack "IGCM_sys_Chmod" 394 403 } 395 404 396 405 #D-#================================================== 397 406 #D-function IGCM_sys_FileSize 398 #D-* Purpose: File 407 #D-* Purpose: Filesize 399 408 #D-* Examples: 400 409 #D- 401 410 function IGCM_sys_FileSize { 402 403 404 405 406 407 408 409 410 411 411 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 412 413 typeset sizeF 414 set +A sizeF -- $( ls -la ${1} ) 415 if [ $? -gt 0 ] ; then 416 IGCM_debug_Exit "IGCM_sys_FileSize" 417 fi 418 eval ${2}=${sizeF[4]} 419 420 IGCM_debug_PopStack "IGCM_sys_FileSize" 412 421 } 413 422 … … 418 427 #D- 419 428 function IGCM_sys_TestDir { 420 421 422 423 424 425 426 427 428 429 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 430 if ( $DEBUG_sys ) ; then 431 echo "IGCM_sys_TestDir :" $@ 432 fi 433 typeset ExistFlag 434 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 435 IGCM_debug_PopStack "IGCM_sys_TestDir" 436 437 return ${ExistFlag} 429 438 } 430 439 … … 435 444 #D- 436 445 function IGCM_sys_TestDirArchive { 437 438 439 440 441 442 443 444 445 446 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 447 if ( $DEBUG_sys ) ; then 448 echo "IGCM_sys_TestDirArchive :" $@ 449 fi 450 typeset ExistFlag 451 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 452 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 453 454 return ${ExistFlag} 446 455 } 447 456 … … 452 461 #D- 453 462 function IGCM_sys_TestFileArchive { 454 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 455 typeset ExistFlag 456 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 457 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 458 459 return ${ExistFlag} 463 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 464 if ( $DEBUG_sys ) ; then 465 echo "IGCM_sys_TestFileArchive :" $@ 466 fi 467 typeset ExistFlag 468 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 469 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 470 471 return ${ExistFlag} 472 } 473 474 #D-#================================================== 475 #D-function IGCM_sys_TestFileBuffer 476 #D-* Purpose: Test file that must NOT EXISTS on Buffer 477 #D-* Examples: 478 #D- 479 function IGCM_sys_TestFileBuffer { 480 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 481 typeset ExistFlag 482 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 483 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 484 485 return ${ExistFlag} 460 486 } 461 487 … … 466 492 #D- 467 493 function IGCM_sys_CountFileArchive { 468 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 469 ls ${@} 2>/dev/null | wc -l 470 if [ $? -gt 0 ] ; then 471 echo "IGCM_sys_CountFileArchive : erreur." 472 fi 473 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 494 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 495 ls ${@} 2>/dev/null | wc -l 496 if [ $? -gt 0 ] ; then 497 echo "IGCM_sys_CountFileArchive : erreur." 498 fi 499 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 500 } 501 502 #D-#================================================== 503 #D-function IGCM_sys_CountFileBuffer 504 #D-* Purpose: Count files on Scratch filesystem 505 #D-* Examples: 506 #D- 507 function IGCM_sys_CountFileBuffer { 508 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 509 ls ${@} 2>/dev/null | wc -l 510 if [ $? -gt 0 ] ; then 511 echo "IGCM_sys_CountFileBuffer : erreur." 512 fi 513 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 474 514 } 475 515 … … 480 520 #D- 481 521 function IGCM_sys_Tree { 482 483 484 485 486 487 488 489 522 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 523 if ( $DEBUG_sys ) ; then 524 echo "IGCM_sys_Tree :" $@ 525 fi 526 527 \ls -lR ${@} 528 529 IGCM_debug_PopStack "IGCM_sys_Tree" 490 530 } 491 531 492 532 #D-#================================================== 493 533 #D-function IGCM_sys_Tar 494 #D-* Purpose: master un-tar command534 #D-* Purpose: master tar command 495 535 #D-* Examples: 496 536 #D- 497 537 function IGCM_sys_Tar { 498 499 500 501 502 503 504 505 506 507 538 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 539 if ( $DEBUG_sys ) ; then 540 echo "IGCM_sys_Tar :" $@ 541 fi 542 \tar cf $@ 543 if [ $? -gt 0 ] ; then 544 echo "IGCM_sys_Tar : erreur." 545 IGCM_debug_Exit "IGCM_sys_Tar" 546 fi 547 IGCM_debug_PopStack "IGCM_sys_Tar" 508 548 } 509 549 … … 514 554 #D- 515 555 function IGCM_sys_UnTar { 516 517 518 519 520 521 522 523 524 525 556 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 557 if ( $DEBUG_sys ) ; then 558 echo "IGCM_sys_UnTar :" $@ 559 fi 560 \tar xvf $1 561 if [ $? -gt 0 ] ; then 562 echo "IGCM_sys_UnTar : erreur." 563 IGCM_debug_Exit "IGCM_sys_UnTar" 564 fi 565 IGCM_debug_PopStack "IGCM_sys_UnTar" 526 566 } 527 567 … … 532 572 #D- 533 573 function IGCM_sys_Qsub { 534 535 536 537 538 539 540 541 542 543 574 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 575 if ( $DEBUG_sys ) ; then 576 echo "IGCM_sys_Qsub :" $@ 577 fi 578 /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 579 if [ $? -gt 0 ] ; then 580 echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@." 581 IGCM_debug_Exit "IGCM_sys_Qsub" 582 fi 583 IGCM_debug_PopStack "IGCM_sys_Qsub" 544 584 } 545 585 … … 550 590 #D- 551 591 function IGCM_sys_QsubPost { 552 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 553 if ( $DEBUG_sys ) ; then 554 echo "IGCM_sys_QsubPost :" $@ 555 fi 556 # ============ CESIUM START ============ # 557 typeset NB_ESSAI DELAI status i 558 # number of tentative 559 NB_ESSAI=10 560 # time delay between tentative 561 DELAI=10 562 (( i = 0 )) 563 while [ $i -lt $NB_ESSAI ] ; do 564 /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 565 status=$? 566 if [ ${status} -gt 0 ]; 567 then 568 sleep $DELAI 569 else 570 break 571 fi 572 (( i = i + 1 )) 573 done 574 # ============ CESIUM END ============ # 575 #/usr/bin/nqsII/qsub -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM}/$1.job -v ${listVarEnv} 576 if [ $? -gt 0 ] ; then 577 echo "IGCM_sys_QsubPost : erreur " $@ 578 IGCM_debug_Exit "IGCM_sys_QsubPost" 579 fi 580 IGCM_debug_PopStack "IGCM_sys_QsubPost" 592 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 593 if ( $DEBUG_sys ) ; then 594 echo "IGCM_sys_QsubPost :" $@ 595 fi 596 597 # ============ FRONTEND START ============ # 598 599 # /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv} 600 601 # ============ FRONTEND END ============ # 602 603 # ============ CESIUM START ============ # 604 typeset NB_ESSAI DELAI status i 605 # number of tentative 606 NB_ESSAI=10 607 # time delay between tentative 608 DELAI=10 609 (( i = 0 )) 610 while [ $i -lt $NB_ESSAI ] ; do 611 /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 612 status=$? 613 if [ ${status} -gt 0 ]; then 614 sleep $DELAI 615 else 616 break 617 fi 618 (( i = i + 1 )) 619 done 620 # ============ CESIUM END ============ # 621 622 if [ $? -gt 0 ] ; then 623 echo "IGCM_sys_QsubPost : erreur " $@ 624 IGCM_debug_Exit "IGCM_sys_QsubPost" 625 fi 626 IGCM_debug_PopStack "IGCM_sys_QsubPost" 581 627 } 582 628 … … 592 638 #D- Error values and explanations can depend on your system version. 593 639 function IGCM_sys_Rsync_out { 594 RET=$1 595 if [ ! $RET ] ; then 596 echo "rsync error !" 597 fi 598 599 if [ $MYLANG = "fr" ]; then 600 case $RET in 601 0) return ;; 602 1) echo "Erreur de rsync ; RERR_SYNTAX : " 603 echo "Erreur de syntaxe ou d'utilisation." 604 return;; 605 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 606 echo "Incompatibilité de protocole." 607 return;; 608 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 609 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 610 echo "répertoires" 611 return;; 612 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 613 echo "Action demandée non supportée : une tentative de manipulation de" 614 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 615 echo "été faite ; ou une option qui est supportée par le client mais" 616 echo "pas par le serveur a été spécifiée." 617 return;; 618 10) echo "Erreur de rsync ; RERR_SOCKETIO" 619 echo "Erreur dans le socket d'entrée sortie" 620 return;; 621 11) echo "Erreur de rsync ; RERR_FILEIO" 622 echo "Erreur d'entrée sortie fichier" 623 return;; 624 12) echo "Erreur de rsync ; RERR_STREAMIO" 625 echo "Erreur dans flux de donnée du protocole rsync" 626 return;; 627 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 628 echo "Erreur avec les diagnostics du programme" 629 return;; 630 14) echo "Erreur de rsync ; RERR_IPC" 631 echo "Erreur dans le code IPC" 632 return;; 633 20) echo "Erreur de rsync ; RERR_SIGNAL" 634 echo "SIGUSR1 ou SIGINT reçu" 635 return;; 636 21) echo "Erreur de rsync ; RERR_WAITCHILD" 637 echo "Une erreur retournée par waitpid()" 638 return;; 639 22) echo "Erreur de rsync ; RERR_MALLOC" 640 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 641 return;; 642 23) echo "" 643 echo "Erreur fichier inexistant" 644 return;; 645 30) echo "Erreur de rsync ; RERR_TIMEOUT" 646 echo "Temps d'attente écoulé dans l'envoi/réception de données" 647 return;; 648 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 649 return;; 650 esac 651 elif [ $MYLANG = "en" ] ; then 652 case $RET in 653 0) return;; 654 1) echo "rsync error : Syntax or usage error " 655 return;; 656 2) echo "rsync error : Protocol incompatibility " 657 return;; 658 3) echo "rsync error : Errors selecting input/output files, dirs" 659 return;; 660 4) echo "rsync error : Requested action not supported: an attempt" 661 echo "was made to manipulate 64-bit files on a platform that cannot support" 662 echo "them; or an option was specified that is supported by the client and" 663 echo "not by the server." 664 return;; 665 5) echo "rsync error : Error starting client-server protocol" 666 return;; 667 10) echo "rsync error : Error in socket I/O " 668 return;; 669 11) echo "rsync error : Error in file I/O " 670 return;; 671 12) echo "rsync error : Error in rsync protocol data stream " 672 return;; 673 13) echo "rsync error : Errors with program diagnostics " 674 return;; 675 14) echo "rsync error : Error in IPC code " 676 return;; 677 20) echo "rsync error : Received SIGUSR1 or SIGINT " 678 return;; 679 21) echo "rsync error : Some error returned by waitpid() " 680 return;; 681 22) echo "rsync error : Error allocating core memory buffers " 682 return;; 683 23) echo "rsync error : Partial transfer due to error" 684 return;; 685 24) echo "rsync error : Partial transfer due to vanished source files" 686 return;; 687 30) echo "rsync error : Timeout in data send/receive " 688 return;; 689 *) echo "rsync error : return code of rsync unknown :" $RET 690 return;; 691 esac 692 else 693 echo "unknown language $MYLANG." 694 return 695 fi 696 } 697 640 RET=$1 641 if [ ! $RET ] ; then 642 echo "rsync error !" 643 fi 644 645 if [ $MYLANG = "fr" ]; then 646 case $RET in 647 0) return ;; 648 1) echo "Erreur de rsync ; RERR_SYNTAX : " 649 echo "Erreur de syntaxe ou d'utilisation." 650 return;; 651 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 652 echo "Incompatibilité de protocole." 653 return;; 654 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 655 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 656 echo "répertoires" 657 return;; 658 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 659 echo "Action demandée non supportée : une tentative de manipulation de" 660 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 661 echo "été faite ; ou une option qui est supportée par le client mais" 662 echo "pas par le serveur a été spécifiée." 663 return;; 664 10) echo "Erreur de rsync ; RERR_SOCKETIO" 665 echo "Erreur dans le socket d'entrée sortie" 666 return;; 667 11) echo "Erreur de rsync ; RERR_FILEIO" 668 echo "Erreur d'entrée sortie fichier" 669 return;; 670 12) echo "Erreur de rsync ; RERR_STREAMIO" 671 echo "Erreur dans flux de donnée du protocole rsync" 672 return;; 673 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 674 echo "Erreur avec les diagnostics du programme" 675 return;; 676 14) echo "Erreur de rsync ; RERR_IPC" 677 echo "Erreur dans le code IPC" 678 return;; 679 20) echo "Erreur de rsync ; RERR_SIGNAL" 680 echo "SIGUSR1 ou SIGINT reçu" 681 return;; 682 21) echo "Erreur de rsync ; RERR_WAITCHILD" 683 echo "Une erreur retournée par waitpid()" 684 return;; 685 22) echo "Erreur de rsync ; RERR_MALLOC" 686 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 687 return;; 688 23) echo "" 689 echo "Erreur fichier inexistant" 690 return;; 691 30) echo "Erreur de rsync ; RERR_TIMEOUT" 692 echo "Temps d'attente écoulé dans l'envoi/réception de données" 693 return;; 694 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 695 return;; 696 esac 697 elif [ $MYLANG = "en" ] ; then 698 case $RET in 699 0) return;; 700 1) echo "rsync error : Syntax or usage error " 701 return;; 702 2) echo "rsync error : Protocol incompatibility " 703 return;; 704 3) echo "rsync error : Errors selecting input/output files, dirs" 705 return;; 706 4) echo "rsync error : Requested action not supported: an attempt" 707 echo "was made to manipulate 64-bit files on a platform that cannot support" 708 echo "them; or an option was specified that is supported by the client and" 709 echo "not by the server." 710 return;; 711 5) echo "rsync error : Error starting client-server protocol" 712 return;; 713 10) echo "rsync error : Error in socket I/O " 714 return;; 715 11) echo "rsync error : Error in file I/O " 716 return;; 717 12) echo "rsync error : Error in rsync protocol data stream " 718 return;; 719 13) echo "rsync error : Errors with program diagnostics " 720 return;; 721 14) echo "rsync error : Error in IPC code " 722 return;; 723 20) echo "rsync error : Received SIGUSR1 or SIGINT " 724 return;; 725 21) echo "rsync error : Some error returned by waitpid() " 726 return;; 727 22) echo "rsync error : Error allocating core memory buffers " 728 return;; 729 23) echo "rsync error : Partial transfer due to error" 730 return;; 731 24) echo "rsync error : Partial transfer due to vanished source files" 732 return;; 733 30) echo "rsync error : Timeout in data send/receive " 734 return;; 735 *) echo "rsync error : return code of rsync unknown :" $RET 736 return;; 737 esac 738 else 739 echo "unknown language $MYLANG." 740 return 741 fi 742 } 698 743 699 744 #D-#================================================== … … 703 748 #D- 704 749 function IGCM_sys_Mirror_libIGCM { 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 750 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 751 if ( $DEBUG_sys ) ; then 752 echo "IGCM_sys_Mirror_libIGCM" 753 fi 754 755 typeset RET DEST 756 757 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 758 759 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 760 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 761 RET=$? 762 763 if [ ${RET} -gt 0 ] ; then 764 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 765 cat out_rsync 766 fi 767 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 723 768 } 724 769 … … 726 771 #- Call IGCM_sys_Mirror_libIGCM now ! 727 772 if ( $MirrorlibIGCM ) ; then 728 773 IGCM_sys_Mirror_libIGCM 729 774 fi 730 775 … … 735 780 #D- 736 781 function IGCM_sys_Cp { 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 782 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 783 if ( $DEBUG_sys ) ; then 784 echo "IGCM_sys_Cp :" $@ 785 fi 786 787 typeset RET 788 789 echo cp $@ > out_rsync 2>&1 790 \cp $@ >> out_rsync 2>&1 791 RET=$? 792 793 if [ ${RET} -gt 0 ] ; then 794 echo "IGCM_sys_Cp : error." 795 cat out_rsync 796 IGCM_debug_Exit "IGCM_sys_Cp" 797 else 798 \rm out_rsync 799 fi 800 IGCM_debug_PopStack "IGCM_sys_Cp" 756 801 } 757 802 … … 762 807 #D- 763 808 function IGCM_sys_Rm { 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 809 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 810 if ( $DEBUG_sys ) ; then 811 echo "IGCM_sys_Rm :" $@ 812 fi 813 814 typeset RET 815 816 echo rm $@ > out_rsync 2>&1 817 \rm $@ >> out_rsync 2>&1 818 RET=$? 819 820 if [ ${RET} -gt 0 ] ; then 821 echo "IGCM_sys_Rm : error." 822 cat out_rsync 823 IGCM_debug_Exit "IGCM_sys_Rm" 824 else 825 \rm out_rsync 826 fi 827 IGCM_debug_PopStack "IGCM_sys_Rm" 783 828 } 784 829 … … 789 834 #D- 790 835 function IGCM_sys_Mv { 791 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 792 if ( $DEBUG_sys ) ; then 793 echo "IGCM_sys_Mv :" $@ 794 fi 795 796 if [ $DRYRUN = 0 ]; then 797 798 typeset RET 799 800 echo mv $@ > out_rsync 2>&1 801 \mv $@ >> out_rsync 2>&1 802 RET=$? 836 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 837 if ( $DEBUG_sys ) ; then 838 echo "IGCM_sys_Mv :" $@ 839 fi 840 841 if [ $DRYRUN = 0 ]; then 842 843 typeset RET 803 844 804 if [ ${RET} -gt 0 ] ; then 805 echo "IGCM_sys_Mv : error in mv." 806 cat out_rsync 807 IGCM_debug_Exit "IGCM_sys_Mv" 808 else 809 \rm out_rsync 810 fi 845 echo mv $@ > out_rsync 2>&1 846 \mv $@ >> out_rsync 2>&1 847 RET=$? 848 849 if [ ${RET} -gt 0 ] ; then 850 echo "IGCM_sys_Mv : error in mv." 851 cat out_rsync 852 IGCM_debug_Exit "IGCM_sys_Mv" 811 853 else 812 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 813 fi 814 815 IGCM_debug_PopStack "IGCM_sys_Mv" 854 \rm out_rsync 855 fi 856 else 857 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 858 fi 859 860 IGCM_debug_PopStack "IGCM_sys_Mv" 816 861 } 817 862 … … 822 867 #D- 823 868 function IGCM_sys_Put_Dir { 824 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 825 if ( $DEBUG_sys ) ; then 826 echo "IGCM_sys_Put_Dir :" $@ 827 fi 828 if [ $DRYRUN = 0 ]; then 829 if [ ! -d ${1} ] ; then 830 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 831 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 832 return 833 fi 834 835 typeset RET 836 837 # Only if we use rsync 838 #IGCM_sys_TestDirArchive $( dirname $2 ) 839 # 840 #USUAL WAY 841 \cp -r $1 $2 > out_rsync 2>&1 842 RET=$? 843 844 if [ ${RET} -gt 0 ] ; then 845 echo "IGCM_sys_Put_Dir : error." 846 cat out_rsync 847 IGCM_debug_Exit "IGCM_sys_Put_Dir" 848 else 849 \rm out_rsync 850 fi 869 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 870 if ( $DEBUG_sys ) ; then 871 echo "IGCM_sys_Put_Dir :" $@ 872 fi 873 if [ $DRYRUN = 0 ]; then 874 if [ ! -d ${1} ] ; then 875 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 876 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 877 return 878 fi 879 880 typeset RET 881 882 # Only if we use rsync 883 #IGCM_sys_TestDirArchive $( dirname $2 ) 884 # 885 #USUAL WAY 886 \cp -r $1 $2 > out_rsync 2>&1 887 RET=$? 888 889 if [ ${RET} -gt 0 ] ; then 890 echo "IGCM_sys_Put_Dir : error." 891 cat out_rsync 892 IGCM_debug_Exit "IGCM_sys_Put_Dir" 851 893 else 852 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 853 fi 854 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 894 \rm out_rsync 895 fi 896 else 897 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 898 fi 899 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 855 900 } 856 901 857 902 #D-#================================================== 858 903 #D-function IGCM_sys_Get_Dir 859 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)904 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 860 905 #D-* Examples: 861 906 #D- 862 907 function IGCM_sys_Get_Dir { 863 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 864 if ( $DEBUG_sys ) ; then 865 echo "IGCM_sys_Get_Dir :" $@ 866 fi 867 if [ $DRYRUN = 0 ]; then 868 if [ ! -d ${1} ] ; then 869 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 870 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 871 return 872 fi 873 874 typeset RET 875 876 # Only if we use rsync 877 #IGCM_sys_TestDirArchive $( dirname $2 ) 878 # 879 #USUAL WAY 880 \cp -r $1 $2 > out_rsync 2>&1 881 RET=$? 882 883 if [ ${RET} -gt 0 ] ; then 884 echo "IGCM_sys_Get_Dir : error." 885 cat out_rsync 886 IGCM_debug_Exit "IGCM_sys_Get_Dir" 887 else 888 \rm out_rsync 889 fi 908 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 909 if ( $DEBUG_sys ) ; then 910 echo "IGCM_sys_Get_Dir :" $@ 911 fi 912 if [ $DRYRUN = 0 ]; then 913 # if [ ! -d ${1} ] ; then 914 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 915 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 916 # return 917 # fi 918 919 typeset RET 920 921 # Only if we use rsync 922 #IGCM_sys_TestDirArchive $( dirname $2 ) 923 # 924 # USUAL WAY 925 # add dmfind/dmget (to demigrate all offline files) : 926 dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 927 \cp -r $1 $2 > out_rsync 2>&1 928 RET=$? 929 930 if [ ${RET} -gt 0 ] ; then 931 echo "IGCM_sys_Get_Dir : error." 932 cat out_rsync 933 IGCM_debug_Exit "IGCM_sys_Get_Dir" 890 934 else 891 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 892 fi 893 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 935 \rm out_rsync 936 fi 937 else 938 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 939 fi 940 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 894 941 } 895 942 896 943 #D-#================================================== 897 944 #D-function IGCM_sys_Put_Rest 898 #D-* Purpose: Put computied restarts on $ (ARCHIVE).945 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 899 946 #D- File and target directory must exist. 900 947 #D-* Examples: 901 948 #D- 902 949 function IGCM_sys_Put_Rest { 903 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 904 if ( $DEBUG_sys ) ; then 905 echo "IGCM_sys_Put_Rest :" $@ 906 fi 907 if [ $DRYRUN = 0 ]; then 908 if [ ! -f ${1} ] ; then 909 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 910 IGCM_debug_Exit "IGCM_sys_Put_Rest" 911 fi 912 913 typeset RET 914 # 915 if [ X${JobType} = XRUN ] ; then 916 IGCM_sys_Chmod 444 ${1} 917 fi 918 # 919 IGCM_sys_TestDirArchive $( dirname $2 ) 920 # 921 # USUAL WAY 922 putfer $1 $2 > out_rsync 2>&1 923 RET=$? 950 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 951 if ( $DEBUG_sys ) ; then 952 echo "IGCM_sys_Put_Rest :" $@ 953 fi 954 if [ $DRYRUN = 0 ]; then 955 if [ ! -f ${1} ] ; then 956 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 957 IGCM_debug_Exit "IGCM_sys_Put_Rest" 958 fi 959 960 typeset RET 961 # 962 if [ X${JobType} = XRUN ] ; then 963 IGCM_sys_Chmod 444 ${1} 964 fi 965 966 # 967 # USUAL WAY 968 \cp $1 $2 > out_rsync 2>&1 969 RET=$? 924 970 925 971 # #RSYNC WITH NETWORK SSH CALL … … 937 983 # (( RET=RET+$? )) 938 984 939 if [ ${RET} -gt 0 ] ; then 940 echo "IGCM_sys_Put_Rest : error." 941 cat out_rsync 942 IGCM_debug_Exit "IGCM_sys_Put_Rest" 943 else 944 \rm out_rsync 945 fi 985 if [ ${RET} -gt 0 ] ; then 986 echo "IGCM_sys_Put_Rest : error." 987 cat out_rsync 988 IGCM_debug_Exit "IGCM_sys_Put_Rest" 946 989 else 947 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 948 fi 949 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 990 \rm out_rsync 991 fi 992 else 993 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 994 fi 995 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 996 } 997 998 #D-#================================================== 999 #D-function IGCM_sys_PutBuffer_Rest 1000 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 1001 #D- File and target directory must exist. 1002 #D-* Examples: 1003 #D- 1004 function IGCM_sys_PutBuffer_Rest { 1005 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 1006 if ( $DEBUG_sys ) ; then 1007 echo "IGCM_sys_PutBuffer_Rest :" $@ 1008 fi 1009 if [ $DRYRUN = 0 ]; then 1010 if [ ! -f ${1} ] ; then 1011 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 1012 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1013 fi 1014 1015 typeset RET 1016 # 1017 if [ X${JobType} = XRUN ] ; then 1018 IGCM_sys_Chmod 444 ${1} 1019 fi 1020 1021 # 1022 # USUAL WAY 1023 \cp $1 $2 > out_rsync 2>&1 1024 RET=$? 1025 1026 if [ ${RET} -gt 0 ] ; then 1027 echo "IGCM_sys_PutBuffer_Rest : error." 1028 cat out_rsync 1029 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1030 else 1031 \rm out_rsync 1032 fi 1033 else 1034 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1035 fi 1036 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 950 1037 } 951 1038 952 1039 #D-#================================================== 953 1040 #D-function IGCM_sys_Put_Out 954 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1041 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 955 1042 #D-* Examples: 956 1043 #D- 957 1044 function IGCM_sys_Put_Out { 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )981 982 983 984 985 986 987 988 989 990 991 992 993 994 putfer$1 $2 > out_rsync 2>&1995 1045 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1046 if ( $DEBUG_sys ) ; then 1047 echo "IGCM_sys_Put_Out :" $@ 1048 fi 1049 if [ $DRYRUN = 0 ]; then 1050 if [ ! -f ${1} ] ; then 1051 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1052 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1053 return 1 1054 fi 1055 # 1056 IGCM_sys_MkdirArchive $( dirname $2 ) 1057 # 1058 typeset RET 1059 1060 #===================================================== 1061 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1062 #===================================================== 1063 1064 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 1065 #if [ $? -eq 0 ] ; then 1066 # typeset WORKPATH FILEPATH 1067 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1068 # IGCM_sys_MkdirWork ${WORKPATH} 1069 # FILEPATH=${WORKPATH}/$( basename $2 ) 1070 # # 1071 # IGCM_sys_Cp ${1} ${FILEPATH} 1072 #fi 1073 1074 if [ X${JobType} = XRUN ] ; then 1075 if [ X${3} = X ] ; then 1076 IGCM_sys_Chmod 444 ${1} 1077 fi 1078 fi 1079 # 1080 # USUAL WAY 1081 \cp $1 $2 > out_rsync 2>&1 1082 RET=$? 996 1083 997 1084 # #RSYNC WITH NETWORK SSH CALL … … 1009 1096 # (( RET=RET+$? )) 1010 1097 1011 if [ ${RET} -gt 0 ] ; then 1012 echo "IGCM_sys_Put_Out : error." 1013 cat out_rsync 1014 IGCM_debug_Exit "IGCM_sys_Put_Out" 1015 else 1016 \rm out_rsync 1017 fi 1098 if [ ${RET} -gt 0 ] ; then 1099 echo "IGCM_sys_Put_Out : error." 1100 cat out_rsync 1101 IGCM_debug_Exit "IGCM_sys_Put_Out" 1018 1102 else 1019 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1020 fi 1021 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1022 return 0 1103 \rm out_rsync 1104 fi 1105 else 1106 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1107 fi 1108 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1109 return 0 1110 } 1111 1112 #D-#================================================== 1113 #D-function IGCM_sys_PutBuffer_Out 1114 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1115 #D-* Examples: 1116 #D- 1117 function IGCM_sys_PutBuffer_Out { 1118 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1119 if ( $DEBUG_sys ) ; then 1120 echo "IGCM_sys_PutBuffer_Out :" $@ 1121 fi 1122 if [ $DRYRUN = 0 ]; then 1123 if [ ! -f ${1} ] ; then 1124 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1125 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1126 return 1 1127 fi 1128 # 1129 IGCM_sys_Mkdir $( dirname $2 ) 1130 # 1131 typeset RET 1132 1133 if [ X${JobType} = XRUN ] ; then 1134 if [ X${3} = X ] ; then 1135 IGCM_sys_Chmod 444 ${1} 1136 fi 1137 fi 1138 # 1139 # USUAL WAY 1140 \cp $1 $2 > out_rsync 2>&1 1141 RET=$? 1142 1143 if [ ${RET} -gt 0 ] ; then 1144 echo "IGCM_sys_PutBuffer_Out : error." 1145 cat out_rsync 1146 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1147 else 1148 \rm out_rsync 1149 fi 1150 else 1151 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1152 fi 1153 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1154 return 0 1023 1155 } 1024 1156 … … 1029 1161 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1030 1162 function IGCM_sys_Get { 1031 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1032 1033 typeset DEST RET dm_liste ifile target file_work 1034 1035 if ( $DEBUG_sys ) ; then 1036 echo "IGCM_sys_Get :" $@ 1037 fi 1038 if [ $DRYRUN -le 2 ]; then 1039 if [ X${1} = X'/l' ] ; then 1040 # test if the first file is present in the old computation : 1041 eval set +A dm_liste \${${2}} 1042 else 1043 eval set +A dm_liste ${1} 1044 fi 1045 eval DEST=\${${#}} 1046 1047 #===================================================== 1048 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1049 #===================================================== 1050 1051 # Is it an R_OUT file (not R_IN) ? 1052 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1053 #if [ $? -eq 0 ] ; then 1054 # # Yes ? then we try to get it in SCRATCHDIR 1055 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|" ) 1056 # if [ -f ${file_work[0]} ] ; then 1057 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1058 # IGCM_debug_PopStack "IGCM_sys_Get" 1059 # return 1060 # fi 1061 #fi 1062 1063 # test if the (first) file is present in the old computation : 1064 IGCM_sys_TestFileArchive ${dm_liste[0]} 1065 RET=$? 1066 if [ ${RET} -gt 0 ] ; then 1067 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1068 IGCM_debug_Exit "IGCM_sys_Get" 1069 IGCM_debug_PopStack "IGCM_sys_Get" 1070 return 1071 fi 1072 1073 dmget ${dm_liste[*]} > out_rsync 2>&1 1074 RET=$? 1075 if [ ${RET} -gt 0 ] ; then 1076 echo "IGCM_sys_Get : demigration error." 1077 cat out_rsync 1078 IGCM_debug_Exit "IGCM_sys_Get" 1079 fi 1080 1081 #USUAL WAY 1082 if [ X${1} = X'/l' ] ; then 1083 (( RET=0 )) 1084 for target in ${dm_liste[*]} ; do 1085 local_file=$( basename ${target} ) 1086 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1087 (( RET = RET + $? )) 1088 done 1089 else 1090 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1091 RET=$? 1092 fi 1163 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1164 1165 typeset DEST RET dm_liste ifile target file_work 1166 1167 if ( $DEBUG_sys ) ; then 1168 echo "IGCM_sys_Get :" $@ 1169 fi 1170 if [ $DRYRUN -le 2 ]; then 1171 if [ X${1} = X'/l' ] ; then 1172 # test if the first file is present in the old computation : 1173 eval set +A dm_liste \${${2}} 1174 else 1175 eval set +A dm_liste ${1} 1176 fi 1177 eval DEST=\${${#}} 1178 1179 #===================================================== 1180 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1181 #===================================================== 1182 1183 # Is it an R_OUT file (not R_IN) ? 1184 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1185 #if [ $? -eq 0 ] ; then 1186 # # Yes ? then we try to get it in SCRATCHDIR 1187 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1188 # if [ -f ${file_work[0]} ] ; then 1189 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1190 # IGCM_debug_PopStack "IGCM_sys_Get" 1191 # return 1192 # fi 1193 #fi 1194 1195 # test if the (first) file is present in the old computation : 1196 IGCM_sys_TestFileArchive ${dm_liste[0]} 1197 RET=$? 1198 if [ ${RET} -gt 0 ] ; then 1199 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1200 IGCM_debug_Exit "IGCM_sys_Get" 1201 fi 1202 1203 dmget ${dm_liste[*]} > out_rsync 2>&1 1204 RET=$? 1205 if [ ${RET} -gt 0 ] ; then 1206 echo "WARNING IGCM_sys_Get : demigration error." 1207 cat out_rsync 1208 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1209 fi 1210 1211 #if [ ${RET} -gt 0 ] ; then 1212 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1213 # cat out_rsync 1214 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1215 # sleep 30 1216 # echo "We try another time" 1217 # dmget ${dm_liste[*]} > out_rsync 2>&1 1218 # RET=$? 1219 # if [ ${RET} -gt 0 ] ; then 1220 # echo "ERROR IGCM_sys_Get : again demigration error :" 1221 # cat out_rsync 1222 # IGCM_debug_Exit "IGCM_sys_Get" 1223 # fi 1224 # else 1225 # echo "ERROR IGCM_sys_Get : demigration error :" 1226 # cat out_rsync 1227 # IGCM_debug_Exit "IGCM_sys_Get" 1228 # fi 1229 #fi 1230 1231 #USUAL WAY 1232 if [ X${1} = X'/l' ] ; then 1233 (( RET=0 )) 1234 for target in ${dm_liste[*]} ; do 1235 local_file=$( basename ${target} ) 1236 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1237 (( RET = RET + $? )) 1238 done 1239 else 1240 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1241 RET=$? 1242 fi 1093 1243 1094 1244 # #RSYNC WITH NETWORK SSH CALL … … 1106 1256 # (( RET=RET+$? )) 1107 1257 1108 if [ ${RET} -gt 0 ] ; then 1109 echo "IGCM_sys_Get : copy error." 1110 cat out_rsync 1111 IGCM_debug_Exit "IGCM_sys_Get" 1112 else 1113 \rm out_rsync 1114 fi 1258 if [ ${RET} -gt 0 ] ; then 1259 echo "IGCM_sys_Get : copy error." 1260 cat out_rsync 1261 IGCM_debug_Exit "IGCM_sys_Get" 1115 1262 else 1116 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1117 fi 1118 IGCM_debug_PopStack "IGCM_sys_Get" 1263 \rm out_rsync 1264 fi 1265 else 1266 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1267 fi 1268 IGCM_debug_PopStack "IGCM_sys_Get" 1269 } 1270 1271 #D-#================================================== 1272 #D-function IGCM_sys_GetBuffer 1273 #D-* Purpose: Get a file from ${SCRATCHDIR} 1274 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1275 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1276 function IGCM_sys_GetBuffer { 1277 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1278 1279 typeset DEST RET buf_liste ifile target file_work 1280 1281 if ( $DEBUG_sys ) ; then 1282 echo "IGCM_sys_GetBuffer :" $@ 1283 fi 1284 if [ $DRYRUN -le 2 ]; then 1285 if [ X${1} = X'/l' ] ; then 1286 # test if the first file is present in the old computation : 1287 eval set +A buf_liste \${${2}} 1288 else 1289 eval set +A buf_liste ${1} 1290 fi 1291 eval DEST=\${${#}} 1292 1293 #USUAL WAY 1294 if [ X${1} = X'/l' ] ; then 1295 (( RET=0 )) 1296 for target in ${buf_liste[*]} ; do 1297 local_file=$( basename ${target} ) 1298 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1299 (( RET = RET + $? )) 1300 done 1301 else 1302 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1303 RET=$? 1304 fi 1305 1306 if [ ${RET} -gt 0 ] ; then 1307 echo "IGCM_sys_GetBuffer : copy error." 1308 cat out_rsync 1309 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1310 else 1311 \rm out_rsync 1312 fi 1313 else 1314 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1315 fi 1316 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1119 1317 } 1120 1318 … … 1125 1323 #D- 1126 1324 function IGCM_sys_GetDate_FichWork { 1127 1128 1129 1130 1131 1132 1133 1325 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1326 if ( $DEBUG_sys ) ; then 1327 echo "IGCM_sys_GetDate_FichWork :" $@ 1328 fi 1329 typeset dateF 1330 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1331 eval ${2}=${dateF[5]} 1134 1332 1135 1333 # donne la date filesys d'un fichier sur la machine work 1136 1334 IGCM_debug_PopStack "IGCM_sys_FichWork" 1137 1335 } 1138 1336 … … 1143 1341 #D- 1144 1342 function IGCM_sys_GetDate_FichArchive { 1145 1146 1147 1148 1149 1150 1151 1152 1153 1343 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1344 if ( $DEBUG_sys ) ; then 1345 echo "IGCM_sys_GetDate_FichArchive :" $@ 1346 fi 1347 typeset dateF 1348 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1349 eval ${2}=${dateF[5]} 1350 1351 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1154 1352 } 1155 1353 … … 1158 1356 1159 1357 function IGCM_sys_rebuild { 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1358 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1359 if ( $DEBUG_sys ) ; then 1360 echo "IGCM_sys_rebuild :" $@ 1361 fi 1362 /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ 1363 if [ $? -gt 0 ] ; then 1364 echo "IGCM_sys_rebuild : erreur ${@}." 1365 IGCM_debug_Exit "rebuild" 1366 fi 1367 1368 IGCM_debug_PopStack "IGCM_sys_rebuild" 1171 1369 } 1172 1370 … … 1175 1373 1176 1374 function IGCM_sys_activ_variables { 1177 1178 1179 1180 1375 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1376 if ( $DEBUG_sys ) ; then 1377 echo "IGCM_sys_activ_variables" 1378 fi 1181 1379 1182 1380 # -------------------------------------------------------------------- … … 1185 1383 1186 1384 #D-- MPISUSPEND 1187 1385 export MPISUSPEND=${MPISUSPEND:=OFF} 1188 1386 1189 1387 #D-- MPIPROGINF #other choices : ALL_DETAIL2 1190 1388 export MPIPROGINF=ALL 1191 1389 #D- activate ftrace (with -ftrace) 1192 1390 export F_FTRACE=YES 1193 1391 #D- communication information (with -ftrace) 1194 1392 export MPICOMMINF=DETAIL 1195 1393 1196 1394 # -------------------------------------------------------------------- … … 1199 1397 1200 1398 #D- max number of character/line in output job 1201 1399 export F_SYSLEN=5000 1202 1400 #D- number of error that can be admitted on the NEC 1203 1401 export F_ERRCNT=0 1204 1402 #D- global performance 1205 1403 export F_PROGINF=DETAIL 1206 1404 1207 1405 #D- I/O performance (FORTRAN I/O only not netCDF) 1208 1406 export F_FILEINF=${F_FILEINF:=NO} 1209 1407 #D- netCDF I/O performance 1210 1211 1212 1408 export NC_FILEINF=${NC_FILEINF:=NO} 1409 1410 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1213 1411 } 1214 1412 … … 1217 1415 1218 1416 function IGCM_sys_desactiv_variables { 1219 1220 1221 1222 1417 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1418 if ( $DEBUG_sys ) ; then 1419 echo "IGCM_sys_desactiv_variables" 1420 fi 1223 1421 # -------------------------------------------------------------------- 1224 1422 #D- MPI specifications … … 1226 1424 1227 1425 #D-- MPIPROGINF 1228 1426 export MPIPROGINF=NO 1229 1427 1230 1428 # -------------------------------------------------------------------- … … 1233 1431 1234 1432 #D- global performance 1235 1236 1237 1433 export F_PROGINF=NO 1434 1435 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1238 1436 } 1239 1437 … … 1242 1440 1243 1441 function IGCM_sys_build_run_file { 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1442 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1443 if ( $DEBUG_sys ) ; then 1444 echo "IGCM_sys_build_run_file " $@ 1445 fi 1446 (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 )) 1447 (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 1448 (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 1449 1450 if [ $1 = MPI2 ]; then 1451 cat <<EOF > run_file 1254 1452 -p 1 -np 1 -e ./oasis 1255 1453 EOF 1256 1257 1258 1259 1260 1454 (( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 )) 1455 config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"' 1456 1457 elif [ $1 = MPI1 ]; then 1458 cat <<EOF > run_file 1261 1459 -p $NUM_PROC_OASIS -e ./oasis 1262 1460 -p $NUM_PROC_ATM -e ./lmdz.x 1263 1461 -p $NUM_PROC_OCE -e ./opa.xx 1264 1462 EOF 1265 1266 fi 1267 1268 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1269 1270 } 1463 fi 1464 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1465 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r538 r544 68 68 typeset LOGIN=${LOGIN:=$( whoami )} 69 69 # $hostname of the MASTER job 70 typeset MASTER=titane 100070 typeset MASTER=titane 71 71 72 72 #D- … … 113 113 typeset -r ARCHIVE=${DMFDIR} 114 114 115 # ============ CESIUM START ============ # 116 115 117 #==================================================== 116 118 #- Mirror libIGCM from titane to cesium if needed 117 ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )118 if [ ! ${ROOTSYS} = "home" ] ; then119 120 else121 122 fi119 #ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' ) 120 #if [ ! ${ROOTSYS} = "home" ] ; then 121 # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} 122 #else 123 # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 124 #fi 123 125 124 126 #==================================================== 125 127 #- libIGCM_POST 126 if ( ${MirrorlibIGCM} ) ; then 127 PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 128 typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 129 else 130 typeset -r libIGCM_POST=${libIGCM} 131 fi 128 #if ( ${MirrorlibIGCM} ) ; then 129 # PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 130 # typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 131 #else 132 # typeset -r libIGCM_POST=${libIGCM} 133 #fi 134 135 # ============ CESIUM END ============ # 136 137 #==================================================== 138 #- MirrorlibIGCM for frontend 139 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 140 141 #==================================================== 142 #- libIGCM_POST for frontend 143 typeset -r libIGCM_POST=${libIGCM} 132 144 133 145 #==================================================== … … 137 149 138 150 #==================================================== 139 #- OUT151 #- R_OUT 140 152 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 141 153 142 154 #==================================================== 143 #- OUT_SCR (ONLY FOR double copy an scratch) 144 typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT 155 #- R_BUF (ONLY FOR double copy an scratch) 156 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 157 158 #==================================================== 159 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 160 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 145 161 146 162 #==================================================== … … 151 167 #- RUN_DIR_PATH : Temporary working directory (=> TMP) 152 168 if [ ! X${LSB_QUEUE} = Xmono ] ; then 153 169 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${LSB_JOBID}} 154 170 else 155 171 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${LSB_JOBID}} 156 172 fi 157 158 #====================================================159 #- BIG_DIR : BIG_DIR to store files waiting for rebuild160 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}161 173 162 174 #==================================================== … … 174 186 #D- 175 187 function IGCM_sys_RshMaster { 176 177 ssh -t ${MASTER}/bin/ksh <<-EOF188 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 189 /bin/ksh <<-EOF 178 190 export libIGCM=${libIGCM} 179 191 export DEBUG_debug=${DEBUG_debug} … … 182 194 ${@} 183 195 EOF 184 185 186 187 188 196 if [ $? -gt 0 ] ; then 197 echo "IGCM_sys_RshMaster : erreur." 198 IGCM_debug_Exit "IGCM_sys_RshMaster" 199 fi 200 IGCM_debug_PopStack "IGCM_sys_RshMaster" 189 201 } 190 202 … … 195 207 #D- 196 208 function IGCM_sys_RshArchive { 197 198 209 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 210 /bin/ksh <<-EOF 199 211 ${@} 200 212 EOF 201 202 203 204 205 213 if [ $? -gt 0 ] ; then 214 echo "IGCM_sys_RshArchive : erreur." 215 IGCM_debug_Exit "IGCM_sys_RshArchive" 216 fi 217 IGCM_debug_PopStack "IGCM_sys_RshArchive" 206 218 } 207 219 … … 212 224 #D- 213 225 function IGCM_sys_RshPost { 214 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 215 if ( $DEBUG_sys ) ; then 216 echo "IGCM_sys_RshPost :" $@ 217 fi 218 219 typeset NB_ESSAI DELAI status i 220 # keep standard input for the loop onto temporary file 221 cat >tmp_IGCM_sys_RshPost_$$ 222 223 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 224 #cat tmp_IGCM_sys_RshPost_$$ 225 226 if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 227 # little hack so that rebuild submission is done on titane not an cesium 228 # 229 libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 230 POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 231 sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 232 sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 233 sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 234 sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 235 #\mv tmp.txt tmp_IGCM_sys_RshPost_$$ 236 # 237 #echo cat tmp_IGCM_sys_RshPost_$$ AFTER 238 #cat tmp_IGCM_sys_RshPost_$$ 239 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 240 if [ $? -gt 0 ] ; then 241 echo "IGCM_sys_RshPost : erreur." 242 IGCM_debug_Exit "IGCM_sys_RshPost" 243 fi 244 # delete temporary file 245 \rm tmp_IGCM_sys_RshPost_$$ 246 else 247 # number of tentative 248 NB_ESSAI=10 249 # time delay between tentative 250 DELAI=10 251 i=0 252 while [ $i -ne $NB_ESSAI ] ; do 253 ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 254 status=$? 255 if [ ${status} -ne 0 ]; 256 then 257 sleep $DELAI 258 else 259 break 260 fi 261 let i=$i+1 262 done 263 # delete temporary file 264 \rm tmp_IGCM_sys_RshPost_$$ 265 266 if [ ${status} -gt 0 ] ; then 267 echo "IGCM_sys_RshPost : erreur." 268 IGCM_debug_Exit "IGCM_sys_RshPost" 269 fi 270 fi 271 IGCM_debug_PopStack "IGCM_sys_RshPost" 226 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 227 if ( $DEBUG_sys ) ; then 228 echo "IGCM_sys_RshPost :" $@ 229 fi 230 231 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 232 #cat tmp_IGCM_sys_RshPost_$$ 233 # keep standard input (stdin) for the loop onto temporary file 234 cat >tmp_IGCM_sys_RshPost_$$ 235 236 # ============ FRONTEND START ============ # 237 238 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 239 if [ $? -gt 0 ] ; then 240 echo "IGCM_sys_RshPost : erreur." 241 IGCM_debug_Exit "IGCM_sys_RshPost" 242 fi 243 # delete temporary file 244 \rm tmp_IGCM_sys_RshPost_$$ 245 246 # ============ FRONTEND END ============ # 247 248 # ============ CESIUM START ============ # 249 # typeset NB_ESSAI DELAI status i 250 # if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 251 # #little hack so that rebuild submission is done on titane not an cesium 252 # 253 # libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 254 # POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 255 # sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 256 # sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 257 # sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 258 # sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 259 # \mv tmp.txt tmp_IGCM_sys_RshPost_$$ 260 # 261 # echo cat tmp_IGCM_sys_RshPost_$$ AFTER 262 # cat tmp_IGCM_sys_RshPost_$$ 263 # 264 # /bin/ksh <tmp_IGCM_sys_RshPost_$$ 265 # if [ $? -gt 0 ] ; then 266 # echo "IGCM_sys_RshPost : erreur." 267 # IGCM_debug_Exit "IGCM_sys_RshPost" 268 # fi 269 # # delete temporary file 270 # \rm tmp_IGCM_sys_RshPost_$$ 271 # 272 # else 273 # # number of tentative 274 # NB_ESSAI=10 275 # # time delay between tentative 276 # DELAI=10 277 # i=0 278 # while [ $i -ne $NB_ESSAI ] ; do 279 # ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 280 # status=$? 281 # if [ ${status} -ne 0 ]; 282 # then 283 # sleep $DELAI 284 # else 285 # break 286 # fi 287 # let i=$i+1 288 # done 289 # # delete temporary file 290 # \rm tmp_IGCM_sys_RshPost_$$ 291 # 292 # if [ ${status} -gt 0 ] ; then 293 # echo "IGCM_sys_RshPost : erreur." 294 # IGCM_debug_Exit "IGCM_sys_RshPost" 295 # fi 296 # fi 297 298 # ============ CESIUM END ============ # 299 300 IGCM_debug_PopStack "IGCM_sys_RshPost" 272 301 } 273 302 … … 278 307 #D- 279 308 function IGCM_sys_SendMail { 280 281 282 283 284 285 286 287 288 289 290 291 309 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 310 if ( $DEBUG_sys ) ; then 311 echo "IGCM_sys_SendMail :" $@ 312 fi 313 314 if ( ${ExitFlag} ) ; then 315 status=failed 316 else 317 status=completed 318 fi 319 320 ssh -t titane996 ssh platine /bin/ksh <<-EOF 292 321 export LOGIN=${LOGIN} 293 322 export config_UserChoices_JobName=${config_UserChoices_JobName} … … 314 343 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 315 344 fi 316 317 345 sleep 10 318 346 rm -f job_end.mail 319 347 EOF 320 348 321 322 323 324 325 349 if [ $? -gt 0 ] ; then 350 echo "IGCM_sys_SendMail : erreur." 351 IGCM_debug_Exit "IGCM_sys_SendMail" 352 fi 353 IGCM_debug_PopStack "IGCM_sys_SendMail" 326 354 } 327 355 … … 332 360 #D- 333 361 function IGCM_sys_Mkdir { 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 362 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 363 if ( $DEBUG_sys ) ; then 364 echo "IGCM_sys_Mkdir :" $@ 365 fi 366 if [ ! -d ${1} ]; then 367 \mkdir -p $1 368 if [ $? -gt 0 ] ; then 369 echo "IGCM_sys_Mkdir : erreur." 370 IGCM_debug_Exit "IGCM_sys_Mkdir" 371 fi 372 fi 373 # vérification : 374 if [ ! -d ${1} ] ; then 375 echo "IGCM_sys_Mkdir : erreur." 376 IGCM_debug_Exit "IGCM_sys_Mkdir" 377 fi 378 IGCM_debug_PopStack "IGCM_sys_Mkdir" 351 379 } 352 380 … … 357 385 #D- 358 386 function IGCM_sys_MkdirArchive { 359 360 361 362 363 364 365 366 367 368 369 370 371 387 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 388 if ( $DEBUG_sys ) ; then 389 echo "IGCM_sys_MkdirArchive :" $@ 390 fi 391 #- creation de repertoire sur le serveur fichier 392 if [ ! -d ${1} ]; then 393 \mkdir -p $1 394 if [ $? -gt 0 ] ; then 395 echo "IGCM_sys_MkdirArchive : erreur." 396 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 397 fi 398 fi 399 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 372 400 } 373 401 … … 378 406 #D- 379 407 function IGCM_sys_MkdirWork { 380 381 382 383 384 385 386 387 388 389 390 391 392 408 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 409 if ( $DEBUG_sys ) ; then 410 echo "IGCM_sys_MkdirWork :" $@ 411 fi 412 #- creation de repertoire sur le serveur fichier 413 if [ ! -d ${1} ]; then 414 \mkdir -p $1 415 if [ $? -gt 0 ] ; then 416 echo "IGCM_sys_MkdirWork : erreur." 417 IGCM_debug_Exit "IGCM_sys_MkdirWork" 418 fi 419 fi 420 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 393 421 } 394 422 … … 399 427 #D- 400 428 function IGCM_sys_Cd { 401 402 403 404 405 406 407 408 409 410 429 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 430 if ( $DEBUG_sys ) ; then 431 echo "IGCM_sys_Cd :" $@ 432 fi 433 \cd $1 434 if [ $? -gt 0 ] ; then 435 echo "IGCM_sys_Cd : erreur." 436 IGCM_debug_Exit "IGCM_sys_Cd" 437 fi 438 IGCM_debug_PopStack "IGCM_sys_Cd" 411 439 } 412 440 … … 417 445 #D- 418 446 function IGCM_sys_Chmod { 419 420 421 422 423 424 425 426 427 428 429 430 431 432 447 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 448 if ( $DEBUG_sys ) ; then 449 echo "IGCM_sys_Chmod :" $@ 450 fi 451 if [ $DRYRUN -le 1 ]; then 452 \chmod $@ 453 if [ $? -gt 0 ] ; then 454 echo "IGCM_sys_Chmod : erreur." 455 IGCM_debug_Exit "IGCM_sys_Chmod" 456 fi 457 else 458 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 459 fi 460 IGCM_debug_PopStack "IGCM_sys_Chmod" 433 461 } 434 462 … … 439 467 #D- 440 468 function IGCM_sys_FileSize { 441 442 443 444 445 446 447 448 449 450 469 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 470 471 typeset sizeF 472 set +A sizeF -- $( ls -la ${1} ) 473 if [ $? -gt 0 ] ; then 474 IGCM_debug_Exit "IGCM_sys_FileSize" 475 fi 476 eval ${2}=${sizeF[4]} 477 478 IGCM_debug_PopStack "IGCM_sys_FileSize" 451 479 } 452 480 … … 457 485 #D- 458 486 function IGCM_sys_TestDir { 459 460 461 462 463 464 465 466 467 487 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 488 if ( $DEBUG_sys ) ; then 489 echo "IGCM_sys_TestDir :" $@ 490 fi 491 typeset ExistFlag 492 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 493 IGCM_debug_PopStack "IGCM_sys_TestDir" 494 495 return ${ExistFlag} 468 496 } 469 497 … … 474 502 #D- 475 503 function IGCM_sys_TestDirArchive { 476 477 478 479 480 481 482 483 484 504 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 505 if ( $DEBUG_sys ) ; then 506 echo "IGCM_sys_TestDirArchive :" $@ 507 fi 508 typeset ExistFlag 509 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 510 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 511 512 return ${ExistFlag} 485 513 } 486 514 … … 491 519 #D- 492 520 function IGCM_sys_TestFileArchive { 493 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 494 typeset ExistFlag 495 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 496 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 497 498 return ${ExistFlag} 521 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 522 if ( $DEBUG_sys ) ; then 523 echo "IGCM_sys_TestFileArchive :" $@ 524 fi 525 typeset ExistFlag 526 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 527 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 528 529 return ${ExistFlag} 530 } 531 532 #D-#================================================== 533 #D-function IGCM_sys_TestFileBuffer 534 #D-* Purpose: Test file that must NOT EXISTS on Buffer 535 #D-* Examples: 536 #D- 537 function IGCM_sys_TestFileBuffer { 538 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 539 typeset ExistFlag 540 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 541 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 542 543 return ${ExistFlag} 499 544 } 500 545 … … 505 550 #D- 506 551 function IGCM_sys_CountFileArchive { 507 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 508 ls ${@} 2>/dev/null | wc -l 509 if [ $? -gt 0 ] ; then 510 echo "IGCM_sys_CountFileArchive : erreur." 511 fi 512 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 552 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 553 ls ${@} 2>/dev/null | wc -l 554 if [ $? -gt 0 ] ; then 555 echo "IGCM_sys_CountFileArchive : erreur." 556 fi 557 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 558 } 559 560 #D-#================================================== 561 #D-function IGCM_sys_CountFileBuffer 562 #D-* Purpose: Count files on Scratch filesystem 563 #D-* Examples: 564 #D- 565 function IGCM_sys_CountFileBuffer { 566 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 567 ls ${@} 2>/dev/null | wc -l 568 if [ $? -gt 0 ] ; then 569 echo "IGCM_sys_CountFileBuffer : erreur." 570 fi 571 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 513 572 } 514 573 … … 519 578 #D- 520 579 function IGCM_sys_Tree { 521 522 523 524 525 526 527 528 580 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 581 if ( $DEBUG_sys ) ; then 582 echo "IGCM_sys_Tree :" $@ 583 fi 584 585 \ls -lR ${@} 586 587 IGCM_debug_PopStack "IGCM_sys_Tree" 529 588 } 530 589 531 590 #D-#================================================== 532 591 #D-function IGCM_sys_Tar 533 #D-* Purpose: master un-tar command592 #D-* Purpose: master tar command 534 593 #D-* Examples: 535 594 #D- 536 595 function IGCM_sys_Tar { 537 538 539 540 541 542 543 544 545 546 596 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 597 if ( $DEBUG_sys ) ; then 598 echo "IGCM_sys_Tar :" $@ 599 fi 600 \tar cf $@ 601 if [ $? -gt 0 ] ; then 602 echo "IGCM_sys_Tar : erreur." 603 IGCM_debug_Exit "IGCM_sys_Tar" 604 fi 605 IGCM_debug_PopStack "IGCM_sys_Tar" 547 606 } 548 607 … … 553 612 #D- 554 613 function IGCM_sys_UnTar { 555 556 557 558 559 560 561 562 563 564 614 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 615 if ( $DEBUG_sys ) ; then 616 echo "IGCM_sys_UnTar :" $@ 617 fi 618 \tar xvf $1 619 if [ $? -gt 0 ] ; then 620 echo "IGCM_sys_UnTar : erreur." 621 IGCM_debug_Exit "IGCM_sys_UnTar" 622 fi 623 IGCM_debug_PopStack "IGCM_sys_UnTar" 565 624 } 566 625 … … 571 630 #D- 572 631 function IGCM_sys_Qsub { 573 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 574 if ( $DEBUG_sys ) ; then 575 echo "IGCM_sys_Qsub :" $@ 576 fi 577 578 if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 579 /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} < $1 580 else 581 /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod} < $1 582 fi 583 584 if [ $? -gt 0 ] ; then 585 echo "IGCM_sys_Qsub : erreur " $@ 586 IGCM_debug_Exit "IGCM_sys_Qsub" 587 fi 588 IGCM_debug_PopStack "IGCM_sys_Qsub" 632 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 633 if ( $DEBUG_sys ) ; then 634 echo "IGCM_sys_Qsub :" $@ 635 fi 636 typeset options 637 if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 638 options=" -o ${Script_Output} -e ${Script_Output}" 639 else 640 options=" -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod}" 641 fi 642 643 /usr/local/bin/ccc_msub ${options} < $1 644 if [ $? -gt 0 ] ; then 645 echo "IGCM_sys_Qsub : erreur ${options} $1" 646 IGCM_debug_Exit "IGCM_sys_Qsub" 647 fi 648 IGCM_debug_PopStack "IGCM_sys_Qsub" 589 649 } 590 650 … … 595 655 #D- 596 656 function IGCM_sys_QsubPost { 597 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 598 if ( $DEBUG_sys ) ; then 599 echo "IGCM_sys_QsubPost :" $@ 600 fi 601 /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 602 if [ $? -gt 0 ] ; then 603 echo "IGCM_sys_QsubPost : erreur " $@ 604 IGCM_debug_Exit "IGCM_sys_QsubPost" 605 fi 606 IGCM_debug_PopStack "IGCM_sys_QsubPost" 657 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 658 if ( $DEBUG_sys ) ; then 659 echo "IGCM_sys_QsubPost :" $@ 660 fi 661 662 # Need to export listVarEnv for cesium 663 # NO Need to export listVarEnv for titane 664 # ============ FRONTEND START ============ # 665 666 /usr/local/bin/ccc_msub -p ${BRIDGE_MSUB_PROJECT} -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job 667 668 # ============ FRONTEND END ============ # 669 670 # ============ CESIUM START ============ # 671 # typeset NB_ESSAI DELAI status i 672 # # number of tentative 673 # NB_ESSAI=10 674 # # time delay between tentative 675 # DELAI=10 676 # (( i = 0 )) 677 # while [ $i -lt $NB_ESSAI ] ; do 678 # /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 679 # status=$? 680 # if [ ${status} -gt 0 ]; then 681 # sleep $DELAI 682 # else 683 # break 684 # fi 685 # (( i = i + 1 )) 686 # done 687 # ============ CESIUM END ============ # 688 689 if [ $? -gt 0 ] ; then 690 echo "IGCM_sys_QsubPost : erreur " $@ 691 IGCM_debug_Exit "IGCM_sys_QsubPost" 692 fi 693 IGCM_debug_PopStack "IGCM_sys_QsubPost" 607 694 } 608 695 … … 618 705 #D- Error values and explanations can depend on your system version. 619 706 function IGCM_sys_Rsync_out { 620 RET=$1 621 if [ ! $RET ] ; then 622 echo "rsync error !" 623 fi 624 625 if [ $MYLANG = "fr" ]; then 626 case $RET in 627 0) return ;; 628 1) echo "Erreur de rsync ; RERR_SYNTAX : " 629 echo "Erreur de syntaxe ou d'utilisation." 630 return;; 631 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 632 echo "Incompatibilité de protocole." 633 return;; 634 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 635 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 636 echo "répertoires" 637 return;; 638 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 639 echo "Action demandée non supportée : une tentative de manipulation de" 640 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 641 echo "été faite ; ou une option qui est supportée par le client mais" 642 echo "pas par le serveur a été spécifiée." 643 return;; 644 10) echo "Erreur de rsync ; RERR_SOCKETIO" 645 echo "Erreur dans le socket d'entrée sortie" 646 return;; 647 11) echo "Erreur de rsync ; RERR_FILEIO" 648 echo "Erreur d'entrée sortie fichier" 649 return;; 650 12) echo "Erreur de rsync ; RERR_STREAMIO" 651 echo "Erreur dans flux de donnée du protocole rsync" 652 return;; 653 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 654 echo "Erreur avec les diagnostics du programme" 655 return;; 656 14) echo "Erreur de rsync ; RERR_IPC" 657 echo "Erreur dans le code IPC" 658 return;; 659 20) echo "Erreur de rsync ; RERR_SIGNAL" 660 echo "SIGUSR1 ou SIGINT reçu" 661 return;; 662 21) echo "Erreur de rsync ; RERR_WAITCHILD" 663 echo "Une erreur retournée par waitpid()" 664 return;; 665 22) echo "Erreur de rsync ; RERR_MALLOC" 666 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 667 return;; 668 23) echo "" 669 echo "Erreur fichier inexistant" 670 return;; 671 30) echo "Erreur de rsync ; RERR_TIMEOUT" 672 echo "Temps d'attente écoulé dans l'envoi/réception de données" 673 return;; 674 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 675 return;; 676 esac 677 elif [ $MYLANG = "en" ] ; then 678 case $RET in 679 0) return;; 680 1) echo "rsync error : Syntax or usage error " 681 return;; 682 2) echo "rsync error : Protocol incompatibility " 683 return;; 684 3) echo "rsync error : Errors selecting input/output files, dirs" 685 return;; 686 4) echo "rsync error : Requested action not supported: an attempt" 687 echo "was made to manipulate 64-bit files on a platform that cannot support" 688 echo "them; or an option was specified that is supported by the client and" 689 echo "not by the server." 690 return;; 691 5) echo "rsync error : Error starting client-server protocol" 692 return;; 693 10) echo "rsync error : Error in socket I/O " 694 return;; 695 11) echo "rsync error : Error in file I/O " 696 return;; 697 12) echo "rsync error : Error in rsync protocol data stream " 698 return;; 699 13) echo "rsync error : Errors with program diagnostics " 700 return;; 701 14) echo "rsync error : Error in IPC code " 702 return;; 703 20) echo "rsync error : Received SIGUSR1 or SIGINT " 704 return;; 705 21) echo "rsync error : Some error returned by waitpid() " 706 return;; 707 22) echo "rsync error : Error allocating core memory buffers " 708 return;; 709 23) echo "rsync error : Partial transfer due to error" 710 return;; 711 24) echo "rsync error : Partial transfer due to vanished source files" 712 return;; 713 30) echo "rsync error : Timeout in data send/receive " 714 return;; 715 *) echo "rsync error : return code of rsync unknown :" $RET 716 return;; 717 esac 718 else 719 echo "unknown language $MYLANG." 720 return 721 fi 722 } 723 707 RET=$1 708 if [ ! $RET ] ; then 709 echo "rsync error !" 710 fi 711 712 if [ $MYLANG = "fr" ]; then 713 case $RET in 714 0) return ;; 715 1) echo "Erreur de rsync ; RERR_SYNTAX : " 716 echo "Erreur de syntaxe ou d'utilisation." 717 return;; 718 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 719 echo "Incompatibilité de protocole." 720 return;; 721 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 722 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 723 echo "répertoires" 724 return;; 725 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 726 echo "Action demandée non supportée : une tentative de manipulation de" 727 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 728 echo "été faite ; ou une option qui est supportée par le client mais" 729 echo "pas par le serveur a été spécifiée." 730 return;; 731 10) echo "Erreur de rsync ; RERR_SOCKETIO" 732 echo "Erreur dans le socket d'entrée sortie" 733 return;; 734 11) echo "Erreur de rsync ; RERR_FILEIO" 735 echo "Erreur d'entrée sortie fichier" 736 return;; 737 12) echo "Erreur de rsync ; RERR_STREAMIO" 738 echo "Erreur dans flux de donnée du protocole rsync" 739 return;; 740 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 741 echo "Erreur avec les diagnostics du programme" 742 return;; 743 14) echo "Erreur de rsync ; RERR_IPC" 744 echo "Erreur dans le code IPC" 745 return;; 746 20) echo "Erreur de rsync ; RERR_SIGNAL" 747 echo "SIGUSR1 ou SIGINT reçu" 748 return;; 749 21) echo "Erreur de rsync ; RERR_WAITCHILD" 750 echo "Une erreur retournée par waitpid()" 751 return;; 752 22) echo "Erreur de rsync ; RERR_MALLOC" 753 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 754 return;; 755 23) echo "" 756 echo "Erreur fichier inexistant" 757 return;; 758 30) echo "Erreur de rsync ; RERR_TIMEOUT" 759 echo "Temps d'attente écoulé dans l'envoi/réception de données" 760 return;; 761 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 762 return;; 763 esac 764 elif [ $MYLANG = "en" ] ; then 765 case $RET in 766 0) return;; 767 1) echo "rsync error : Syntax or usage error " 768 return;; 769 2) echo "rsync error : Protocol incompatibility " 770 return;; 771 3) echo "rsync error : Errors selecting input/output files, dirs" 772 return;; 773 4) echo "rsync error : Requested action not supported: an attempt" 774 echo "was made to manipulate 64-bit files on a platform that cannot support" 775 echo "them; or an option was specified that is supported by the client and" 776 echo "not by the server." 777 return;; 778 5) echo "rsync error : Error starting client-server protocol" 779 return;; 780 10) echo "rsync error : Error in socket I/O " 781 return;; 782 11) echo "rsync error : Error in file I/O " 783 return;; 784 12) echo "rsync error : Error in rsync protocol data stream " 785 return;; 786 13) echo "rsync error : Errors with program diagnostics " 787 return;; 788 14) echo "rsync error : Error in IPC code " 789 return;; 790 20) echo "rsync error : Received SIGUSR1 or SIGINT " 791 return;; 792 21) echo "rsync error : Some error returned by waitpid() " 793 return;; 794 22) echo "rsync error : Error allocating core memory buffers " 795 return;; 796 23) echo "rsync error : Partial transfer due to error" 797 return;; 798 24) echo "rsync error : Partial transfer due to vanished source files" 799 return;; 800 30) echo "rsync error : Timeout in data send/receive " 801 return;; 802 *) echo "rsync error : return code of rsync unknown :" $RET 803 return;; 804 esac 805 else 806 echo "unknown language $MYLANG." 807 return 808 fi 809 } 724 810 725 811 #D-#================================================== … … 729 815 #D- 730 816 function IGCM_sys_Mirror_libIGCM { 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 817 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 818 if ( $DEBUG_sys ) ; then 819 echo "IGCM_sys_Mirror_libIGCM" 820 fi 821 822 typeset RET DEST 823 824 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 825 826 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 827 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 828 RET=$? 829 830 if [ ${RET} -gt 0 ] ; then 831 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 832 cat out_rsync 833 fi 834 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 749 835 } 750 836 … … 752 838 #- Call IGCM_sys_Mirror_libIGCM now ! 753 839 if ( $MirrorlibIGCM ) ; then 754 840 IGCM_sys_Mirror_libIGCM 755 841 fi 756 842 … … 761 847 #D- 762 848 function IGCM_sys_Cp { 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 849 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 850 if ( $DEBUG_sys ) ; then 851 echo "IGCM_sys_Cp :" $@ 852 fi 853 854 typeset RET 855 856 echo cp $@ > out_rsync 2>&1 857 \cp $@ >> out_rsync 2>&1 858 RET=$? 859 860 if [ ${RET} -gt 0 ] ; then 861 echo "IGCM_sys_Cp : error." 862 cat out_rsync 863 IGCM_debug_Exit "IGCM_sys_Cp" 864 else 865 \rm out_rsync 866 fi 867 IGCM_debug_PopStack "IGCM_sys_Cp" 782 868 } 783 869 … … 788 874 #D- 789 875 function IGCM_sys_Rm { 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 876 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 877 if ( $DEBUG_sys ) ; then 878 echo "IGCM_sys_Rm :" $@ 879 fi 880 881 typeset RET 882 883 echo rm $@ > out_rsync 2>&1 884 \rm $@ >> out_rsync 2>&1 885 RET=$? 886 887 if [ ${RET} -gt 0 ] ; then 888 echo "IGCM_sys_Rm : error." 889 cat out_rsync 890 IGCM_debug_Exit "IGCM_sys_Rm" 891 else 892 \rm out_rsync 893 fi 894 IGCM_debug_PopStack "IGCM_sys_Rm" 809 895 } 810 896 … … 816 902 #D- 817 903 function IGCM_sys_RmRunDir { 818 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 819 if ( $DEBUG_sys ) ; then 820 echo "IGCM_sys_RmRunDir :" $@ 821 fi 822 823 typeset RET 824 825 echo rm $@ > out_rsync 2>&1 826 \rm $@ >> out_rsync 2>&1 827 RET=$? 828 829 if [ ${RET} -gt 0 ] ; then 830 echo "IGCM_sys_RmRunDir : error." 831 cat out_rsync 832 IGCM_debug_Exit "IGCM_sys_RmRunDir" 833 else 834 \rm out_rsync 835 fi 836 837 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 904 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 905 if ( $DEBUG_sys ) ; then 906 echo "IGCM_sys_RmRunDir :" $@ 907 fi 908 909 typeset RET 910 911 echo rm $@ > out_rsync 2>&1 912 \rm $@ >> out_rsync 2>&1 913 RET=$? 914 915 if [ ${RET} -gt 0 ] ; then 916 echo "IGCM_sys_RmRunDir : error." 917 cat out_rsync 918 IGCM_debug_Exit "IGCM_sys_RmRunDir" 919 else 920 \rm out_rsync 921 fi 922 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 838 923 } 839 924 … … 844 929 #D- 845 930 function IGCM_sys_Mv { 846 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 847 if ( $DEBUG_sys ) ; then 848 echo "IGCM_sys_Mv :" $@ 849 fi 850 851 if [ $DRYRUN = 0 ]; then 852 853 typeset RET 854 855 echo mv $@ > out_rsync 2>&1 856 \mv $@ >> out_rsync 2>&1 857 RET=$? 931 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 932 if ( $DEBUG_sys ) ; then 933 echo "IGCM_sys_Mv :" $@ 934 fi 935 936 if [ $DRYRUN = 0 ]; then 937 938 typeset RET 858 939 859 if [ ${RET} -gt 0 ] ; then 860 echo "IGCM_sys_Mv : error in mv." 861 cat out_rsync 862 IGCM_debug_Exit "IGCM_sys_Mv" 863 else 864 \rm out_rsync 865 fi 940 echo mv $@ > out_rsync 2>&1 941 \mv $@ >> out_rsync 2>&1 942 RET=$? 943 944 if [ ${RET} -gt 0 ] ; then 945 echo "IGCM_sys_Mv : error in mv." 946 cat out_rsync 947 IGCM_debug_Exit "IGCM_sys_Mv" 866 948 else 867 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 868 fi 869 870 IGCM_debug_PopStack "IGCM_sys_Mv" 949 \rm out_rsync 950 fi 951 else 952 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 953 fi 954 955 IGCM_debug_PopStack "IGCM_sys_Mv" 871 956 } 872 957 … … 877 962 #D- 878 963 function IGCM_sys_Put_Dir { 879 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 880 if ( $DEBUG_sys ) ; then 881 echo "IGCM_sys_Put_Dir :" $@ 882 fi 883 if [ $DRYRUN = 0 ]; then 884 if [ ! -d ${1} ] ; then 885 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 886 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 887 return 888 fi 889 890 typeset RET 891 892 # Only if we use rsync 893 #IGCM_sys_TestDirArchive $( dirname $2 ) 894 # 895 #USUAL WAY 896 \cp -r $1 $2 > out_rsync 2>&1 897 RET=$? 898 899 if [ ${RET} -gt 0 ] ; then 900 echo "IGCM_sys_Put_Dir : error." 901 cat out_rsync 902 IGCM_debug_Exit "IGCM_sys_Put_Dir" 903 else 904 \rm out_rsync 905 fi 964 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 965 if ( $DEBUG_sys ) ; then 966 echo "IGCM_sys_Put_Dir :" $@ 967 fi 968 if [ $DRYRUN = 0 ]; then 969 if [ ! -d ${1} ] ; then 970 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 971 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 972 return 973 fi 974 975 typeset RET 976 977 # Only if we use rsync 978 #IGCM_sys_TestDirArchive $( dirname $2 ) 979 # 980 #USUAL WAY 981 \cp -r $1 $2 > out_rsync 2>&1 982 RET=$? 983 984 if [ ${RET} -gt 0 ] ; then 985 echo "IGCM_sys_Put_Dir : error." 986 cat out_rsync 987 IGCM_debug_Exit "IGCM_sys_Put_Dir" 906 988 else 907 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 908 fi 909 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 989 \rm out_rsync 990 fi 991 else 992 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 993 fi 994 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 910 995 } 911 996 912 997 #D-#================================================== 913 998 #D-function IGCM_sys_Get_Dir 914 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)999 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 915 1000 #D-* Examples: 916 1001 #D- 917 1002 function IGCM_sys_Get_Dir { 918 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 919 if ( $DEBUG_sys ) ; then 920 echo "IGCM_sys_Get_Dir :" $@ 921 fi 922 if [ $DRYRUN = 0 ]; then 923 # if [ ! -d ${1} ] ; then 924 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 925 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 926 # return 927 # fi 928 929 typeset RET 930 931 # Only if we use rsync 932 #IGCM_sys_TestDirArchive $( dirname $2 ) 933 # 934 #USUAL WAY 935 # add dmget (to demigrate all offline files) to reduce time of this command : 936 dmget $1/* 937 \cp -r $1 $2 > out_rsync 2>&1 938 RET=$? 939 940 if [ ${RET} -gt 0 ] ; then 941 echo "IGCM_sys_Get_Dir : error." 942 cat out_rsync 943 IGCM_debug_Exit "IGCM_sys_Get_Dir" 944 else 945 \rm out_rsync 946 fi 1003 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 1004 if ( $DEBUG_sys ) ; then 1005 echo "IGCM_sys_Get_Dir :" $@ 1006 fi 1007 if [ $DRYRUN = 0 ]; then 1008 # if [ ! -d ${1} ] ; then 1009 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 1010 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 1011 # return 1012 # fi 1013 1014 typeset RET 1015 1016 # Only if we use rsync 1017 #IGCM_sys_TestDirArchive $( dirname $2 ) 1018 # 1019 # USUAL WAY 1020 # add dmfind/dmget (to demigrate all offline files) : 1021 dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 1022 \cp -r $1 $2 > out_rsync 2>&1 1023 RET=$? 1024 1025 if [ ${RET} -gt 0 ] ; then 1026 echo "IGCM_sys_Get_Dir : error." 1027 cat out_rsync 1028 IGCM_debug_Exit "IGCM_sys_Get_Dir" 947 1029 else 948 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 949 fi 950 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 1030 \rm out_rsync 1031 fi 1032 else 1033 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1034 fi 1035 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 951 1036 } 952 1037 … … 957 1042 #D- 958 1043 function IGCM_sys_Get_Master { 959 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 960 if ( $DEBUG_sys ) ; then 961 echo "IGCM_sys_Get_Master :" $@ 962 fi 963 if [ $DRYRUN = 0 ]; then 964 if [ ! -d ${1} ] ; then 965 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 966 IGCM_debug_PopStack "IGCM_sys_Get_Master" 967 return 968 fi 969 970 typeset RET 971 972 #USUAL WAY 973 \cp -r $1 $2 > out_rsync 2>&1 974 RET=$? 975 976 if [ ${RET} -gt 0 ] ; then 977 echo "IGCM_sys_Get_Master : error." 978 cat out_rsync 979 IGCM_debug_Exit "IGCM_sys_Get_Master" 980 fi 1044 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 1045 if ( $DEBUG_sys ) ; then 1046 echo "IGCM_sys_Get_Master :" $@ 1047 fi 1048 if [ $DRYRUN = 0 ]; then 1049 if [ ! -d ${1} ] ; then 1050 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 1051 IGCM_debug_PopStack "IGCM_sys_Get_Master" 1052 return 1053 fi 1054 1055 typeset RET 1056 1057 #USUAL WAY 1058 \cp -r $1 $2 > out_rsync 2>&1 1059 RET=$? 1060 1061 if [ ${RET} -gt 0 ] ; then 1062 echo "IGCM_sys_Get_Master : error." 1063 cat out_rsync 1064 IGCM_debug_Exit "IGCM_sys_Get_Master" 981 1065 else 982 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 983 fi 984 IGCM_debug_PopStack "IGCM_sys_Get_Master" 1066 \rm out_rsync 1067 fi 1068 else 1069 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1070 fi 1071 IGCM_debug_PopStack "IGCM_sys_Get_Master" 985 1072 } 986 1073 987 1074 #D-#================================================== 988 1075 #D-function IGCM_sys_Put_Rest 989 #D-* Purpose: Put computied restarts on $ (ARCHIVE).1076 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 990 1077 #D- File and target directory must exist. 991 1078 #D-* Examples: 992 1079 #D- 993 1080 function IGCM_sys_Put_Rest { 994 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 995 if ( $DEBUG_sys ) ; then 996 echo "IGCM_sys_Put_Rest :" $@ 997 fi 998 if [ $DRYRUN = 0 ]; then 999 if [ ! -f ${1} ] ; then 1000 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 1001 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1002 fi 1003 1004 typeset RET 1005 # 1006 if [ X${JobType} = XRUN ] ; then 1007 IGCM_sys_Chmod 444 ${1} 1008 fi 1009 # 1010 IGCM_sys_TestDirArchive $( dirname $2 ) 1011 # 1012 # USUAL WAY 1013 \cp $1 $2 > out_rsync 2>&1 1014 RET=$? 1081 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 1082 if ( $DEBUG_sys ) ; then 1083 echo "IGCM_sys_Put_Rest :" $@ 1084 fi 1085 if [ $DRYRUN = 0 ]; then 1086 if [ ! -f ${1} ] ; then 1087 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 1088 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1089 fi 1090 1091 typeset RET 1092 # 1093 if [ X${JobType} = XRUN ] ; then 1094 IGCM_sys_Chmod 444 ${1} 1095 fi 1096 1097 # 1098 # USUAL WAY 1099 \cp $1 $2 > out_rsync 2>&1 1100 RET=$? 1015 1101 1016 1102 # #RSYNC WITH NETWORK SSH CALL … … 1028 1114 # (( RET=RET+$? )) 1029 1115 1030 if [ ${RET} -gt 0 ] ; then 1031 echo "IGCM_sys_Put_Rest : error." 1032 cat out_rsync 1033 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1034 else 1035 \rm out_rsync 1036 fi 1116 if [ ${RET} -gt 0 ] ; then 1117 echo "IGCM_sys_Put_Rest : error." 1118 cat out_rsync 1119 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1037 1120 else 1038 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1039 fi 1040 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1121 \rm out_rsync 1122 fi 1123 else 1124 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1125 fi 1126 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1127 } 1128 1129 #D-#================================================== 1130 #D-function IGCM_sys_PutBuffer_Rest 1131 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 1132 #D- File and target directory must exist. 1133 #D-* Examples: 1134 #D- 1135 function IGCM_sys_PutBuffer_Rest { 1136 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 1137 if ( $DEBUG_sys ) ; then 1138 echo "IGCM_sys_PutBuffer_Rest :" $@ 1139 fi 1140 if [ $DRYRUN = 0 ]; then 1141 if [ ! -f ${1} ] ; then 1142 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 1143 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1144 fi 1145 1146 typeset RET 1147 # 1148 if [ X${JobType} = XRUN ] ; then 1149 IGCM_sys_Chmod 444 ${1} 1150 fi 1151 1152 # 1153 # USUAL WAY 1154 \cp $1 $2 > out_rsync 2>&1 1155 RET=$? 1156 1157 if [ ${RET} -gt 0 ] ; then 1158 echo "IGCM_sys_PutBuffer_Rest : error." 1159 cat out_rsync 1160 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1161 else 1162 \rm out_rsync 1163 fi 1164 else 1165 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1166 fi 1167 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 1041 1168 } 1042 1169 1043 1170 #D-#================================================== 1044 1171 #D-function IGCM_sys_Put_Out 1045 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1172 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 1046 1173 #D-* Examples: 1047 1174 #D- 1048 1175 function IGCM_sys_Put_Out { 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1176 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1177 if ( $DEBUG_sys ) ; then 1178 echo "IGCM_sys_Put_Out :" $@ 1179 fi 1180 if [ $DRYRUN = 0 ]; then 1181 if [ ! -f ${1} ] ; then 1182 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1183 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1184 return 1 1185 fi 1186 # 1187 IGCM_sys_MkdirArchive $( dirname $2 ) 1188 # 1189 typeset RET 1190 1191 #===================================================== 1192 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1193 #===================================================== 1194 1195 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 1196 #if [ $? -eq 0 ] ; then 1197 # typeset WORKPATH FILEPATH 1198 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1199 # IGCM_sys_MkdirWork ${WORKPATH} 1200 # FILEPATH=${WORKPATH}/$( basename $2 ) 1201 # # 1202 # IGCM_sys_Cp ${1} ${FILEPATH} 1203 #fi 1204 1205 if [ X${JobType} = XRUN ] ; then 1206 if [ X${3} = X ] ; then 1207 IGCM_sys_Chmod 444 ${1} 1208 fi 1209 fi 1210 # 1211 # USUAL WAY 1212 \cp $1 $2 > out_rsync 2>&1 1213 RET=$? 1087 1214 1088 1215 # #RSYNC WITH NETWORK SSH CALL … … 1100 1227 # (( RET=RET+$? )) 1101 1228 1102 if [ ${RET} -gt 0 ] ; then 1103 echo "IGCM_sys_Put_Out : error." 1104 cat out_rsync 1105 IGCM_debug_Exit "IGCM_sys_Put_Out" 1106 else 1107 \rm out_rsync 1108 fi 1229 if [ ${RET} -gt 0 ] ; then 1230 echo "IGCM_sys_Put_Out : error." 1231 cat out_rsync 1232 IGCM_debug_Exit "IGCM_sys_Put_Out" 1109 1233 else 1110 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1111 fi 1112 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1113 return 0 1234 \rm out_rsync 1235 fi 1236 else 1237 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1238 fi 1239 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1240 return 0 1241 } 1242 1243 #D-#================================================== 1244 #D-function IGCM_sys_PutBuffer_Out 1245 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1246 #D-* Examples: 1247 #D- 1248 function IGCM_sys_PutBuffer_Out { 1249 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1250 if ( $DEBUG_sys ) ; then 1251 echo "IGCM_sys_PutBuffer_Out :" $@ 1252 fi 1253 if [ $DRYRUN = 0 ]; then 1254 if [ ! -f ${1} ] ; then 1255 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1256 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1257 return 1 1258 fi 1259 # 1260 IGCM_sys_Mkdir $( dirname $2 ) 1261 # 1262 typeset RET 1263 1264 if [ X${JobType} = XRUN ] ; then 1265 if [ X${3} = X ] ; then 1266 IGCM_sys_Chmod 444 ${1} 1267 fi 1268 fi 1269 # 1270 # USUAL WAY 1271 \cp $1 $2 > out_rsync 2>&1 1272 RET=$? 1273 1274 if [ ${RET} -gt 0 ] ; then 1275 echo "IGCM_sys_PutBuffer_Out : error." 1276 cat out_rsync 1277 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1278 else 1279 \rm out_rsync 1280 fi 1281 else 1282 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1283 fi 1284 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1285 return 0 1114 1286 } 1115 1287 … … 1120 1292 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1121 1293 function IGCM_sys_Get { 1122 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1123 1124 typeset DEST RET dm_liste ifile target file_work 1125 1126 if ( $DEBUG_sys ) ; then 1127 echo "IGCM_sys_Get :" $@ 1128 fi 1129 if [ $DRYRUN -le 2 ]; then 1130 if [ X${1} = X'/l' ] ; then 1131 # test if the first file is present in the old computation : 1132 eval set +A dm_liste \${${2}} 1133 else 1134 eval set +A dm_liste ${1} 1135 fi 1136 eval DEST=\${${#}} 1137 1138 #===================================================== 1139 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1140 #===================================================== 1141 1142 # Is it an R_OUT file (not R_IN) ? 1143 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1144 #if [ $? -eq 0 ] ; then 1145 # # Yes ? then we try to get it in SCRATCHDIR 1146 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" ) 1147 # if [ -f ${file_work[0]} ] ; then 1148 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1149 # IGCM_debug_PopStack "IGCM_sys_Get" 1150 # return 1151 # fi 1152 #fi 1153 1154 # test if the (first) file is present in the old computation : 1155 IGCM_sys_TestFileArchive ${dm_liste[0]} 1156 RET=$? 1157 if [ ${RET} -gt 0 ] ; then 1158 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1159 IGCM_debug_Exit "IGCM_sys_Get" 1160 fi 1161 1162 dmget ${dm_liste[*]} > out_rsync 2>&1 1163 RET=$? 1164 1165 if [ ${RET} -gt 0 ] ; then 1166 echo "WARNING IGCM_sys_Get : demigration error." 1167 cat out_rsync 1168 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1169 fi 1170 1171 #if [ ${RET} -gt 0 ] ; then 1172 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1173 # cat out_rsync 1174 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1175 # sleep 30 1176 # echo "We try another time" 1177 # dmget ${dm_liste[*]} > out_rsync 2>&1 1178 # RET=$? 1179 # if [ ${RET} -gt 0 ] ; then 1180 # echo "ERROR IGCM_sys_Get : again demigration error :" 1181 # cat out_rsync 1182 # IGCM_debug_Exit "IGCM_sys_Get" 1183 # fi 1184 # else 1185 # echo "ERROR IGCM_sys_Get : demigration error :" 1186 # cat out_rsync 1187 # IGCM_debug_Exit "IGCM_sys_Get" 1188 # fi 1189 #fi 1190 1191 #USUAL WAY 1192 if [ X${1} = X'/l' ] ; then 1193 (( RET=0 )) 1194 for target in ${dm_liste[*]} ; do 1195 local_file=$( basename ${target} ) 1196 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1197 (( RET = RET + $? )) 1198 done 1199 else 1200 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1201 RET=$? 1202 fi 1294 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1295 1296 typeset DEST RET dm_liste ifile target file_work 1297 1298 if ( $DEBUG_sys ) ; then 1299 echo "IGCM_sys_Get :" $@ 1300 fi 1301 if [ $DRYRUN -le 2 ]; then 1302 if [ X${1} = X'/l' ] ; then 1303 # test if the first file is present in the old computation : 1304 eval set +A dm_liste \${${2}} 1305 else 1306 eval set +A dm_liste ${1} 1307 fi 1308 eval DEST=\${${#}} 1309 1310 #===================================================== 1311 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1312 #===================================================== 1313 1314 # Is it an R_OUT file (not R_IN) ? 1315 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1316 #if [ $? -eq 0 ] ; then 1317 # # Yes ? then we try to get it in SCRATCHDIR 1318 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1319 # if [ -f ${file_work[0]} ] ; then 1320 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1321 # IGCM_debug_PopStack "IGCM_sys_Get" 1322 # return 1323 # fi 1324 #fi 1325 1326 # test if the (first) file is present in the old computation : 1327 IGCM_sys_TestFileArchive ${dm_liste[0]} 1328 RET=$? 1329 if [ ${RET} -gt 0 ] ; then 1330 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1331 IGCM_debug_Exit "IGCM_sys_Get" 1332 fi 1333 1334 dmget ${dm_liste[*]} > out_rsync 2>&1 1335 RET=$? 1336 if [ ${RET} -gt 0 ] ; then 1337 echo "WARNING IGCM_sys_Get : demigration error." 1338 cat out_rsync 1339 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1340 fi 1341 1342 #if [ ${RET} -gt 0 ] ; then 1343 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1344 # cat out_rsync 1345 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1346 # sleep 30 1347 # echo "We try another time" 1348 # dmget ${dm_liste[*]} > out_rsync 2>&1 1349 # RET=$? 1350 # if [ ${RET} -gt 0 ] ; then 1351 # echo "ERROR IGCM_sys_Get : again demigration error :" 1352 # cat out_rsync 1353 # IGCM_debug_Exit "IGCM_sys_Get" 1354 # fi 1355 # else 1356 # echo "ERROR IGCM_sys_Get : demigration error :" 1357 # cat out_rsync 1358 # IGCM_debug_Exit "IGCM_sys_Get" 1359 # fi 1360 #fi 1361 1362 #USUAL WAY 1363 if [ X${1} = X'/l' ] ; then 1364 (( RET=0 )) 1365 for target in ${dm_liste[*]} ; do 1366 local_file=$( basename ${target} ) 1367 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1368 (( RET = RET + $? )) 1369 done 1370 else 1371 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1372 RET=$? 1373 fi 1203 1374 1204 1375 # #RSYNC WITH NETWORK SSH CALL … … 1216 1387 # (( RET=RET+$? )) 1217 1388 1218 if [ ${RET} -gt 0 ] ; then 1219 echo "IGCM_sys_Get : copy error." 1220 cat out_rsync 1221 IGCM_debug_Exit "IGCM_sys_Get" 1222 else 1223 \rm out_rsync 1224 fi 1389 if [ ${RET} -gt 0 ] ; then 1390 echo "IGCM_sys_Get : copy error." 1391 cat out_rsync 1392 IGCM_debug_Exit "IGCM_sys_Get" 1225 1393 else 1226 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1227 fi 1228 IGCM_debug_PopStack "IGCM_sys_Get" 1394 \rm out_rsync 1395 fi 1396 else 1397 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1398 fi 1399 IGCM_debug_PopStack "IGCM_sys_Get" 1400 } 1401 1402 #D-#================================================== 1403 #D-function IGCM_sys_GetBuffer 1404 #D-* Purpose: Get a file from ${SCRATCHDIR} 1405 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1406 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1407 function IGCM_sys_GetBuffer { 1408 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1409 1410 typeset DEST RET buf_liste ifile target file_work 1411 1412 if ( $DEBUG_sys ) ; then 1413 echo "IGCM_sys_GetBuffer :" $@ 1414 fi 1415 if [ $DRYRUN -le 2 ]; then 1416 if [ X${1} = X'/l' ] ; then 1417 # test if the first file is present in the old computation : 1418 eval set +A buf_liste \${${2}} 1419 else 1420 eval set +A buf_liste ${1} 1421 fi 1422 eval DEST=\${${#}} 1423 1424 #USUAL WAY 1425 if [ X${1} = X'/l' ] ; then 1426 (( RET=0 )) 1427 for target in ${buf_liste[*]} ; do 1428 local_file=$( basename ${target} ) 1429 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1430 (( RET = RET + $? )) 1431 done 1432 else 1433 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1434 RET=$? 1435 fi 1436 1437 if [ ${RET} -gt 0 ] ; then 1438 echo "IGCM_sys_GetBuffer : copy error." 1439 cat out_rsync 1440 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1441 else 1442 \rm out_rsync 1443 fi 1444 else 1445 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1446 fi 1447 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1229 1448 } 1230 1449 … … 1235 1454 #D- 1236 1455 function IGCM_sys_GetDate_FichWork { 1237 1238 1239 1240 1241 1242 1243 1456 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1457 if ( $DEBUG_sys ) ; then 1458 echo "IGCM_sys_GetDate_FichWork :" $@ 1459 fi 1460 typeset dateF 1461 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1462 eval ${2}=${dateF[5]} 1244 1463 1245 1464 # donne la date filesys d'un fichier sur la machine work 1246 1465 IGCM_debug_PopStack "IGCM_sys_FichWork" 1247 1466 } 1248 1467 … … 1253 1472 #D- 1254 1473 function IGCM_sys_GetDate_FichArchive { 1255 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1256 if ( $DEBUG_sys ) ; then 1257 echo "IGCM_sys_GetDate_FichArchive :" $@ 1258 fi 1259 typeset dateF 1260 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1261 eval ${2}=${dateF[5]} 1262 1263 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1474 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1475 if ( $DEBUG_sys ) ; then 1476 echo "IGCM_sys_GetDate_FichArchive :" $@ 1477 fi 1478 typeset dateF 1479 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1480 eval ${2}=${dateF[5]} 1481 1482 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1483 } 1484 1485 #D-#================================================== 1486 #D-function IGCM_sys_Dods_Rm 1487 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1488 #D-* Examples: 1489 #D- 1490 function IGCM_sys_Dods_Rm { 1491 if ( $DEBUG_sys ) ; then 1492 echo "IGCM_sys_Dods_Rm :" $@ 1493 fi 1494 typeset RET 1495 RET=0 1496 if [ $DRYRUN = 0 ]; then 1497 if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then 1498 echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." 1499 echo "Nothing has been done." 1500 return 1501 fi 1502 dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1503 RET=$? 1504 1505 # if [ ${RET} -gt 0 ] ; then 1506 # echo "IGCM_sys_Dods_Rm : error." 1507 # cat out_dods_rm 1508 # IGCM_debug_Exit "IGCM_sys_Dods_Rm" 1509 # else 1510 # rm out_dods_rm 1511 # fi 1512 1513 else 1514 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1515 fi 1516 return $RET 1517 } 1518 1519 #D-#================================================== 1520 #D-function IGCM_sys_Dods_Cp 1521 #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 1522 #D-* Examples: 1523 #D- 1524 function IGCM_sys_Dods_Cp { 1525 if ( $DEBUG_sys ) ; then 1526 echo "IGCM_sys_Dods_Cp :" $@ 1527 fi 1528 typeset RET 1529 RET=0 1530 if [ $DRYRUN = 0 ]; then 1531 if [ ! -d ${R_SAVE}/${1} ] ; then 1532 echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." 1533 echo "Nothing has been done." 1534 return 1535 fi 1536 # 1537 dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1538 RET=$? 1539 1540 # if [ ${RET} -gt 0 ] ; then 1541 # echo "IGCM_sys_Dods_Cp : error." 1542 # cat out_dods_cp 1543 # IGCM_debug_Exit "IGCM_sys_Dods_Cp" 1544 # else 1545 # rm out_dods_cp 1546 # fi 1547 1548 else 1549 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1550 fi 1551 return $RET 1552 } 1553 1554 #D-#================================================== 1555 #D-function IGCM_sys_Put_Dods 1556 #D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 1557 #D-* Examples: 1558 #D- 1559 function IGCM_sys_Put_Dods { 1560 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1561 if ( $DEBUG_sys ) ; then 1562 echo "IGCM_sys_Put_Dods :" $@ 1563 fi 1564 if [ $DRYRUN = 0 ]; then 1565 if [ ! -d ${R_SAVE}/${1} ] ; then 1566 echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." 1567 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1568 return 1569 fi 1570 1571 typeset RET 1572 # 1573 cd ${R_SAVE} 1574 IGCM_sys_Dods_Rm ${1} 1575 IGCM_sys_Dods_Cp ${1} 1576 RET=0 1577 1578 if [ ${RET} -gt 0 ] ; then 1579 echo "IGCM_sys_Put_Dods : error." 1580 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1581 fi 1582 else 1583 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1584 fi 1585 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1264 1586 } 1265 1587 … … 1268 1590 1269 1591 function IGCM_sys_rebuild { 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1592 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1593 if ( $DEBUG_sys ) ; then 1594 echo "IGCM_sys_rebuild :" $@ 1595 fi 1596 /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ 1597 if [ $? -gt 0 ] ; then 1598 echo "IGCM_sys_rebuild : erreur ${@}." 1599 IGCM_debug_Exit "rebuild" 1600 fi 1601 1602 IGCM_debug_PopStack "IGCM_sys_rebuild" 1281 1603 } 1282 1604 … … 1285 1607 1286 1608 function IGCM_sys_activ_variables { 1287 1288 1289 1290 1291 1292 1609 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1610 if ( $DEBUG_sys ) ; then 1611 echo "IGCM_sys_activ_variables" 1612 fi 1613 ulimit -s 2097152 1614 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1293 1615 } 1294 1616 … … 1297 1619 1298 1620 function IGCM_sys_desactiv_variables { 1299 1300 1301 1302 1303 1621 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1622 if ( $DEBUG_sys ) ; then 1623 echo "IGCM_sys_desactiv_variables" 1624 fi 1625 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1304 1626 } 1305 1627 … … 1308 1630 1309 1631 function IGCM_sys_build_run_file { 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1632 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1633 if ( $DEBUG_sys ) ; then 1634 echo "IGCM_sys_build_run_file " $@ 1635 fi 1636 1637 # set Number of processors for OCE here 1638 NUM_PROC_OCE=5 1639 1640 (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE - 1)) 1641 (( nb_tot_m1 = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE )) 1642 if [ $1 = MPI1 ]; then 1643 cat <<EOF > run_file 1322 1644 -np 1 ./oasis 1323 1645 -np ${NUM_PROC_ATM} ./lmdz.x 1324 1646 -np ${NUM_PROC_OCE} ./opa.xx 1325 1647 EOF 1326 1327 1328 1329 1648 config_UserChoices_JobRunOptions='"--app"' 1649 IGCM_sys_Chmod u+x run_file 1650 fi 1651 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1330 1652 1331 1653 } … … 1334 1656 # NCO OPERATOR 1335 1657 1658 function IGCM_sys_ncap2 { 1659 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1660 if ( $DEBUG_sys ) ; then 1661 echo "IGCM_sys_ncap2 :" $@ 1662 fi 1663 ncap2 "$@" 1664 if [ $? -gt 0 ] ; then 1665 echo "IGCM_sys_ncap2 : erreur ${@}." 1666 IGCM_debug_Exit "ncap2" 1667 fi 1668 1669 IGCM_debug_PopStack "IGCM_sys_ncap2" 1670 } 1671 1336 1672 function IGCM_sys_ncatted { 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1673 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1674 if ( $DEBUG_sys ) ; then 1675 echo "IGCM_sys_ncatted :" $@ 1676 fi 1677 ncatted "$@" 1678 if [ $? -gt 0 ] ; then 1679 echo "IGCM_sys_ncatted : erreur ${@}." 1680 IGCM_debug_Exit "ncatted" 1681 fi 1682 1683 IGCM_debug_PopStack "IGCM_sys_ncatted" 1348 1684 } 1349 1685 1350 1686 function IGCM_sys_ncbo { 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1687 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1688 if ( $DEBUG_sys ) ; then 1689 echo "IGCM_sys_ncbo :" $@ 1690 fi 1691 ncbo $@ 1692 if [ $? -gt 0 ] ; then 1693 echo "IGCM_sys_ncbo : erreur ${@}." 1694 IGCM_debug_Exit "ncbo" 1695 fi 1696 1697 IGCM_debug_PopStack "IGCM_sys_ncbo" 1362 1698 } 1363 1699 1364 1700 function IGCM_sys_ncdiff { 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1701 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1702 if ( $DEBUG_sys ) ; then 1703 echo "IGCM_sys_ncdiff :" $@ 1704 fi 1705 ncdiff $@ 1706 if [ $? -gt 0 ] ; then 1707 echo "IGCM_sys_ncdiff : erreur ${@}." 1708 IGCM_debug_Exit "ncdiff" 1709 fi 1710 1711 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1376 1712 } 1377 1713 1378 1714 function IGCM_sys_ncea { 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1715 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1716 if ( $DEBUG_sys ) ; then 1717 echo "IGCM_sys_ncea :" $@ 1718 fi 1719 ncea $@ 1720 if [ $? -gt 0 ] ; then 1721 echo "IGCM_sys_ncea : erreur ${@}." 1722 IGCM_debug_Exit "ncea" 1723 fi 1724 1725 IGCM_debug_PopStack "IGCM_sys_ncea" 1390 1726 } 1391 1727 1392 1728 function IGCM_sys_ncecat { 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1729 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1730 if ( $DEBUG_sys ) ; then 1731 echo "IGCM_sys_ncecat :" $@ 1732 fi 1733 ncecat $@ 1734 if [ $? -gt 0 ] ; then 1735 echo "IGCM_sys_ncecat : erreur ${@}." 1736 IGCM_debug_Exit "ncecat" 1737 fi 1738 1739 IGCM_debug_PopStack "IGCM_sys_ncecat" 1404 1740 } 1405 1741 1406 1742 function IGCM_sys_ncflint { 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1743 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1744 if ( $DEBUG_sys ) ; then 1745 echo "IGCM_sys_ncflint :" $@ 1746 fi 1747 ncflint $@ 1748 if [ $? -gt 0 ] ; then 1749 echo "IGCM_sys_ncflint : erreur ${@}." 1750 IGCM_debug_Exit "ncflint" 1751 fi 1752 1753 IGCM_debug_PopStack "IGCM_sys_ncflint" 1418 1754 } 1419 1755 1420 1756 function IGCM_sys_ncks { 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1757 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1758 if ( $DEBUG_sys ) ; then 1759 echo "IGCM_sys_ncks :" $@ 1760 fi 1761 ncks $@ 1762 if [ $? -gt 0 ] ; then 1763 echo "IGCM_sys_ncks : erreur ${@}." 1764 IGCM_debug_Exit "ncks" 1765 fi 1766 1767 IGCM_debug_PopStack "IGCM_sys_ncks" 1432 1768 } 1433 1769 1434 1770 function IGCM_sys_ncpdq { 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1771 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1772 if ( $DEBUG_sys ) ; then 1773 echo "IGCM_sys_ncpdq :" $@ 1774 fi 1775 ncpdq $@ 1776 if [ $? -gt 0 ] ; then 1777 echo "IGCM_sys_ncpdq : erreur ${@}." 1778 IGCM_debug_Exit "ncpdq" 1779 fi 1780 1781 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1446 1782 } 1447 1783 1448 1784 function IGCM_sys_ncra { 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1785 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1786 if ( $DEBUG_sys ) ; then 1787 echo "IGCM_sys_ncra :" $@ 1788 fi 1789 ncra $@ 1790 if [ $? -gt 0 ] ; then 1791 echo "IGCM_sys_ncra : erreur ${@}." 1792 IGCM_debug_Exit "ncra" 1793 fi 1794 1795 IGCM_debug_PopStack "IGCM_sys_ncra" 1460 1796 } 1461 1797 1462 1798 function IGCM_sys_ncrcat { 1463 1464 1465 1466 1467 1468 1469 1799 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1800 if ( $DEBUG_sys ) ; then 1801 echo "IGCM_sys_ncrcat :" $@ 1802 fi 1803 ncrcat $@ 1804 if [ $? -gt 0 ] ; then 1805 echo "IGCM_sys_ncrcat : erreur ${@}." 1470 1806 # IGCM_debug_Exit "ncrcat" 1471 1472 1473 1807 fi 1808 1809 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1474 1810 } 1475 1811 1476 1812 function IGCM_sys_ncrename { 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1813 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1814 if ( $DEBUG_sys ) ; then 1815 echo "IGCM_sys_ncrename :" $@ 1816 fi 1817 ncrename $@ 1818 if [ $? -gt 0 ] ; then 1819 echo "IGCM_sys_ncrename : erreur ${@}." 1820 IGCM_debug_Exit "ncrename" 1821 fi 1822 1823 IGCM_debug_PopStack "IGCM_sys_ncrename" 1488 1824 } 1489 1825 1490 1826 function IGCM_sys_ncwa { 1491 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1492 if ( $DEBUG_sys ) ; then 1493 echo "IGCM_sys_ncwa :" $@ 1494 fi 1495 ncwa $@ 1496 if [ $? -gt 0 ] ; then 1497 echo "IGCM_sys_ncwa : erreur ${@}." 1498 IGCM_debug_Exit "ncwa" 1499 fi 1500 1501 IGCM_debug_PopStack "IGCM_sys_ncwa" 1502 } 1827 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1828 if ( $DEBUG_sys ) ; then 1829 echo "IGCM_sys_ncwa :" $@ 1830 fi 1831 ncwa $@ 1832 if [ $? -gt 0 ] ; then 1833 echo "IGCM_sys_ncwa : erreur ${@}." 1834 IGCM_debug_Exit "ncwa" 1835 fi 1836 1837 IGCM_debug_PopStack "IGCM_sys_ncwa" 1838 } 1839 1840 ############################################################## 1841 # CDO OPERATOR 1842 1843 function IGCM_sys_cdo { 1844 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1845 if ( $DEBUG_sys ) ; then 1846 echo "IGCM_sys_cdo :" $@ 1847 fi 1848 \cdo $@ 1849 if [ $? -gt 0 ] ; then 1850 echo "IGCM_sys_cdo : erreur ${@}." 1851 IGCM_debug_PopStack "IGCM_sys_cdo" 1852 return 1 1853 else 1854 IGCM_debug_PopStack "IGCM_sys_cdo" 1855 return 0 1856 fi 1857 1858 IGCM_debug_PopStack "IGCM_sys_cdo" 1859 }
Note: See TracChangeset
for help on using the changeset viewer.