Changeset 1181 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh
- Timestamp:
- 04/01/15 14:54:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh
r1180 r1181 219 219 220 220 #D-#================================================== 221 #D-function IGCM_sys_RshMaster222 #D-* Purpose: Connection to frontend machine.223 #D-* Examples:224 #D-225 function IGCM_sys_RshMaster {226 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@227 OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF228 export libIGCM=${libIGCM}229 export DEBUG_debug=${DEBUG_debug}230 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh231 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh232 ${@}233 EOF234 if [ $? -gt 0 ] ; then235 echo "IGCM_sys_RshMaster : erreur."236 IGCM_debug_Exit "IGCM_sys_RshMaster"237 fi238 IGCM_debug_PopStack "IGCM_sys_RshMaster"239 }240 241 #D-#==================================================242 221 #D-function IGCM_sys_RshArchive 243 222 #D-* Purpose: Archive rsh command … … 287 266 288 267 #D-#================================================== 289 #D-function IGCM_sys_RshPost290 #D-* Purpose: Post-process rsh command291 #D-* Examples:292 #D-293 function IGCM_sys_RshPost {294 IGCM_debug_PushStack "IGCM_sys_RshPost" $@295 if ( $DEBUG_sys ) ; then296 echo "IGCM_sys_RshPost :" $@297 fi298 # keep standard input (stdin) for the loop onto temporary file299 cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}300 301 OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}302 if [ $? -gt 0 ] ; then303 echo "IGCM_sys_RshPost : erreur."304 IGCM_debug_Exit "IGCM_sys_RshPost"305 fi306 # delete temporary file307 \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}308 309 IGCM_debug_PopStack "IGCM_sys_RshPost"310 }311 312 #D-#==================================================313 #D-function IGCM_sys_SendMail314 #D-* Purpose: Send mail when simulation is over315 #D-* Examples:316 #D-317 function IGCM_sys_SendMail {318 IGCM_debug_PushStack "IGCM_sys_SendMail" $@319 if ( $DEBUG_sys ) ; then320 echo "IGCM_sys_SendMail :" $@321 fi322 323 if [ X${1} = XAccounting ] ; then324 status=Accounting325 mailText=jobAccounting.mail326 elif ( ${ExitFlag} ) ; then327 status=failed328 mailText=jobEnd.mail329 else330 status=completed331 mailText=jobEnd.mail332 fi333 334 # Update selected mail template335 while read -r line; do336 eval echo $line >> mail.txt ;337 done < ${libIGCM}/libIGCM_sys/${mailText}338 339 if [ ! -z ${config_UserChoices_MailName} ] ; then340 mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt341 elif [ -f ~/.forward ] ; then342 mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt343 else344 mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt345 fi346 347 sleep 10348 rm -f mail.txt349 350 IGCM_debug_PopStack "IGCM_sys_SendMail"351 }352 353 #D-#==================================================354 #D-function IGCM_sys_Mkdir355 #D-* Purpose: Master locale mkdir command356 #D-* Examples:357 #D-358 function IGCM_sys_Mkdir {359 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@360 if ( $DEBUG_sys ) ; then361 echo "IGCM_sys_Mkdir :" $@362 fi363 if [ ! -d ${1} ]; then364 \mkdir -p $1365 if [ $? -gt 0 ] ; then366 echo "IGCM_sys_Mkdir : erreur."367 IGCM_debug_Exit "IGCM_sys_Mkdir"368 fi369 fi370 # vérification :371 if [ ! -d ${1} ] ; then372 echo "IGCM_sys_Mkdir : erreur."373 IGCM_debug_Exit "IGCM_sys_Mkdir"374 fi375 IGCM_debug_PopStack "IGCM_sys_Mkdir"376 }377 378 #D-#==================================================379 268 #D-function IGCM_sys_MkdirArchive 380 269 #D-* Purpose: Mkdir on Archive … … 404 293 405 294 #D-#================================================== 406 #D-function IGCM_sys_MkdirWork407 #D-* Purpose: Mkdir on Work408 #D-* Examples:409 #D-410 function IGCM_sys_MkdirWork {411 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@412 if ( $DEBUG_sys ) ; then413 echo "IGCM_sys_MkdirWork :" $@414 fi415 #- creation de repertoire sur le serveur fichier416 if [ ! -d ${1} ]; then417 \mkdir -p $1418 if [ $? -gt 0 ] ; then419 echo "IGCM_sys_MkdirWork : erreur."420 IGCM_debug_Exit "IGCM_sys_MkdirWork"421 fi422 fi423 IGCM_debug_PopStack "IGCM_sys_MkdirWork"424 }425 426 #D-#==================================================427 #D-function IGCM_sys_Cd428 #D-* Purpose: master cd command429 #D-* Examples:430 #D-431 function IGCM_sys_Cd {432 IGCM_debug_PushStack "IGCM_sys_Cd" $@433 if ( $DEBUG_sys ) ; then434 echo "IGCM_sys_Cd :" $@435 fi436 \cd $1437 if [ $? -gt 0 ] ; then438 echo "IGCM_sys_Cd : erreur."439 IGCM_debug_Exit "IGCM_sys_Cd"440 fi441 IGCM_debug_PopStack "IGCM_sys_Cd"442 }443 444 #D-#==================================================445 #D-function IGCM_sys_Chmod446 #D-* Purpose: Chmod447 #D-* Examples:448 #D-449 function IGCM_sys_Chmod {450 IGCM_debug_PushStack "IGCM_sys_Chmod" $@451 if ( $DEBUG_sys ) ; then452 echo "IGCM_sys_Chmod :" $@453 fi454 \chmod $@455 if [ $? -gt 0 ] ; then456 echo "IGCM_sys_Chmod : erreur."457 IGCM_debug_Exit "IGCM_sys_Chmod"458 fi459 IGCM_debug_PopStack "IGCM_sys_Chmod"460 }461 462 #D-#==================================================463 #D-function IGCM_sys_FileSize464 #D-* Purpose: Filesize465 #D-* Examples:466 #D-467 function IGCM_sys_FileSize {468 IGCM_debug_PushStack "IGCM_sys_FileSize" $@469 470 typeset sizeF471 set +A sizeF -- $( ls -la ${1} )472 if [ $? -gt 0 ] ; then473 IGCM_debug_Exit "IGCM_sys_FileSize"474 fi475 eval ${2}=${sizeF[4]}476 477 IGCM_debug_PopStack "IGCM_sys_FileSize"478 }479 480 #D-#==================================================481 #D-function IGCM_sys_TestDir482 #D-* Purpose: Test Directory that must exists483 #D-* Examples:484 #D-485 function IGCM_sys_TestDir {486 IGCM_debug_PushStack "IGCM_sys_TestDir" $@487 if ( $DEBUG_sys ) ; then488 echo "IGCM_sys_TestDir :" $@489 fi490 typeset ExistFlag491 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )492 IGCM_debug_PopStack "IGCM_sys_TestDir"493 494 return ${ExistFlag}495 }496 497 #D-#==================================================498 295 #D-function IGCM_sys_TestDirArchive 499 296 #D-* Purpose: Test Directory that must exists on Archive … … 544 341 ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) 545 342 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 546 547 return ${ExistFlag}548 }549 550 #D-#==================================================551 #D-function IGCM_sys_TestFileBuffer552 #D-* Purpose: Test file that must NOT EXISTS on Buffer553 #D-* Examples:554 #D-555 function IGCM_sys_TestFileBuffer {556 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@557 typeset ExistFlag558 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )559 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"560 343 561 344 return ${ExistFlag} … … 585 368 586 369 #D-#================================================== 587 #D-function IGCM_sys_CountFileBuffer588 #D-* Purpose: Count files on Scratch filesystem589 #D-* Examples:590 #D-591 function IGCM_sys_CountFileBuffer {592 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@593 ls ${@} 2>/dev/null | wc -l594 if [ $? -gt 0 ] ; then595 echo "IGCM_sys_CountFileBuffer : erreur."596 fi597 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"598 }599 600 #D-#==================================================601 370 #D-function IGCM_sys_Tree 602 371 #D-* Purpose: Tree directories with files on ${ARCHIVE} … … 612 381 613 382 IGCM_debug_PopStack "IGCM_sys_Tree" 614 }615 616 #D-#==================================================617 #D-function IGCM_sys_Tar618 #D-* Purpose: master tar command619 #D-* Examples:620 #D-621 function IGCM_sys_Tar {622 IGCM_debug_PushStack "IGCM_sys_Tar" $@623 if ( $DEBUG_sys ) ; then624 echo "IGCM_sys_Tar :" $@625 fi626 \tar cf $@627 if [ $? -gt 0 ] ; then628 echo "IGCM_sys_Tar : erreur."629 IGCM_debug_Exit "IGCM_sys_Tar"630 fi631 IGCM_debug_PopStack "IGCM_sys_Tar"632 }633 634 #D-#==================================================635 #D-function IGCM_sys_UnTar636 #D-* Purpose: master un-tar command637 #D-* Examples:638 #D-639 function IGCM_sys_UnTar {640 IGCM_debug_PushStack "IGCM_sys_UnTar" $@641 if ( $DEBUG_sys ) ; then642 echo "IGCM_sys_UnTar :" $@643 fi644 \tar xvf $1645 if [ $? -gt 0 ] ; then646 echo "IGCM_sys_UnTar : erreur."647 IGCM_debug_Exit "IGCM_sys_UnTar"648 fi649 IGCM_debug_PopStack "IGCM_sys_UnTar"650 383 } 651 384 … … 720 453 721 454 #D-#================================================== 722 #D-function IGCM_sys_Rsync_out723 #D-* Purpose: treat return val of rsync724 #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync725 #D- Error values and explanations can depend on your system version.726 function IGCM_sys_Rsync_out {727 status=$1728 if [ ! $status ] ; then729 echo "rsync error !"730 fi731 732 if [ $MYLANG = "fr" ]; then733 case $status in734 0) return ;;735 1) echo "Erreur de rsync ; RERR_SYNTAX : "736 echo "Erreur de syntaxe ou d'utilisation."737 return;;738 2) echo "Erreur de rsync ; RERR_PROTOCOL : "739 echo "Incompatibilité de protocole."740 return;;741 3) echo "Erreur de rsync ; RERR_FILESELECT 3"742 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et"743 echo "répertoires"744 return;;745 4) echo "Erreur de rsync ; RERR_UNSUPPORTED"746 echo "Action demandée non supportée : une tentative de manipulation de"747 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a"748 echo "été faite ; ou une option qui est supportée par le client mais"749 echo "pas par le serveur a été spécifiée."750 return;;751 10) echo "Erreur de rsync ; RERR_SOCKETIO"752 echo "Erreur dans le socket d'entrée sortie"753 return;;754 11) echo "Erreur de rsync ; RERR_FILEIO"755 echo "Erreur d'entrée sortie fichier"756 return;;757 12) echo "Erreur de rsync ; RERR_STREAMIO"758 echo "Erreur dans flux de donnée du protocole rsync"759 return;;760 13) echo "Erreur de rsync ; RERR_MESSAGEIO"761 echo "Erreur avec les diagnostics du programme"762 return;;763 14) echo "Erreur de rsync ; RERR_IPC"764 echo "Erreur dans le code IPC"765 return;;766 20) echo "Erreur de rsync ; RERR_SIGNAL"767 echo "SIGUSR1 ou SIGINT reçu"768 return;;769 21) echo "Erreur de rsync ; RERR_WAITCHILD"770 echo "Une erreur retournée par waitpid()"771 return;;772 22) echo "Erreur de rsync ; RERR_MALLOC"773 echo "Erreur lors de l'allocation des tampons de mémoire de coeur"774 return;;775 23) echo ""776 echo "Erreur fichier inexistant"777 return;;778 30) echo "Erreur de rsync ; RERR_TIMEOUT"779 echo "Temps d'attente écoulé dans l'envoi/réception de données"780 return;;781 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status782 return;;783 esac784 elif [ $MYLANG = "en" ] ; then785 case $status in786 0) return;;787 1) echo "rsync error : Syntax or usage error "788 return;;789 2) echo "rsync error : Protocol incompatibility "790 return;;791 3) echo "rsync error : Errors selecting input/output files, dirs"792 return;;793 4) echo "rsync error : Requested action not supported: an attempt"794 echo "was made to manipulate 64-bit files on a platform that cannot support"795 echo "them; or an option was specified that is supported by the client and"796 echo "not by the server."797 return;;798 5) echo "rsync error : Error starting client-server protocol"799 return;;800 10) echo "rsync error : Error in socket I/O "801 return;;802 11) echo "rsync error : Error in file I/O "803 return;;804 12) echo "rsync error : Error in rsync protocol data stream "805 return;;806 13) echo "rsync error : Errors with program diagnostics "807 return;;808 14) echo "rsync error : Error in IPC code "809 return;;810 20) echo "rsync error : Received SIGUSR1 or SIGINT "811 return;;812 21) echo "rsync error : Some error returned by waitpid() "813 return;;814 22) echo "rsync error : Error allocating core memory buffers "815 return;;816 23) echo "rsync error : Partial transfer due to error"817 return;;818 24) echo "rsync error : Partial transfer due to vanished source files"819 return;;820 30) echo "rsync error : Timeout in data send/receive "821 return;;822 *) echo "rsync error : return code of rsync unknown :" $status823 return;;824 esac825 else826 echo "unknown language $MYLANG."827 return828 fi829 }830 831 #D-#==================================================832 #D-function IGCM_sys_Miror_libIGCM833 #D-* Purpose: Mirror libIGCM PATH and lib to frontend834 #D-* Examples:835 #D-836 function IGCM_sys_Mirror_libIGCM {837 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"838 if ( $DEBUG_sys ) ; then839 echo "IGCM_sys_Mirror_libIGCM"840 fi841 842 typeset status843 844 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}845 846 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1847 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1848 status=$?849 850 if [ ${status} -gt 0 ] ; then851 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend."852 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$853 fi854 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"855 }856 857 #D-#==================================================858 #D-function IGCM_sys_Cp859 #D-* Purpose: generic cp860 #D-* Examples:861 #D-862 function IGCM_sys_Cp {863 IGCM_debug_PushStack "IGCM_sys_Cp" $@864 if ( $DEBUG_sys ) ; then865 echo "IGCM_sys_Cp :" $@866 fi867 868 typeset status869 870 echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1871 \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1872 status=$?873 874 if [ ${status} -gt 0 ] ; then875 echo "IGCM_sys_Cp : error code ${status}"876 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$877 IGCM_debug_Exit "IGCM_sys_Cp"878 else879 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$880 fi881 IGCM_debug_PopStack "IGCM_sys_Cp"882 }883 884 #D-#==================================================885 #D-function IGCM_sys_Rm886 #D-* Purpose: generic rm887 #D-* Examples:888 #D-889 function IGCM_sys_Rm {890 IGCM_debug_PushStack "IGCM_sys_Rm" $@891 if ( $DEBUG_sys ) ; then892 echo "IGCM_sys_Rm :" $@893 fi894 895 typeset status896 897 echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1898 \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1899 status=$?900 901 if [ ${status} -gt 0 ] ; then902 echo "IGCM_sys_Rm : error code ${status}"903 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$904 IGCM_debug_Exit "IGCM_sys_Rm"905 else906 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$907 fi908 IGCM_debug_PopStack "IGCM_sys_Rm"909 }910 911 #D-#==================================================912 455 #D-function IGCM_sys_RmRunDir 913 456 #D-* Purpose: rm tmpdir (dummy function most of the time batch … … 922 465 fi 923 466 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 924 }925 926 #D-#==================================================927 #D-function IGCM_sys_Mv928 #D-* Purpose: generic move929 #D-* Examples:930 #D-931 function IGCM_sys_Mv {932 IGCM_debug_PushStack "IGCM_sys_Mv" $@933 if ( $DEBUG_sys ) ; then934 echo "IGCM_sys_Mv :" $@935 fi936 937 if [ $DRYRUN = 0 ]; then938 939 typeset status940 941 echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1942 \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1943 status=$?944 945 if [ ${status} -gt 0 ] ; then946 echo "IGCM_sys_Mv : error code ${status}"947 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$948 IGCM_debug_Exit "IGCM_sys_Mv"949 else950 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$951 fi952 fi953 IGCM_debug_PopStack "IGCM_sys_Mv"954 467 } 955 468 … … 1058 571 1059 572 #D-#================================================== 1060 #D-function IGCM_sys_Get_Master1061 #D-* Purpose: Copy a complete directory from MASTER filesystem1062 #D-* Examples:1063 #D-1064 function IGCM_sys_Get_Master {1065 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@1066 if ( $DEBUG_sys ) ; then1067 echo "IGCM_sys_Get_Master :" $@1068 fi1069 if [ $DRYRUN = 0 ]; then1070 if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then1071 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."1072 IGCM_debug_PopStack "IGCM_sys_Get_Master"1073 return1074 fi1075 1076 typeset NB_ESSAI DELAI status i1077 # number of tentative1078 NB_ESSAI=31079 # time delay between tentative1080 DELAI=21081 1082 i=01083 while [ $i -lt $NB_ESSAI ] ; do1084 \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11085 status=$?1086 if [ ${status} -gt 0 ]; then1087 IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}"1088 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."1089 sleep $DELAI1090 else1091 break1092 fi1093 (( i = i + 1 ))1094 done1095 1096 if [ ${status} -gt 0 ] ; then1097 echo "IGCM_sys_Get_Master : error."1098 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1099 IGCM_debug_Exit "IGCM_sys_Get_Master"1100 else1101 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1102 fi1103 fi1104 IGCM_debug_PopStack "IGCM_sys_Get_Master"1105 }1106 1107 #====================================================1108 #- Call IGCM_sys_Mirror_libIGCM now !1109 if ( $MirrorlibIGCM ) ; then1110 IGCM_sys_Mirror_libIGCM1111 fi1112 1113 #D-#==================================================1114 573 #D-function IGCM_sys_Put_Rest 1115 574 #D-* Purpose: Put computied restarts on ${ARCHIVE}. … … 1173 632 1174 633 #D-#================================================== 1175 #D-function IGCM_sys_PutBuffer_Rest1176 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}.1177 #D- File and target directory must exist.1178 #D-* Examples:1179 #D-1180 function IGCM_sys_PutBuffer_Rest {1181 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@1182 if ( $DEBUG_sys ) ; then1183 echo "IGCM_sys_PutBuffer_Rest :" $@1184 fi1185 if [ $DRYRUN = 0 ]; then1186 if [ ! -f ${1} ] ; then1187 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."1188 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"1189 fi1190 1191 typeset status1192 #1193 # USUAL WAY1194 \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11195 status=$?1196 1197 if [ ${status} -gt 0 ] ; then1198 echo "IGCM_sys_PutBuffer_Rest : error code ${status}"1199 [ -f ${2} ] && ls -l ${2}1200 [ -f ${2}/${1} ] && ls -l ${2}/${1}1201 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1202 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"1203 else1204 1205 if [ X${JobType} = XRUN ] ; then1206 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}1207 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}1208 fi1209 1210 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1211 fi1212 fi1213 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"1214 }1215 1216 #D-#==================================================1217 #D-function IGCM_sys_PrepareTaredRestart1218 #D-* Purpose: Prepare tared restart to be access by computing job.1219 #D-* Examples:1220 #D-1221 function IGCM_sys_PrepareTaredRestart {1222 IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@1223 if [ $DRYRUN = 0 ]; then1224 [ ! -f $( basename $1 ) ] && IGCM_sys_Get $1 .1225 fi1226 IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart"1227 }1228 1229 #D-#==================================================1230 634 #D-function IGCM_sys_Put_Out 1231 635 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly … … 1293 697 1294 698 #D-#================================================== 1295 #D-function IGCM_sys_PutBuffer_Out1296 #D-* Purpose: Copy a file on ${WORKDIR} after having chmod it in readonly1297 #D-* Examples:1298 #D-1299 function IGCM_sys_PutBuffer_Out {1300 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@1301 if ( $DEBUG_sys ) ; then1302 echo "IGCM_sys_PutBuffer_Out :" $@1303 fi1304 1305 typeset NB_ESSAI DELAI status i exist skip1306 1307 # number of tentative1308 NB_ESSAI=31309 # time delay between tentative1310 DELAI=21311 1312 if [ $DRYRUN = 0 ]; then1313 if [ ! -f ${1} ] ; then1314 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."1315 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"1316 return 11317 fi1318 #1319 IGCM_sys_Mkdir $( dirname $2 )1320 #1321 1322 exist=false1323 skip=false1324 if [ -f $2 ] ; then1325 IGCM_debug_Print 1 "$2 already exist"1326 exist=true1327 if [ "X$( diff $1 $2 )" = X ] ; then1328 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"1329 status=01330 skip=true1331 else1332 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"1333 skip=false1334 fi1335 fi1336 #1337 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then1338 IGCM_sys_Chmod u+w $21339 fi1340 1341 if [ X${skip} = Xfalse ] ; then1342 i=01343 while [ $i -lt $NB_ESSAI ] ; do1344 if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then1345 # USUAL WAY1346 \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11347 status=$?1348 else1349 # NOT SO USUAL WAY1350 \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11351 status=$?1352 fi1353 if [ ${status} -gt 0 ]; then1354 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}"1355 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again."1356 [ -f ${2} ] && ls -l ${2}1357 [ -f ${2}/${1} ] && ls -l ${2}/${1}1358 sleep $DELAI1359 else1360 break1361 fi1362 (( i = i + 1 ))1363 done1364 fi1365 1366 if [ ${status} -gt 0 ] ; then1367 echo "IGCM_sys_PutBuffer_Out : error."1368 [ -f ${2} ] && ls -l ${2}1369 [ -f ${2}/${1} ] && ls -l ${2}/${1}1370 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1371 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"1372 else1373 1374 if [ X${JobType} = XRUN ] ; then1375 if [ X${3} = X ] ; then1376 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}1377 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}1378 fi1379 fi1380 1381 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1382 fi1383 fi1384 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"1385 return 01386 }1387 1388 #D-#==================================================1389 699 #D-function IGCM_sys_Get 1390 700 #D-* Purpose: Get a file from ${ARCHIVE} … … 1456 766 fi 1457 767 IGCM_debug_PopStack "IGCM_sys_Get" 1458 }1459 1460 #D-#==================================================1461 #D-function IGCM_sys_GetBuffer1462 #D-* Purpose: Get a file from ${SCRATCHDIR}1463 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX1464 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/1465 function IGCM_sys_GetBuffer {1466 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@1467 1468 typeset DEST buf_liste target file_work1469 typeset NB_ESSAI DELAI status i1470 1471 if ( $DEBUG_sys ) ; then1472 echo "IGCM_sys_GetBuffer :" $@1473 fi1474 1475 # number of tentative1476 NB_ESSAI=31477 # time delay between tentative1478 DELAI=21479 1480 if [ $DRYRUN -le 2 ]; then1481 if [ X${1} = X'/l' ] ; then1482 eval set +A buf_liste \${${2}}1483 else1484 eval set +A buf_liste ${1}1485 fi1486 eval DEST=\${${#}}1487 1488 #USUAL WAY1489 if [ X${1} = X'/l' ] ; then1490 for target in ${buf_liste[*]} ; do1491 local_file=$( basename ${target} )1492 i=01493 while [ $i -lt $NB_ESSAI ] ; do1494 \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11495 status=$?1496 if [ ${status} -gt 0 ]; then1497 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"1498 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."1499 sleep $DELAI1500 else1501 break1502 fi1503 (( i = i + 1 ))1504 done1505 if [ ${status} -gt 0 ] ; then1506 echo "IGCM_sys_Get : error"1507 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1508 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1509 IGCM_debug_Exit "IGCM_sys_GetBuffer"1510 else1511 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1512 fi1513 done1514 else1515 i=01516 while [ $i -lt $NB_ESSAI ] ; do1517 \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11518 status=$?1519 if [ ${status} -gt 0 ]; then1520 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"1521 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."1522 sleep $DELAI1523 else1524 break1525 fi1526 (( i = i + 1 ))1527 done1528 if [ ${status} -gt 0 ] ; then1529 echo "IGCM_sys_Get : error"1530 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1531 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1532 IGCM_debug_Exit "IGCM_sys_GetBuffer"1533 else1534 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1535 fi1536 fi1537 fi1538 IGCM_debug_PopStack "IGCM_sys_GetBuffer"1539 }1540 1541 #D-#==================================================1542 #D-function IGCM_sys_GetDate_FichWork1543 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK1544 #D-* Examples:1545 #D-1546 function IGCM_sys_GetDate_FichWork {1547 IGCM_debug_PushStack "IGCM_sys_FichWork" $@1548 if ( $DEBUG_sys ) ; then1549 echo "IGCM_sys_GetDate_FichWork :" $@1550 fi1551 1552 if [ $# -ge 3 ] ; then1553 mode=$31554 TimeStyle=$41555 else1556 mode="default"1557 TimeStyle="%Y%m%d%H%M%S"1558 fi1559 1560 typeset dateF1561 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} )1562 1563 case $mode in1564 "default")1565 eval ${2}=${dateF[5]}1566 ;;1567 "SplitFields")1568 eval ${2}="${dateF[5]}\ ${dateF[6]}"1569 ;;1570 esac1571 1572 1573 # donne la date filesys d'un fichier sur la machine work1574 IGCM_debug_PopStack "IGCM_sys_FichWork"1575 }1576 1577 #D-#==================================================1578 #D-function IGCM_sys_GetDate_FichArchive1579 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE1580 #D-* Examples:1581 #D-1582 function IGCM_sys_GetDate_FichArchive {1583 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@1584 if ( $DEBUG_sys ) ; then1585 echo "IGCM_sys_GetDate_FichArchive :" $@1586 fi1587 typeset dateF1588 set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )1589 eval ${2}=${dateF[5]}1590 1591 IGCM_debug_PopStack "IGCM_sys_FichArchive"1592 768 } 1593 769 … … 1668 844 fi 1669 845 IGCM_debug_PopStack "IGCM_sys_sync" 1670 }1671 1672 #D-#==================================================1673 #D-function IGCM_sys_rebuild1674 #D-* Purpose: rebuild parallel files1675 #D-* Examples:1676 #D-1677 function IGCM_sys_rebuild {1678 IGCM_debug_PushStack "IGCM_sys_rebuild" $@1679 if ( $DEBUG_sys ) ; then1680 echo "IGCM_sys_rebuild :" $@1681 fi1682 1683 typeset NB_ESSAI DELAI status i firstArg1684 # number of tentative1685 NB_ESSAI=31686 # time delay between tentative1687 DELAI=21688 1689 i=01690 while [ $i -lt $NB_ESSAI ] ; do1691 rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11692 status=$?1693 if [ ${status} -gt 0 ] ; then1694 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}"1695 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1696 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1697 IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."1698 firstArg=${1}1699 \rm ${firstArg}1700 sleep $DELAI1701 else1702 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1703 break1704 fi1705 (( i = i + 1 ))1706 done1707 1708 if [ ${status} -gt 0 ] ; then1709 echo "IGCM_sys_rebuild : rebuild error code is ${status}"1710 IGCM_debug_Exit "rebuild"1711 fi1712 1713 IGCM_debug_PopStack "IGCM_sys_rebuild"1714 }1715 1716 #D-#==================================================1717 #D-function IGCM_sys_rebuild_station1718 #D-* Purpose: rebuild parallel files describing station1719 #D-* Examples:1720 #D-1721 function IGCM_sys_rebuild_station {1722 IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@1723 typeset i list_opt file_in file_out prefix_invert list_invert1724 if ( $DEBUG_sys ) ; then1725 echo "IGCM_sys_rebuild_station :" $@1726 fi1727 list_opt=$@1728 1729 # Invert Axis : t,x -> x,t1730 # t,pres,x -> x,t,pres1731 # So that we can concatenate along x1732 i=01733 for file_in in ${list_opt} ; do1734 (( i = i + 1))1735 [ ${i} = 1 ] && file_out=${file_in} && continue1736 # detect time counter and do the job only if present1737 var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')1738 if [ X${var_unlim} = Xtime_counter ] ; then1739 prefix_invert=$( basename ${file_in} .nc )1740 IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc1741 list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc1742 fi1743 done1744 1745 # Concatenate1746 IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc1747 1748 # Re-ivert file1749 IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out}1750 1751 # Station re-ordering is too expansive to be run within libIGCM1752 # This is due to (ncpdq - nrcat - ncpdq) I/O sequence.1753 # This re-ordering must be done "in memory" by the cmorization process1754 # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq)1755 # BEGIN reordering1756 1757 # Only LMDZ text output contains the exact ordering of the station.1758 # We isolate this in the code below:1759 # 0 38 -157.5000000000000 70.985915492957741760 # 0 54 27.49999999999999 67.183098591549281761 # 0 56 -62.50000000000001 82.394366197183091762 # 0 79 12.49999999999999 78.591549295774661763 # 0 116 -165.0000000000000 76.056338028169011764 # 0 117 130.0000000000000 70.985915492957741765 # 0 118 110.0000000000000 87.464788732394371766 # 1 40 4.999999999999995 51.971830985915501767 1768 # typeset iStation iProc list_opt file_in file_out prefix_invert1769 # typeset -Z4 j41770 # typeset -Z3 j31771 1772 # unset list_opt1773 # set +A list_opt $@1774 1775 # Filename after rebuild1776 # file_out=${list_opt[0]}1777 # Prefix of output files1778 # prefix_invert=$( basename ${file_out} .nc )1779 # Number of procs1780 # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l )1781 1782 # iProc=01783 # while [ ${iProc} -lt ${num_proc} ] ; do1784 # Array containing Station as a number1785 # unset proc_stn1786 # set +A proc_stn $( grep "iophy_mpi rank ip lon lat $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | gawk ' {print $2}' )1787 # Number of stations produced by processor proc1788 # stationLast=${#proc_stn[*]}1789 # Proc number on 4 digits1790 # j4=${iProc}1791 # Init1792 # iStation=01793 # while [ ${iStation} -lt ${stationLast} ] ; do1794 # Station number on 3 digits1795 # j3=${proc_stn[${iStation}]}1796 # Extract station1797 # Invert Axis : t,x -> x,t1798 # t,pres,x -> x,t,pres1799 # So that we can concatenate along x1800 # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc1801 # (( iStation = iStation + 1 ))1802 # done1803 # (( iProc = iProc + 1 ))1804 # done1805 1806 # Concatenate all station along x1807 # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc1808 1809 # Re-invert file1810 # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out}1811 1812 # END reordering1813 1814 IGCM_debug_PopStack "IGCM_sys_rebuild_station"1815 846 } 1816 847 … … 2145 1176 IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" 2146 1177 } 2147 2148 ##############################################################2149 # NCO OPERATOR2150 2151 #D-#==================================================2152 #D-function IGCM_sys_ncap22153 #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry2154 #D-* Examples:2155 #D-2156 function IGCM_sys_ncap2 {2157 IGCM_debug_PushStack "IGCM_sys_ncap2" $@2158 if ( $DEBUG_sys ) ; then2159 echo "IGCM_sys_ncap2 :" $@2160 fi2161 2162 typeset NB_ESSAI DELAI status i2163 # number of tentative2164 NB_ESSAI=32165 # time delay between tentative2166 DELAI=22167 2168 i=02169 while [ $i -lt $NB_ESSAI ] ; do2170 ncap2 -C "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12171 status=$?2172 if [ ${status} -gt 0 ] ; then2173 IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}"2174 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2175 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2176 IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2177 sleep $DELAI2178 else2179 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2180 break2181 fi2182 (( i = i + 1 ))2183 done2184 2185 if [ ${status} -gt 0 ] ; then2186 echo "IGCM_sys_ncap2 : ncap2 error"2187 IGCM_debug_Exit "ncap2"2188 fi2189 2190 IGCM_debug_PopStack "IGCM_sys_ncap2"2191 }2192 2193 #D-#==================================================2194 #D-function IGCM_sys_ncatted2195 #D-* Purpose: encapsulate ncatted call so as to manage error code and retry2196 #D-* Examples:2197 #D-2198 function IGCM_sys_ncatted {2199 IGCM_debug_PushStack "IGCM_sys_ncatted" $@2200 if ( $DEBUG_sys ) ; then2201 echo "IGCM_sys_ncatted :" $@2202 fi2203 2204 typeset NB_ESSAI DELAI status i2205 # number of tentative2206 NB_ESSAI=32207 # time delay between tentative2208 DELAI=22209 2210 i=02211 while [ $i -lt $NB_ESSAI ] ; do2212 ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12213 status=$?2214 if [ ${status} -gt 0 ] ; then2215 IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}"2216 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2217 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2218 IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2219 sleep $DELAI2220 else2221 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2222 break2223 fi2224 (( i = i + 1 ))2225 done2226 2227 if [ ${status} -gt 0 ] ; then2228 echo "IGCM_sys_ncatted : ncatted error"2229 IGCM_debug_Exit "ncatted"2230 fi2231 2232 IGCM_debug_PopStack "IGCM_sys_ncatted"2233 }2234 2235 #D-#==================================================2236 #D-function IGCM_sys_ncbo2237 #D-* Purpose: encapsulate ncbo call so as to manage error code and retry2238 #D-* Examples:2239 #D-2240 function IGCM_sys_ncbo {2241 IGCM_debug_PushStack "IGCM_sys_ncbo" $@2242 if ( $DEBUG_sys ) ; then2243 echo "IGCM_sys_ncbo :" $@2244 fi2245 2246 typeset NB_ESSAI DELAI status i2247 # number of tentative2248 NB_ESSAI=32249 # time delay between tentative2250 DELAI=22251 2252 i=02253 while [ $i -lt $NB_ESSAI ] ; do2254 ncbo -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12255 status=$?2256 if [ ${status} -gt 0 ] ; then2257 IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}"2258 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2259 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2260 IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2261 sleep $DELAI2262 else2263 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2264 break2265 fi2266 (( i = i + 1 ))2267 done2268 2269 if [ ${status} -gt 0 ] ; then2270 echo "IGCM_sys_ncbo : ncbo error"2271 IGCM_debug_Exit "ncbo"2272 fi2273 2274 IGCM_debug_PopStack "IGCM_sys_ncbo"2275 }2276 2277 #D-#==================================================2278 #D-function IGCM_sys_ncdif2279 #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry2280 #D-* Examples:2281 #D-2282 function IGCM_sys_ncdiff {2283 IGCM_debug_PushStack "IGCM_sys_ncdiff" $@2284 if ( $DEBUG_sys ) ; then2285 echo "IGCM_sys_ncdiff :" $@2286 fi2287 2288 typeset NB_ESSAI DELAI status i2289 # number of tentative2290 NB_ESSAI=32291 # time delay between tentative2292 DELAI=22293 2294 i=02295 while [ $i -lt $NB_ESSAI ] ; do2296 ncdiff -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12297 status=$?2298 if [ ${status} -gt 0 ] ; then2299 IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}"2300 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2301 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2302 IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2303 sleep $DELAI2304 else2305 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2306 break2307 fi2308 (( i = i + 1 ))2309 done2310 2311 if [ ${status} -gt 0 ] ; then2312 echo "IGCM_sys_ncdiff : ncdiff error"2313 IGCM_debug_Exit "ncdiff"2314 fi2315 2316 IGCM_debug_PopStack "IGCM_sys_ncdiff"2317 }2318 2319 #D-#==================================================2320 #D-function IGCM_sys_ncea2321 #D-* Purpose: encapsulate ncea call so as to manage error code and retry2322 #D-* Examples:2323 #D-2324 function IGCM_sys_ncea {2325 IGCM_debug_PushStack "IGCM_sys_ncea" $@2326 if ( $DEBUG_sys ) ; then2327 echo "IGCM_sys_ncea :" $@2328 fi2329 2330 typeset NB_ESSAI DELAI status i2331 # number of tentative2332 NB_ESSAI=32333 # time delay between tentative2334 DELAI=22335 2336 i=02337 while [ $i -lt $NB_ESSAI ] ; do2338 ncea -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12339 status=$?2340 if [ ${status} -gt 0 ] ; then2341 IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}"2342 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2343 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2344 IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2345 sleep $DELAI2346 else2347 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2348 break2349 fi2350 (( i = i + 1 ))2351 done2352 2353 if [ ${status} -gt 0 ] ; then2354 echo "IGCM_sys_ncea : ncea error"2355 IGCM_debug_Exit "ncea"2356 fi2357 2358 IGCM_debug_PopStack "IGCM_sys_ncea"2359 }2360 2361 #D-#==================================================2362 #D-function IGCM_sys_ncecat2363 #D-* Purpose: encapsulate ncecat call so as to manage error code and retry2364 #D-* Examples:2365 #D-2366 function IGCM_sys_ncecat {2367 IGCM_debug_PushStack "IGCM_sys_ncecat" $@2368 if ( $DEBUG_sys ) ; then2369 echo "IGCM_sys_ncecat :" $@2370 fi2371 2372 typeset NB_ESSAI DELAI status i2373 # number of tentative2374 NB_ESSAI=32375 # time delay between tentative2376 DELAI=22377 2378 i=02379 while [ $i -lt $NB_ESSAI ] ; do2380 ncecat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12381 status=$?2382 if [ ${status} -gt 0 ] ; then2383 IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}"2384 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2385 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2386 IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2387 sleep $DELAI2388 else2389 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2390 break2391 fi2392 (( i = i + 1 ))2393 done2394 2395 if [ ${status} -gt 0 ] ; then2396 echo "IGCM_sys_ncecat : ncecat error"2397 IGCM_debug_Exit "ncecat"2398 fi2399 2400 IGCM_debug_PopStack "IGCM_sys_ncecat"2401 }2402 2403 #D-#==================================================2404 #D-function IGCM_sys_ncflint2405 #D-* Purpose: encapsulate ncflint call so as to manage error code and retry2406 #D-* Examples:2407 #D-2408 function IGCM_sys_ncflint {2409 IGCM_debug_PushStack "IGCM_sys_ncflint" $@2410 if ( $DEBUG_sys ) ; then2411 echo "IGCM_sys_ncflint :" $@2412 fi2413 2414 typeset NB_ESSAI DELAI status i2415 # number of tentative2416 NB_ESSAI=32417 # time delay between tentative2418 DELAI=22419 2420 i=02421 while [ $i -lt $NB_ESSAI ] ; do2422 ncflint -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12423 status=$?2424 if [ ${status} -gt 0 ] ; then2425 IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}"2426 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2427 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2428 IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2429 sleep $DELAI2430 else2431 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2432 break2433 fi2434 (( i = i + 1 ))2435 done2436 2437 if [ ${status} -gt 0 ] ; then2438 echo "IGCM_sys_ncflint : ncflint error"2439 IGCM_debug_Exit "ncflint"2440 fi2441 2442 IGCM_debug_PopStack "IGCM_sys_ncflint"2443 }2444 2445 #D-#==================================================2446 #D-function IGCM_sys_ncks2447 #D-* Purpose: encapsulate ncks call so as to manage error code and retry2448 #D-* Examples:2449 #D-2450 function IGCM_sys_ncks {2451 IGCM_debug_PushStack "IGCM_sys_ncks" $@2452 if ( $DEBUG_sys ) ; then2453 echo "IGCM_sys_ncks :" $@2454 fi2455 2456 typeset NB_ESSAI DELAI status i2457 # number of tentative2458 NB_ESSAI=32459 # time delay between tentative2460 DELAI=22461 2462 i=02463 while [ $i -lt $NB_ESSAI ] ; do2464 ncks -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12465 status=$?2466 if [ ${status} -gt 0 ] ; then2467 IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}"2468 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2469 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2470 IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2471 sleep $DELAI2472 else2473 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2474 break2475 fi2476 (( i = i + 1 ))2477 done2478 2479 if [ ${status} -gt 0 ] ; then2480 echo "IGCM_sys_ncks : ncks error"2481 IGCM_debug_Exit "ncks"2482 fi2483 2484 IGCM_debug_PopStack "IGCM_sys_ncks"2485 }2486 2487 #D-#==================================================2488 #D-function IGCM_sys_ncpdq2489 #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry2490 #D-* Examples:2491 #D-2492 function IGCM_sys_ncpdq {2493 IGCM_debug_PushStack "IGCM_sys_ncpdq" $@2494 if ( $DEBUG_sys ) ; then2495 echo "IGCM_sys_ncpdq :" $@2496 fi2497 2498 typeset NB_ESSAI DELAI status i2499 # number of tentative2500 NB_ESSAI=32501 # time delay between tentative2502 DELAI=22503 2504 i=02505 while [ $i -lt $NB_ESSAI ] ; do2506 ncpdq -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12507 status=$?2508 if [ ${status} -gt 0 ] ; then2509 IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}"2510 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2511 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2512 IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2513 sleep $DELAI2514 else2515 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2516 break2517 fi2518 (( i = i + 1 ))2519 done2520 2521 if [ ${status} -gt 0 ] ; then2522 echo "IGCM_sys_ncpdq : ncpdq error"2523 IGCM_debug_Exit "ncpdq"2524 fi2525 2526 IGCM_debug_PopStack "IGCM_sys_ncpdq"2527 }2528 2529 #D-#==================================================2530 #D-function IGCM_sys_ncra2531 #D-* Purpose: encapsulate ncra call so as to manage error code and retry2532 #D-* Examples:2533 #D-2534 function IGCM_sys_ncra {2535 IGCM_debug_PushStack "IGCM_sys_ncra" $@2536 if ( $DEBUG_sys ) ; then2537 echo "IGCM_sys_ncra :" $@2538 fi2539 2540 typeset NB_ESSAI DELAI status i2541 # number of tentative2542 NB_ESSAI=32543 # time delay between tentative2544 DELAI=22545 2546 i=02547 while [ $i -lt $NB_ESSAI ] ; do2548 ncra -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12549 status=$?2550 if [ ${status} -gt 0 ] ; then2551 IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}"2552 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2553 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2554 IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2555 sleep $DELAI2556 else2557 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2558 break2559 fi2560 (( i = i + 1 ))2561 done2562 2563 if [ ${status} -gt 0 ] ; then2564 echo "IGCM_sys_ncra : ncra error"2565 IGCM_debug_Exit "ncra"2566 fi2567 2568 IGCM_debug_PopStack "IGCM_sys_ncra"2569 }2570 2571 #D-#==================================================2572 #D-function IGCM_sys_ncrcat2573 #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry2574 #D-* Examples:2575 #D-2576 function IGCM_sys_ncrcat {2577 IGCM_debug_PushStack "IGCM_sys_ncrcat" $@2578 if ( $DEBUG_sys ) ; then2579 echo "IGCM_sys_ncrcat :" $@2580 fi2581 2582 typeset NB_ESSAI DELAI status i lastArg2583 # number of tentative2584 NB_ESSAI=32585 # time delay between tentative2586 DELAI=22587 2588 i=02589 while [ $i -lt $NB_ESSAI ] ; do2590 ncrcat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12591 status=$?2592 if [ ${status} -gt 0 ] ; then2593 IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}"2594 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2595 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2596 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2597 sleep $DELAI2598 elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] ; then2599 IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity"2600 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2601 # remove files having corrupted time axis2602 eval lastArg=\${$#}2603 IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}"2604 \rm ${lastArg}2605 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2606 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2607 sleep $DELAI2608 else2609 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2610 break2611 fi2612 (( i = i + 1 ))2613 done2614 2615 if [ ${status} -gt 0 ] ; then2616 echo "IGCM_sys_ncrcat : ncrcat error"2617 #IGCM_debug_Exit "ncrcat"2618 fi2619 2620 IGCM_debug_PopStack "IGCM_sys_ncrcat"2621 }2622 2623 #D-#==================================================2624 #D-function IGCM_sys_ncrename2625 #D-* Purpose: encapsulate ncrename call so as to manage error code and retry2626 #D-* Examples:2627 #D-2628 function IGCM_sys_ncrename {2629 IGCM_debug_PushStack "IGCM_sys_ncrename" $@2630 if ( $DEBUG_sys ) ; then2631 echo "IGCM_sys_ncrename :" $@2632 fi2633 2634 typeset NB_ESSAI DELAI status i2635 # number of tentative2636 NB_ESSAI=32637 # time delay between tentative2638 DELAI=22639 2640 i=02641 while [ $i -lt $NB_ESSAI ] ; do2642 ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12643 status=$?2644 if [ ${status} -gt 0 ] ; then2645 IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}"2646 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2647 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2648 IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2649 sleep $DELAI2650 else2651 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2652 break2653 fi2654 (( i = i + 1 ))2655 done2656 2657 if [ ${status} -gt 0 ] ; then2658 echo "IGCM_sys_ncrename : ncrename error"2659 IGCM_debug_Exit "ncrename"2660 fi2661 2662 IGCM_debug_PopStack "IGCM_sys_ncrename"2663 }2664 2665 #D-#==================================================2666 #D-function IGCM_sys_ncwa2667 #D-* Purpose: encapsulate ncwa call so as to manage error code and retry2668 #D-* Examples:2669 #D-2670 function IGCM_sys_ncwa {2671 IGCM_debug_PushStack "IGCM_sys_ncwa" $@2672 if ( $DEBUG_sys ) ; then2673 echo "IGCM_sys_ncwa :" $@2674 fi2675 2676 typeset NB_ESSAI DELAI status i2677 # number of tentative2678 NB_ESSAI=32679 # time delay between tentative2680 DELAI=22681 2682 i=02683 while [ $i -lt $NB_ESSAI ] ; do2684 ncwa -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12685 status=$?2686 if [ ${status} -gt 0 ] ; then2687 IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}"2688 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2689 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2690 IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2691 sleep $DELAI2692 else2693 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2694 break2695 fi2696 (( i = i + 1 ))2697 done2698 2699 if [ ${status} -gt 0 ] ; then2700 echo "IGCM_sys_ncwa : ncwa error"2701 IGCM_debug_Exit "ncwa"2702 fi2703 2704 IGCM_debug_PopStack "IGCM_sys_ncwa"2705 }2706 2707 ##############################################################2708 # CDO OPERATOR2709 2710 #D-#==================================================2711 #D-function IGCM_sys_cdo2712 #D-* Purpose: encapsulate cdo call so as to manage error code and retry2713 #D-* Examples:2714 #D-2715 function IGCM_sys_cdo {2716 IGCM_debug_PushStack "IGCM_sys_cdo" $@2717 if ( $DEBUG_sys ) ; then2718 echo "IGCM_sys_cdo :" $@2719 fi2720 2721 typeset status2722 2723 \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12724 status=$?2725 if [ ${status} -gt 0 ] ; then2726 echo "IGCM_sys_cdo : error code ${status}"2727 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2728 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2729 IGCM_debug_PopStack "IGCM_sys_cdo"2730 return 12731 else2732 IGCM_debug_PopStack "IGCM_sys_cdo"2733 return 02734 fi2735 2736 IGCM_debug_PopStack "IGCM_sys_cdo"2737 }
Note: See TracChangeset
for help on using the changeset viewer.