Changeset 1181 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
- Timestamp:
- 04/01/15 14:54:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
r1180 r1181 217 217 218 218 #D-#================================================== 219 #D-function IGCM_sys_RshMaster220 #D-* Purpose: Connection to frontend machine.221 #D-* Examples:222 #D-223 function IGCM_sys_RshMaster {224 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@225 OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF226 export libIGCM=${libIGCM}227 export DEBUG_debug=${DEBUG_debug}228 . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh229 . ${libIGCM}/libIGCM_card/libIGCM_card.ksh230 ${@}231 EOF232 if [ $? -gt 0 ] ; then233 echo "IGCM_sys_RshMaster : erreur."234 IGCM_debug_Exit "IGCM_sys_RshMaster"235 fi236 IGCM_debug_PopStack "IGCM_sys_RshMaster"237 }238 239 #D-#==================================================240 219 #D-function IGCM_sys_RshArchive 241 220 #D-* Purpose: Archive rsh command … … 264 243 IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ 265 244 /bin/ksh <<-EOF 266 ${@} 2> \dev\null245 ${@} 2> /dev/null 267 246 EOF 268 247 IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" 269 }270 271 #D-#==================================================272 #D-function IGCM_sys_RshPost273 #D-* Purpose: Post-process rsh command274 #D-* Examples:275 #D-276 function IGCM_sys_RshPost {277 IGCM_debug_PushStack "IGCM_sys_RshPost" $@278 if ( $DEBUG_sys ) ; then279 echo "IGCM_sys_RshPost :" $@280 fi281 # keep standard input (stdin) for the loop onto temporary file282 cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}283 284 OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}285 if [ $? -gt 0 ] ; then286 echo "IGCM_sys_RshPost : erreur."287 IGCM_debug_Exit "IGCM_sys_RshPost"288 fi289 # delete temporary file290 \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}291 IGCM_debug_PopStack "IGCM_sys_RshPost"292 }293 294 #D-#==================================================295 #D-function IGCM_sys_SendMail296 #D-* Purpose: Send mail when simulation is over297 #D-* Examples:298 #D-299 function IGCM_sys_SendMail {300 IGCM_debug_PushStack "IGCM_sys_SendMail" $@301 if ( $DEBUG_sys ) ; then302 echo "IGCM_sys_SendMail :" $@303 fi304 305 if [ X${1} = XAccounting ] ; then306 status=Accounting307 mailText=jobAccounting.mail308 elif ( ${ExitFlag} ) ; then309 status=failed310 mailText=jobEnd.mail311 else312 status=completed313 mailText=jobEnd.mail314 fi315 316 # Update selected mail template317 while read -r line; do318 eval echo $line >> mail.txt ;319 done < ${libIGCM}/libIGCM_sys/${mailText}320 321 if [ ! -z ${config_UserChoices_MailName} ] ; then322 mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt323 elif [ -f ~/.forward ] ; then324 mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt325 else326 mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt327 fi328 329 sleep 10330 rm -f mail.txt331 332 IGCM_debug_PopStack "IGCM_sys_SendMail"333 }334 335 #D-#==================================================336 #D-function IGCM_sys_Mkdir337 #D-* Purpose: Master locale mkdir command338 #D-* Examples:339 #D-340 function IGCM_sys_Mkdir {341 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@342 if ( $DEBUG_sys ) ; then343 echo "IGCM_sys_Mkdir :" $@344 fi345 if [ ! -d ${1} ]; then346 \mkdir -p $1347 if [ $? -gt 0 ] ; then348 echo "IGCM_sys_Mkdir : erreur."349 IGCM_debug_Exit "IGCM_sys_Mkdir"350 fi351 fi352 # vérification :353 if [ ! -d ${1} ] ; then354 echo "IGCM_sys_Mkdir : erreur."355 IGCM_debug_Exit "IGCM_sys_Mkdir"356 fi357 IGCM_debug_PopStack "IGCM_sys_Mkdir"358 248 } 359 249 … … 379 269 fi 380 270 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 381 }382 383 #D-#==================================================384 #D-function IGCM_sys_MkdirWork385 #D-* Purpose: Mkdir on Work386 #D-* Examples:387 #D-388 function IGCM_sys_MkdirWork {389 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@390 if ( $DEBUG_sys ) ; then391 echo "IGCM_sys_MkdirWork :" $@392 fi393 #- creation de repertoire sur le serveur fichier394 if [ ! -d ${1} ]; then395 \mkdir -p $1396 if [ $? -gt 0 ] ; then397 echo "IGCM_sys_MkdirWork : erreur."398 IGCM_debug_Exit "IGCM_sys_MkdirWork"399 fi400 fi401 IGCM_debug_PopStack "IGCM_sys_MkdirWork"402 }403 404 #D-#==================================================405 #D-function IGCM_sys_Cd406 #D-* Purpose: master cd command407 #D-* Examples:408 #D-409 function IGCM_sys_Cd {410 IGCM_debug_PushStack "IGCM_sys_Cd" $@411 if ( $DEBUG_sys ) ; then412 echo "IGCM_sys_Cd :" $@413 fi414 \cd $1415 if [ $? -gt 0 ] ; then416 echo "IGCM_sys_Cd : erreur."417 IGCM_debug_Exit "IGCM_sys_Cd"418 fi419 IGCM_debug_PopStack "IGCM_sys_Cd"420 }421 422 #D-#==================================================423 #D-function IGCM_sys_Chmod424 #D-* Purpose: Chmod425 #D-* Examples:426 #D-427 function IGCM_sys_Chmod {428 IGCM_debug_PushStack "IGCM_sys_Chmod" $@429 if ( $DEBUG_sys ) ; then430 echo "IGCM_sys_Chmod :" $@431 fi432 \chmod $@433 if [ $? -gt 0 ] ; then434 echo "IGCM_sys_Chmod : erreur."435 IGCM_debug_Exit "IGCM_sys_Chmod"436 fi437 IGCM_debug_PopStack "IGCM_sys_Chmod"438 }439 440 #D-#==================================================441 #D-function IGCM_sys_FileSize442 #D-* Purpose: Filesize443 #D-* Examples:444 #D-445 function IGCM_sys_FileSize {446 IGCM_debug_PushStack "IGCM_sys_FileSize" $@447 448 typeset sizeF449 set +A sizeF -- $( ls -la ${1} )450 if [ $? -gt 0 ] ; then451 IGCM_debug_Exit "IGCM_sys_FileSize"452 fi453 eval ${2}=${sizeF[4]}454 455 IGCM_debug_PopStack "IGCM_sys_FileSize"456 }457 458 #D-#==================================================459 #D-function IGCM_sys_TestDir460 #D-* Purpose: Test Directory that must exists461 #D-* Examples:462 #D-463 function IGCM_sys_TestDir {464 IGCM_debug_PushStack "IGCM_sys_TestDir" $@465 if ( $DEBUG_sys ) ; then466 echo "IGCM_sys_TestDir :" $@467 fi468 typeset ExistFlag469 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )470 IGCM_debug_PopStack "IGCM_sys_TestDir"471 472 return ${ExistFlag}473 271 } 474 272 … … 522 320 523 321 #D-#================================================== 524 #D-function IGCM_sys_TestFileBuffer525 #D-* Purpose: Test file that must NOT EXISTS on Buffer526 #D-* Examples:527 #D-528 function IGCM_sys_TestFileBuffer {529 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@530 typeset ExistFlag531 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )532 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"533 534 return ${ExistFlag}535 }536 537 #D-#==================================================538 322 #D-function IGCM_sys_CountFileArchive 539 323 #D-* Purpose: Count files on Archive filesystem … … 550 334 551 335 #D-#================================================== 552 #D-function IGCM_sys_CountFileBuffer553 #D-* Purpose: Count files on Scratch filesystem554 #D-* Examples:555 #D-556 function IGCM_sys_CountFileBuffer {557 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@558 ls ${@} 2>/dev/null | wc -l559 if [ $? -gt 0 ] ; then560 echo "IGCM_sys_CountFileBuffer : erreur."561 fi562 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"563 }564 565 #D-#==================================================566 336 #D-function IGCM_sys_Tree 567 337 #D-* Purpose: Tree directories with files on ${ARCHIVE} … … 577 347 578 348 IGCM_debug_PopStack "IGCM_sys_Tree" 579 }580 581 #D-#==================================================582 #D-function IGCM_sys_Tar583 #D-* Purpose: master tar command584 #D-* Examples:585 #D-586 function IGCM_sys_Tar {587 IGCM_debug_PushStack "IGCM_sys_Tar" $@588 if ( $DEBUG_sys ) ; then589 echo "IGCM_sys_Tar :" $@590 fi591 \tar cf $@592 if [ $? -gt 0 ] ; then593 echo "IGCM_sys_Tar : erreur."594 IGCM_debug_Exit "IGCM_sys_Tar"595 fi596 IGCM_debug_PopStack "IGCM_sys_Tar"597 }598 599 #D-#==================================================600 #D-function IGCM_sys_UnTar601 #D-* Purpose: master un-tar command602 #D-* Examples:603 #D-604 function IGCM_sys_UnTar {605 IGCM_debug_PushStack "IGCM_sys_UnTar" $@606 if ( $DEBUG_sys ) ; then607 echo "IGCM_sys_UnTar :" $@608 fi609 \tar xvf $1610 if [ $? -gt 0 ] ; then611 echo "IGCM_sys_UnTar : erreur."612 IGCM_debug_Exit "IGCM_sys_UnTar"613 fi614 IGCM_debug_PopStack "IGCM_sys_UnTar"615 349 } 616 350 … … 671 405 672 406 #D-#================================================== 673 #D-function IGCM_sys_Rsync_out674 #D-* Purpose: treat return val of rsync675 #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync676 #D- Error values and explanations can depend on your system version.677 function IGCM_sys_Rsync_out {678 status=$1679 if [ ! $status ] ; then680 echo "rsync error !"681 fi682 683 if [ $MYLANG = "fr" ]; then684 case $status in685 0) return ;;686 1) echo "Erreur de rsync ; RERR_SYNTAX : "687 echo "Erreur de syntaxe ou d'utilisation."688 return;;689 2) echo "Erreur de rsync ; RERR_PROTOCOL : "690 echo "Incompatibilité de protocole."691 return;;692 3) echo "Erreur de rsync ; RERR_FILESELECT 3"693 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et"694 echo "répertoires"695 return;;696 4) echo "Erreur de rsync ; RERR_UNSUPPORTED"697 echo "Action demandée non supportée : une tentative de manipulation de"698 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a"699 echo "été faite ; ou une option qui est supportée par le client mais"700 echo "pas par le serveur a été spécifiée."701 return;;702 10) echo "Erreur de rsync ; RERR_SOCKETIO"703 echo "Erreur dans le socket d'entrée sortie"704 return;;705 11) echo "Erreur de rsync ; RERR_FILEIO"706 echo "Erreur d'entrée sortie fichier"707 return;;708 12) echo "Erreur de rsync ; RERR_STREAMIO"709 echo "Erreur dans flux de donnée du protocole rsync"710 return;;711 13) echo "Erreur de rsync ; RERR_MESSAGEIO"712 echo "Erreur avec les diagnostics du programme"713 return;;714 14) echo "Erreur de rsync ; RERR_IPC"715 echo "Erreur dans le code IPC"716 return;;717 20) echo "Erreur de rsync ; RERR_SIGNAL"718 echo "SIGUSR1 ou SIGINT reçu"719 return;;720 21) echo "Erreur de rsync ; RERR_WAITCHILD"721 echo "Une erreur retournée par waitpid()"722 return;;723 22) echo "Erreur de rsync ; RERR_MALLOC"724 echo "Erreur lors de l'allocation des tampons de mémoire de coeur"725 return;;726 23) echo ""727 echo "Erreur fichier inexistant"728 return;;729 30) echo "Erreur de rsync ; RERR_TIMEOUT"730 echo "Temps d'attente écoulé dans l'envoi/réception de données"731 return;;732 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status733 return;;734 esac735 elif [ $MYLANG = "en" ] ; then736 case $status in737 0) return;;738 1) echo "rsync error : Syntax or usage error "739 return;;740 2) echo "rsync error : Protocol incompatibility "741 return;;742 3) echo "rsync error : Errors selecting input/output files, dirs"743 return;;744 4) echo "rsync error : Requested action not supported: an attempt"745 echo "was made to manipulate 64-bit files on a platform that cannot support"746 echo "them; or an option was specified that is supported by the client and"747 echo "not by the server."748 return;;749 5) echo "rsync error : Error starting client-server protocol"750 return;;751 10) echo "rsync error : Error in socket I/O "752 return;;753 11) echo "rsync error : Error in file I/O "754 return;;755 12) echo "rsync error : Error in rsync protocol data stream "756 return;;757 13) echo "rsync error : Errors with program diagnostics "758 return;;759 14) echo "rsync error : Error in IPC code "760 return;;761 20) echo "rsync error : Received SIGUSR1 or SIGINT "762 return;;763 21) echo "rsync error : Some error returned by waitpid() "764 return;;765 22) echo "rsync error : Error allocating core memory buffers "766 return;;767 23) echo "rsync error : Partial transfer due to error"768 return;;769 24) echo "rsync error : Partial transfer due to vanished source files"770 return;;771 30) echo "rsync error : Timeout in data send/receive "772 return;;773 *) echo "rsync error : return code of rsync unknown :" $status774 return;;775 esac776 else777 echo "unknown language $MYLANG."778 return779 fi780 }781 782 #D-#==================================================783 #D-function IGCM_sys_Miror_libIGCM784 #D-* Purpose: Mirror libIGCM PATH and lib to frontend785 #D-* Examples:786 #D-787 function IGCM_sys_Mirror_libIGCM {788 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"789 if ( $DEBUG_sys ) ; then790 echo "IGCM_sys_Mirror_libIGCM"791 fi792 793 typeset status794 795 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}796 797 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1798 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1799 status=$?800 801 if [ ${status} -gt 0 ] ; then802 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend."803 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$804 fi805 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"806 }807 808 #D-#==================================================809 #D-function IGCM_sys_Cp810 #D-* Purpose: generic cp811 #D-* Examples:812 #D-813 function IGCM_sys_Cp {814 IGCM_debug_PushStack "IGCM_sys_Cp" $@815 if ( $DEBUG_sys ) ; then816 echo "IGCM_sys_Cp :" $@817 fi818 819 typeset status820 821 echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1822 \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1823 status=$?824 825 if [ ${status} -gt 0 ] ; then826 echo "IGCM_sys_Cp : error code ${status}"827 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$828 IGCM_debug_Exit "IGCM_sys_Cp"829 else830 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$831 fi832 IGCM_debug_PopStack "IGCM_sys_Cp"833 }834 835 #D-#==================================================836 #D-function IGCM_sys_Rm837 #D-* Purpose: generic rm838 #D-* Examples:839 #D-840 function IGCM_sys_Rm {841 IGCM_debug_PushStack "IGCM_sys_Rm" $@842 if ( $DEBUG_sys ) ; then843 echo "IGCM_sys_Rm :" $@844 fi845 846 typeset status847 848 echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1849 \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1850 status=$?851 852 if [ ${status} -gt 0 ] ; then853 echo "IGCM_sys_Rm : error code ${status}"854 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$855 IGCM_debug_Exit "IGCM_sys_Rm"856 else857 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$858 fi859 IGCM_debug_PopStack "IGCM_sys_Rm"860 }861 862 #D-#==================================================863 407 #D-function IGCM_sys_RmRunDir 864 408 #D-* Purpose: rm tmpdir (dummy function most of the time batch … … 873 417 fi 874 418 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 875 }876 877 #D-#==================================================878 #D-function IGCM_sys_Mv879 #D-* Purpose: generic move880 #D-* Examples:881 #D-882 function IGCM_sys_Mv {883 IGCM_debug_PushStack "IGCM_sys_Mv" $@884 if ( $DEBUG_sys ) ; then885 echo "IGCM_sys_Mv :" $@886 fi887 888 if [ $DRYRUN = 0 ]; then889 890 typeset status891 892 echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1893 \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1894 status=$?895 896 if [ ${status} -gt 0 ] ; then897 echo "IGCM_sys_Mv : error code ${status}"898 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$899 IGCM_debug_Exit "IGCM_sys_Mv"900 else901 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$902 fi903 fi904 IGCM_debug_PopStack "IGCM_sys_Mv"905 419 } 906 420 … … 987 501 988 502 #D-#================================================== 989 #D-function IGCM_sys_Get_Master990 #D-* Purpose: Copy a complete directory from MASTER filesystem991 #D-* Examples:992 #D-993 function IGCM_sys_Get_Master {994 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@995 if ( $DEBUG_sys ) ; then996 echo "IGCM_sys_Get_Master :" $@997 fi998 if [ $DRYRUN = 0 ]; then999 if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then1000 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."1001 IGCM_debug_PopStack "IGCM_sys_Get_Master"1002 return1003 fi1004 1005 typeset NB_ESSAI DELAI status i1006 # number of tentative1007 NB_ESSAI=31008 # time delay between tentative1009 DELAI=21010 1011 i=01012 while [ $i -lt $NB_ESSAI ] ; do1013 \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11014 status=$?1015 if [ ${status} -gt 0 ]; then1016 IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}"1017 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."1018 sleep $DELAI1019 else1020 break1021 fi1022 (( i = i + 1 ))1023 done1024 1025 if [ ${status} -gt 0 ] ; then1026 echo "IGCM_sys_Get_Master : error."1027 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1028 IGCM_debug_Exit "IGCM_sys_Get_Master"1029 else1030 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1031 fi1032 fi1033 IGCM_debug_PopStack "IGCM_sys_Get_Master"1034 }1035 1036 #====================================================1037 #- Call IGCM_sys_Mirror_libIGCM now !1038 if ( $MirrorlibIGCM ) ; then1039 IGCM_sys_Mirror_libIGCM1040 fi1041 1042 #D-#==================================================1043 503 #D-function IGCM_sys_Put_Rest 1044 504 #D-* Purpose: Put computied restarts on ${ARCHIVE}. … … 1098 558 1099 559 #D-#================================================== 1100 #D-function IGCM_sys_PutBuffer_Rest1101 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}.1102 #D- File and target directory must exist.1103 #D-* Examples:1104 #D-1105 function IGCM_sys_PutBuffer_Rest {1106 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@1107 if ( $DEBUG_sys ) ; then1108 echo "IGCM_sys_PutBuffer_Rest :" $@1109 fi1110 if [ $DRYRUN = 0 ]; then1111 if [ ! -f ${1} ] ; then1112 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."1113 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"1114 fi1115 1116 typeset status1117 #1118 # USUAL WAY1119 \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11120 status=$?1121 1122 if [ ${status} -gt 0 ] ; then1123 echo "IGCM_sys_PutBuffer_Rest : error code ${status}"1124 [ -f ${2} ] && ls -l ${2}1125 [ -f ${2}/${1} ] && ls -l ${2}/${1}1126 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1127 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"1128 else1129 1130 if [ X${JobType} = XRUN ] ; then1131 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}1132 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}1133 fi1134 1135 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1136 fi1137 fi1138 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"1139 }1140 1141 #D-#==================================================1142 #D-function IGCM_sys_PrepareTaredRestart1143 #D-* Purpose: Prepare tared restart to be access by computing job. Identity here.1144 #D-* Examples:1145 #D-1146 function IGCM_sys_PrepareTaredRestart {1147 IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@1148 1149 IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart"1150 }1151 1152 #D-#==================================================1153 560 #D-function IGCM_sys_Put_Out 1154 561 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly … … 1200 607 1201 608 #D-#================================================== 1202 #D-function IGCM_sys_PutBuffer_Out1203 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly1204 #D-* Examples:1205 #D-1206 function IGCM_sys_PutBuffer_Out {1207 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@1208 if ( $DEBUG_sys ) ; then1209 echo "IGCM_sys_PutBuffer_Out :" $@1210 fi1211 1212 typeset NB_ESSAI DELAI status i exist skip1213 1214 # number of tentative1215 NB_ESSAI=31216 # time delay between tentative1217 DELAI=21218 1219 if [ $DRYRUN = 0 ]; then1220 if [ ! -f ${1} ] ; then1221 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."1222 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"1223 return 11224 fi1225 #1226 IGCM_sys_Mkdir $( dirname $2 )1227 #1228 1229 exist=false1230 skip=false1231 if [ -f $2 ] ; then1232 IGCM_debug_Print 1 "$2 already exist"1233 exist=true1234 if [ "X$( diff $1 $2 )" = X ] ; then1235 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"1236 status=01237 skip=true1238 else1239 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"1240 skip=false1241 fi1242 fi1243 #1244 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then1245 IGCM_sys_Chmod u+w $21246 fi1247 1248 if [ X${skip} = Xfalse ] ; then1249 i=01250 while [ $i -lt $NB_ESSAI ] ; do1251 if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then1252 # USUAL WAY1253 \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11254 status=$?1255 else1256 # NOT SO USUAL WAY1257 \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11258 status=$?1259 fi1260 if [ ${status} -gt 0 ]; then1261 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}"1262 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again."1263 [ -f ${2} ] && ls -l ${2}1264 [ -f ${2}/${1} ] && ls -l ${2}/${1}1265 sleep $DELAI1266 else1267 break1268 fi1269 (( i = i + 1 ))1270 done1271 fi1272 1273 if [ ${status} -gt 0 ] ; then1274 echo "IGCM_sys_PutBuffer_Out : error."1275 [ -f ${2} ] && ls -l ${2}1276 [ -f ${2}/${1} ] && ls -l ${2}/${1}1277 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1278 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"1279 else1280 1281 if [ X${JobType} = XRUN ] ; then1282 if [ X${3} = X ] ; then1283 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}1284 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}1285 fi1286 fi1287 1288 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1289 fi1290 fi1291 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"1292 return 01293 }1294 1295 #D-#==================================================1296 609 #D-function IGCM_sys_Get 1297 610 #D-* Purpose: Get a file from ${ARCHIVE} … … 1339 652 1340 653 #D-#================================================== 1341 #D-function IGCM_sys_GetBuffer1342 #D-* Purpose: Get a file from ${SCRATCHDIR}1343 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX1344 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/1345 function IGCM_sys_GetBuffer {1346 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@1347 1348 typeset DEST buf_liste target file_work1349 typeset NB_ESSAI DELAI status i1350 1351 if ( $DEBUG_sys ) ; then1352 echo "IGCM_sys_GetBuffer :" $@1353 fi1354 1355 # number of tentative1356 NB_ESSAI=31357 # time delay between tentative1358 DELAI=21359 1360 if [ $DRYRUN -le 2 ]; then1361 if [ X${1} = X'/l' ] ; then1362 eval set +A buf_liste \${${2}}1363 else1364 eval set +A buf_liste ${1}1365 fi1366 eval DEST=\${${#}}1367 1368 #USUAL WAY1369 if [ X${1} = X'/l' ] ; then1370 for target in ${buf_liste[*]} ; do1371 local_file=$( basename ${target} )1372 i=01373 while [ $i -lt $NB_ESSAI ] ; do1374 \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11375 status=$?1376 if [ ${status} -gt 0 ]; then1377 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"1378 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."1379 sleep $DELAI1380 else1381 break1382 fi1383 (( i = i + 1 ))1384 done1385 if [ ${status} -gt 0 ] ; then1386 echo "IGCM_sys_Get : error"1387 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1388 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1389 IGCM_debug_Exit "IGCM_sys_GetBuffer"1390 else1391 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1392 fi1393 done1394 else1395 i=01396 while [ $i -lt $NB_ESSAI ] ; do1397 \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11398 status=$?1399 if [ ${status} -gt 0 ]; then1400 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"1401 IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."1402 sleep $DELAI1403 else1404 break1405 fi1406 (( i = i + 1 ))1407 done1408 if [ ${status} -gt 0 ] ; then1409 echo "IGCM_sys_Get : error"1410 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1411 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1412 IGCM_debug_Exit "IGCM_sys_GetBuffer"1413 else1414 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1415 fi1416 fi1417 fi1418 IGCM_debug_PopStack "IGCM_sys_GetBuffer"1419 }1420 1421 #D-#==================================================1422 #D-function IGCM_sys_GetDate_FichWork1423 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK1424 #D-* Examples:1425 #D-1426 function IGCM_sys_GetDate_FichWork {1427 IGCM_debug_PushStack "IGCM_sys_FichWork" $@1428 if ( $DEBUG_sys ) ; then1429 echo "IGCM_sys_GetDate_FichWork :" $@1430 fi1431 1432 if [ $# -ge 3 ] ; then1433 mode=$31434 TimeStyle=$41435 else1436 mode="default"1437 TimeStyle="%Y%m%d%H%M%S"1438 fi1439 1440 typeset dateF1441 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} )1442 1443 case $mode in1444 "default")1445 eval ${2}=${dateF[5]}1446 ;;1447 "SplitFields")1448 eval ${2}="${dateF[5]}\ ${dateF[6]}"1449 ;;1450 esac1451 1452 1453 # donne la date filesys d'un fichier sur la machine work1454 IGCM_debug_PopStack "IGCM_sys_FichWork"1455 }1456 1457 #D-#==================================================1458 #D-function IGCM_sys_GetDate_FichArchive1459 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE1460 #D-* Examples:1461 #D-1462 function IGCM_sys_GetDate_FichArchive {1463 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@1464 if ( $DEBUG_sys ) ; then1465 echo "IGCM_sys_GetDate_FichArchive :" $@1466 fi1467 typeset dateF1468 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )1469 eval ${2}=${dateF[5]}1470 1471 IGCM_debug_PopStack "IGCM_sys_FichArchive"1472 }1473 1474 #D-#==================================================1475 654 #D-function IGCM_sys_GetDate_Monitoring 1476 655 #D-* Purpose: get the last year for which the monitoring has been computed … … 1540 719 fi 1541 720 IGCM_debug_PopStack "IGCM_sys_sync" 1542 }1543 1544 #D-#==================================================1545 #D-function IGCM_sys_rebuild1546 #D-* Purpose: rebuild parallel files1547 #D-* Examples:1548 #D-1549 function IGCM_sys_rebuild {1550 IGCM_debug_PushStack "IGCM_sys_rebuild" $@1551 if ( $DEBUG_sys ) ; then1552 echo "IGCM_sys_rebuild :" $@1553 fi1554 1555 typeset NB_ESSAI DELAI status i firstArg1556 # number of tentative1557 NB_ESSAI=31558 # time delay between tentative1559 DELAI=21560 1561 i=01562 while [ $i -lt $NB_ESSAI ] ; do1563 rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&11564 status=$?1565 if [ ${status} -gt 0 ] ; then1566 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}"1567 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1568 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1569 IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."1570 firstArg=${1}1571 \rm ${firstArg}1572 sleep $DELAI1573 else1574 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$1575 break1576 fi1577 (( i = i + 1 ))1578 done1579 1580 if [ ${status} -gt 0 ] ; then1581 echo "IGCM_sys_rebuild : rebuild error code is ${status}"1582 IGCM_debug_Exit "rebuild"1583 fi1584 1585 IGCM_debug_PopStack "IGCM_sys_rebuild"1586 }1587 1588 #D-#==================================================1589 #D-function IGCM_sys_rebuild_station1590 #D-* Purpose: rebuild parallel files describing station1591 #D-* Examples:1592 #D-1593 function IGCM_sys_rebuild_station {1594 IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@1595 typeset i list_opt file_in file_out prefix_invert list_invert1596 if ( $DEBUG_sys ) ; then1597 echo "IGCM_sys_rebuild_station :" $@1598 fi1599 list_opt=$@1600 1601 # Invert Axis : t,x -> x,t1602 # t,pres,x -> x,t,pres1603 # So that we can concatenate along x1604 i=01605 for file_in in ${list_opt} ; do1606 (( i = i + 1))1607 [ ${i} = 1 ] && file_out=${file_in} && continue1608 # detect time counter and do the job only if present1609 var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')1610 if [ X${var_unlim} = Xtime_counter ] ; then1611 prefix_invert=$( basename ${file_in} .nc )1612 IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc1613 list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc1614 fi1615 done1616 1617 # Concatenate1618 IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc1619 1620 # Re-ivert file1621 IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out}1622 1623 # Station re-ordering is too expansive to be run within libIGCM1624 # This is due to (ncpdq - nrcat - ncpdq) I/O sequence.1625 # This re-ordering must be done "in memory" by the cmorization process1626 # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq)1627 # BEGIN reordering1628 1629 # Only LMDZ text output contains the exact ordering of the station.1630 # We isolate this in the code below:1631 # 0 38 -157.5000000000000 70.985915492957741632 # 0 54 27.49999999999999 67.183098591549281633 # 0 56 -62.50000000000001 82.394366197183091634 # 0 79 12.49999999999999 78.591549295774661635 # 0 116 -165.0000000000000 76.056338028169011636 # 0 117 130.0000000000000 70.985915492957741637 # 0 118 110.0000000000000 87.464788732394371638 # 1 40 4.999999999999995 51.971830985915501639 1640 # typeset iStation iProc list_opt file_in file_out prefix_invert1641 # typeset -Z4 j41642 # typeset -Z3 j31643 1644 # unset list_opt1645 # set +A list_opt $@1646 1647 # Filename after rebuild1648 # file_out=${list_opt[0]}1649 # Prefix of output files1650 # prefix_invert=$( basename ${file_out} .nc )1651 # Number of procs1652 # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l )1653 1654 # iProc=01655 # while [ ${iProc} -lt ${num_proc} ] ; do1656 # Array containing Station as a number1657 # unset proc_stn1658 # 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}' )1659 # Number of stations produced by processor proc1660 # stationLast=${#proc_stn[*]}1661 # Proc number on 4 digits1662 # j4=${iProc}1663 # Init1664 # iStation=01665 # while [ ${iStation} -lt ${stationLast} ] ; do1666 # Station number on 3 digits1667 # j3=${proc_stn[${iStation}]}1668 # Extract station1669 # Invert Axis : t,x -> x,t1670 # t,pres,x -> x,t,pres1671 # So that we can concatenate along x1672 # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc1673 # (( iStation = iStation + 1 ))1674 # done1675 # (( iProc = iProc + 1 ))1676 # done1677 1678 # Concatenate all station along x1679 # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc1680 1681 # Re-invert file1682 # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out}1683 1684 # END reordering1685 1686 IGCM_debug_PopStack "IGCM_sys_rebuild_station"1687 721 } 1688 722 … … 2085 1119 IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" 2086 1120 } 2087 2088 ##############################################################2089 # NCO OPERATOR2090 2091 #D-#==================================================2092 #D-function IGCM_sys_ncap22093 #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry2094 #D-* Examples:2095 #D-2096 function IGCM_sys_ncap2 {2097 IGCM_debug_PushStack "IGCM_sys_ncap2" $@2098 if ( $DEBUG_sys ) ; then2099 echo "IGCM_sys_ncap2 :" $@2100 fi2101 2102 typeset NB_ESSAI DELAI status i2103 # number of tentative2104 NB_ESSAI=32105 # time delay between tentative2106 DELAI=22107 2108 i=02109 while [ $i -lt $NB_ESSAI ] ; do2110 ncap2 -C "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12111 status=$?2112 if [ ${status} -gt 0 ] ; then2113 IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}"2114 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2115 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2116 IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2117 sleep $DELAI2118 else2119 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2120 break2121 fi2122 (( i = i + 1 ))2123 done2124 2125 if [ ${status} -gt 0 ] ; then2126 echo "IGCM_sys_ncap2 : ncap2 error"2127 IGCM_debug_Exit "ncap2"2128 fi2129 2130 IGCM_debug_PopStack "IGCM_sys_ncap2"2131 }2132 2133 #D-#==================================================2134 #D-function IGCM_sys_ncatted2135 #D-* Purpose: encapsulate ncatted call so as to manage error code and retry2136 #D-* Examples:2137 #D-2138 function IGCM_sys_ncatted {2139 IGCM_debug_PushStack "IGCM_sys_ncatted" $@2140 if ( $DEBUG_sys ) ; then2141 echo "IGCM_sys_ncatted :" $@2142 fi2143 2144 typeset NB_ESSAI DELAI status i2145 # number of tentative2146 NB_ESSAI=32147 # time delay between tentative2148 DELAI=22149 2150 i=02151 while [ $i -lt $NB_ESSAI ] ; do2152 ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12153 status=$?2154 if [ ${status} -gt 0 ] ; then2155 IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}"2156 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2157 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2158 IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2159 sleep $DELAI2160 else2161 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2162 break2163 fi2164 (( i = i + 1 ))2165 done2166 2167 if [ ${status} -gt 0 ] ; then2168 echo "IGCM_sys_ncatted : ncatted error"2169 IGCM_debug_Exit "ncatted"2170 fi2171 2172 IGCM_debug_PopStack "IGCM_sys_ncatted"2173 }2174 2175 #D-#==================================================2176 #D-function IGCM_sys_ncbo2177 #D-* Purpose: encapsulate ncbo call so as to manage error code and retry2178 #D-* Examples:2179 #D-2180 function IGCM_sys_ncbo {2181 IGCM_debug_PushStack "IGCM_sys_ncbo" $@2182 if ( $DEBUG_sys ) ; then2183 echo "IGCM_sys_ncbo :" $@2184 fi2185 2186 typeset NB_ESSAI DELAI status i2187 # number of tentative2188 NB_ESSAI=32189 # time delay between tentative2190 DELAI=22191 2192 i=02193 while [ $i -lt $NB_ESSAI ] ; do2194 ncbo -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12195 status=$?2196 if [ ${status} -gt 0 ] ; then2197 IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}"2198 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2199 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2200 IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2201 sleep $DELAI2202 else2203 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2204 break2205 fi2206 (( i = i + 1 ))2207 done2208 2209 if [ ${status} -gt 0 ] ; then2210 echo "IGCM_sys_ncbo : ncbo error"2211 IGCM_debug_Exit "ncbo"2212 fi2213 2214 IGCM_debug_PopStack "IGCM_sys_ncbo"2215 }2216 2217 #D-#==================================================2218 #D-function IGCM_sys_ncdif2219 #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry2220 #D-* Examples:2221 #D-2222 function IGCM_sys_ncdiff {2223 IGCM_debug_PushStack "IGCM_sys_ncdiff" $@2224 if ( $DEBUG_sys ) ; then2225 echo "IGCM_sys_ncdiff :" $@2226 fi2227 2228 typeset NB_ESSAI DELAI status i2229 # number of tentative2230 NB_ESSAI=32231 # time delay between tentative2232 DELAI=22233 2234 i=02235 while [ $i -lt $NB_ESSAI ] ; do2236 ncdiff -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12237 status=$?2238 if [ ${status} -gt 0 ] ; then2239 IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}"2240 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2241 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2242 IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2243 sleep $DELAI2244 else2245 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2246 break2247 fi2248 (( i = i + 1 ))2249 done2250 2251 if [ ${status} -gt 0 ] ; then2252 echo "IGCM_sys_ncdiff : ncdiff error"2253 IGCM_debug_Exit "ncdiff"2254 fi2255 2256 IGCM_debug_PopStack "IGCM_sys_ncdiff"2257 }2258 2259 #D-#==================================================2260 #D-function IGCM_sys_ncea2261 #D-* Purpose: encapsulate ncea call so as to manage error code and retry2262 #D-* Examples:2263 #D-2264 function IGCM_sys_ncea {2265 IGCM_debug_PushStack "IGCM_sys_ncea" $@2266 if ( $DEBUG_sys ) ; then2267 echo "IGCM_sys_ncea :" $@2268 fi2269 2270 typeset NB_ESSAI DELAI status i2271 # number of tentative2272 NB_ESSAI=32273 # time delay between tentative2274 DELAI=22275 2276 i=02277 while [ $i -lt $NB_ESSAI ] ; do2278 ncea -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12279 status=$?2280 if [ ${status} -gt 0 ] ; then2281 IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}"2282 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2283 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2284 IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2285 sleep $DELAI2286 else2287 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2288 break2289 fi2290 (( i = i + 1 ))2291 done2292 2293 if [ ${status} -gt 0 ] ; then2294 echo "IGCM_sys_ncea : ncea error"2295 IGCM_debug_Exit "ncea"2296 fi2297 2298 IGCM_debug_PopStack "IGCM_sys_ncea"2299 }2300 2301 #D-#==================================================2302 #D-function IGCM_sys_ncecat2303 #D-* Purpose: encapsulate ncecat call so as to manage error code and retry2304 #D-* Examples:2305 #D-2306 function IGCM_sys_ncecat {2307 IGCM_debug_PushStack "IGCM_sys_ncecat" $@2308 if ( $DEBUG_sys ) ; then2309 echo "IGCM_sys_ncecat :" $@2310 fi2311 2312 typeset NB_ESSAI DELAI status i2313 # number of tentative2314 NB_ESSAI=32315 # time delay between tentative2316 DELAI=22317 2318 i=02319 while [ $i -lt $NB_ESSAI ] ; do2320 ncecat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12321 status=$?2322 if [ ${status} -gt 0 ] ; then2323 IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}"2324 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2325 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2326 IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2327 sleep $DELAI2328 else2329 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2330 break2331 fi2332 (( i = i + 1 ))2333 done2334 2335 if [ ${status} -gt 0 ] ; then2336 echo "IGCM_sys_ncecat : ncecat error"2337 IGCM_debug_Exit "ncecat"2338 fi2339 2340 IGCM_debug_PopStack "IGCM_sys_ncecat"2341 }2342 2343 #D-#==================================================2344 #D-function IGCM_sys_ncflint2345 #D-* Purpose: encapsulate ncflint call so as to manage error code and retry2346 #D-* Examples:2347 #D-2348 function IGCM_sys_ncflint {2349 IGCM_debug_PushStack "IGCM_sys_ncflint" $@2350 if ( $DEBUG_sys ) ; then2351 echo "IGCM_sys_ncflint :" $@2352 fi2353 2354 typeset NB_ESSAI DELAI status i2355 # number of tentative2356 NB_ESSAI=32357 # time delay between tentative2358 DELAI=22359 2360 i=02361 while [ $i -lt $NB_ESSAI ] ; do2362 ncflint -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12363 status=$?2364 if [ ${status} -gt 0 ] ; then2365 IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}"2366 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2367 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2368 IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2369 sleep $DELAI2370 else2371 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2372 break2373 fi2374 (( i = i + 1 ))2375 done2376 2377 if [ ${status} -gt 0 ] ; then2378 echo "IGCM_sys_ncflint : ncflint error"2379 IGCM_debug_Exit "ncflint"2380 fi2381 2382 IGCM_debug_PopStack "IGCM_sys_ncflint"2383 }2384 2385 #D-#==================================================2386 #D-function IGCM_sys_ncks2387 #D-* Purpose: encapsulate ncks call so as to manage error code and retry2388 #D-* Examples:2389 #D-2390 function IGCM_sys_ncks {2391 IGCM_debug_PushStack "IGCM_sys_ncks" $@2392 if ( $DEBUG_sys ) ; then2393 echo "IGCM_sys_ncks :" $@2394 fi2395 2396 typeset NB_ESSAI DELAI status i2397 # number of tentative2398 NB_ESSAI=32399 # time delay between tentative2400 DELAI=22401 2402 i=02403 while [ $i -lt $NB_ESSAI ] ; do2404 ncks -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12405 status=$?2406 if [ ${status} -gt 0 ] ; then2407 IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}"2408 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2409 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2410 IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2411 sleep $DELAI2412 else2413 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2414 break2415 fi2416 (( i = i + 1 ))2417 done2418 2419 if [ ${status} -gt 0 ] ; then2420 echo "IGCM_sys_ncks : ncks error"2421 IGCM_debug_Exit "ncks"2422 fi2423 2424 IGCM_debug_PopStack "IGCM_sys_ncks"2425 }2426 2427 #D-#==================================================2428 #D-function IGCM_sys_ncpdq2429 #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry2430 #D-* Examples:2431 #D-2432 function IGCM_sys_ncpdq {2433 IGCM_debug_PushStack "IGCM_sys_ncpdq" $@2434 if ( $DEBUG_sys ) ; then2435 echo "IGCM_sys_ncpdq :" $@2436 fi2437 2438 typeset NB_ESSAI DELAI status i2439 # number of tentative2440 NB_ESSAI=32441 # time delay between tentative2442 DELAI=22443 2444 i=02445 while [ $i -lt $NB_ESSAI ] ; do2446 ncpdq -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12447 status=$?2448 if [ ${status} -gt 0 ] ; then2449 IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}"2450 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2451 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2452 IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2453 sleep $DELAI2454 else2455 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2456 break2457 fi2458 (( i = i + 1 ))2459 done2460 2461 if [ ${status} -gt 0 ] ; then2462 echo "IGCM_sys_ncpdq : ncpdq error"2463 IGCM_debug_Exit "ncpdq"2464 fi2465 2466 IGCM_debug_PopStack "IGCM_sys_ncpdq"2467 }2468 2469 #D-#==================================================2470 #D-function IGCM_sys_ncra2471 #D-* Purpose: encapsulate ncra call so as to manage error code and retry2472 #D-* Examples:2473 #D-2474 function IGCM_sys_ncra {2475 IGCM_debug_PushStack "IGCM_sys_ncra" $@2476 if ( $DEBUG_sys ) ; then2477 echo "IGCM_sys_ncra :" $@2478 fi2479 2480 typeset NB_ESSAI DELAI status i2481 # number of tentative2482 NB_ESSAI=32483 # time delay between tentative2484 DELAI=22485 2486 i=02487 while [ $i -lt $NB_ESSAI ] ; do2488 ncra -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12489 status=$?2490 if [ ${status} -gt 0 ] ; then2491 IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}"2492 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2493 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2494 IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2495 sleep $DELAI2496 else2497 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2498 break2499 fi2500 (( i = i + 1 ))2501 done2502 2503 if [ ${status} -gt 0 ] ; then2504 echo "IGCM_sys_ncra : ncra error"2505 IGCM_debug_Exit "ncra"2506 fi2507 2508 IGCM_debug_PopStack "IGCM_sys_ncra"2509 }2510 2511 #D-#==================================================2512 #D-function IGCM_sys_ncrcat2513 #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry2514 #D-* Examples:2515 #D-2516 function IGCM_sys_ncrcat {2517 IGCM_debug_PushStack "IGCM_sys_ncrcat" $@2518 if ( $DEBUG_sys ) ; then2519 echo "IGCM_sys_ncrcat :" $@2520 fi2521 2522 typeset NB_ESSAI DELAI status i lastArg2523 # number of tentative2524 NB_ESSAI=32525 # time delay between tentative2526 DELAI=22527 2528 i=02529 while [ $i -lt $NB_ESSAI ] ; do2530 ncrcat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12531 status=$?2532 if [ ${status} -gt 0 ] ; then2533 IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}"2534 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2535 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2536 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2537 sleep $DELAI2538 elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] ; then2539 IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity"2540 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2541 # remove files having corrupted time axis2542 eval lastArg=\${$#}2543 IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}"2544 \rm ${lastArg}2545 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2546 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2547 sleep $DELAI2548 else2549 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2550 break2551 fi2552 (( i = i + 1 ))2553 done2554 2555 if [ ${status} -gt 0 ] ; then2556 echo "IGCM_sys_ncrcat : ncrcat error"2557 #IGCM_debug_Exit "ncrcat"2558 fi2559 2560 IGCM_debug_PopStack "IGCM_sys_ncrcat"2561 }2562 2563 #D-#==================================================2564 #D-function IGCM_sys_ncrename2565 #D-* Purpose: encapsulate ncrename call so as to manage error code and retry2566 #D-* Examples:2567 #D-2568 function IGCM_sys_ncrename {2569 IGCM_debug_PushStack "IGCM_sys_ncrename" $@2570 if ( $DEBUG_sys ) ; then2571 echo "IGCM_sys_ncrename :" $@2572 fi2573 2574 typeset NB_ESSAI DELAI status i2575 # number of tentative2576 NB_ESSAI=32577 # time delay between tentative2578 DELAI=22579 2580 i=02581 while [ $i -lt $NB_ESSAI ] ; do2582 ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12583 status=$?2584 if [ ${status} -gt 0 ] ; then2585 IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}"2586 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2587 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2588 IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2589 sleep $DELAI2590 else2591 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2592 break2593 fi2594 (( i = i + 1 ))2595 done2596 2597 if [ ${status} -gt 0 ] ; then2598 echo "IGCM_sys_ncrename : ncrename error"2599 IGCM_debug_Exit "ncrename"2600 fi2601 2602 IGCM_debug_PopStack "IGCM_sys_ncrename"2603 }2604 2605 #D-#==================================================2606 #D-function IGCM_sys_ncwa2607 #D-* Purpose: encapsulate ncwa call so as to manage error code and retry2608 #D-* Examples:2609 #D-2610 function IGCM_sys_ncwa {2611 IGCM_debug_PushStack "IGCM_sys_ncwa" $@2612 if ( $DEBUG_sys ) ; then2613 echo "IGCM_sys_ncwa :" $@2614 fi2615 2616 typeset NB_ESSAI DELAI status i2617 # number of tentative2618 NB_ESSAI=32619 # time delay between tentative2620 DELAI=22621 2622 i=02623 while [ $i -lt $NB_ESSAI ] ; do2624 ncwa -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12625 status=$?2626 if [ ${status} -gt 0 ] ; then2627 IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}"2628 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2629 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2630 IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."2631 sleep $DELAI2632 else2633 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2634 break2635 fi2636 (( i = i + 1 ))2637 done2638 2639 if [ ${status} -gt 0 ] ; then2640 echo "IGCM_sys_ncwa : ncwa error"2641 IGCM_debug_Exit "ncwa"2642 fi2643 2644 IGCM_debug_PopStack "IGCM_sys_ncwa"2645 }2646 2647 ##############################################################2648 # CDO OPERATOR2649 2650 #D-#==================================================2651 #D-function IGCM_sys_cdo2652 #D-* Purpose: encapsulate cdo call so as to manage error code and retry2653 #D-* Examples:2654 #D-2655 function IGCM_sys_cdo {2656 IGCM_debug_PushStack "IGCM_sys_cdo" $@2657 if ( $DEBUG_sys ) ; then2658 echo "IGCM_sys_cdo :" $@2659 fi2660 2661 typeset status2662 2663 \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&12664 status=$?2665 if [ ${status} -gt 0 ] ; then2666 echo "IGCM_sys_cdo : error code ${status}"2667 cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2668 \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$2669 IGCM_debug_PopStack "IGCM_sys_cdo"2670 return 12671 else2672 IGCM_debug_PopStack "IGCM_sys_cdo"2673 return 02674 fi2675 2676 IGCM_debug_PopStack "IGCM_sys_cdo"2677 }
Note: See TracChangeset
for help on using the changeset viewer.