[1355] | 1 | #!/bin/ksh |
---|
| 2 | #************************************************************** |
---|
| 3 | # Author: Sebastien Denvil |
---|
| 4 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 5 | # $Revision:: $ Revision of last commit |
---|
| 6 | # $Author:: $ Author of last commit |
---|
| 7 | # $Date:: $ Date of last commit |
---|
| 8 | # IPSL (2006) |
---|
| 9 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 10 | # |
---|
| 11 | #************************************************************** |
---|
| 12 | # ID of your genci project. Curie only : post-processing jobs need it to run properly |
---|
| 13 | #-Q- curie export BRIDGE_MSUB_PROJECT=::default_project:: |
---|
[1437] | 14 | #-Q- irene export BRIDGE_MSUB_PROJECT=::default_project:: |
---|
[1355] | 15 | |
---|
| 16 | #set -eu |
---|
| 17 | #set -vx |
---|
| 18 | |
---|
| 19 | libIGCM=::modipsl::/libIGCM |
---|
| 20 | |
---|
[1356] | 21 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
[1355] | 22 | TaskType=checking |
---|
| 23 | |
---|
| 24 | #D--------------------------------------------------------------------== |
---|
| 25 | #D- -1. User modification place |
---|
| 26 | #D--------------------------------------------------------------------== |
---|
| 27 | |
---|
| 28 | #D- Increased verbosity (1, 2, 3) |
---|
| 29 | Verbosity=3 |
---|
| 30 | |
---|
[1378] | 31 | #D- Low level debug : to perform lib test checks, stack construction and IO functions instrumentation |
---|
[1355] | 32 | #D- Default=true |
---|
[1378] | 33 | DEBUG_debug=true |
---|
[1355] | 34 | |
---|
[1378] | 35 | #D- Messaging : all activities and call stacks will be sent to ipsl servers |
---|
| 36 | #D- If true will imply DEBUG_debug=true |
---|
| 37 | #D- Default=false |
---|
| 38 | #D- |
---|
| 39 | BigBrother=true |
---|
| 40 | |
---|
| 41 | |
---|
[1355] | 42 | #D--------------------------------------------------------------------== |
---|
| 43 | |
---|
| 44 | echo "purge an entire simulation :" |
---|
| 45 | echo "Script used to purge a simulation from the IGCM_OUT directory !" |
---|
| 46 | echo "This script will completely wipe out your simulation and will erase all files !!!" |
---|
| 47 | echo "Be careful and read all informations !" |
---|
| 48 | echo "----" |
---|
| 49 | echo "It must be called in Experience directory (so-called SUBMIT_DIR)." |
---|
| 50 | echo "----" |
---|
| 51 | |
---|
| 52 | #D--------------------------------------------------------------------== |
---|
| 53 | |
---|
| 54 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 55 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
| 56 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
| 57 | #------- |
---|
| 58 | SUBMIT_DIR=$( pwd ) |
---|
| 59 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 60 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
| 61 | #------- |
---|
| 62 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
| 63 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
| 64 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
| 65 | |
---|
[1392] | 66 | if [ ! -f ${SUBMIT_DIR}/config.card ] ; then |
---|
| 67 | echo "A config.card is needed to proceed" |
---|
| 68 | exit |
---|
| 69 | fi |
---|
| 70 | |
---|
[1403] | 71 | if [ ! -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 72 | echo "A run.card is needed to proceed" |
---|
| 73 | exit |
---|
| 74 | fi |
---|
| 75 | |
---|
[1355] | 76 | #================================== |
---|
| 77 | # First of all |
---|
| 78 | # |
---|
| 79 | # Read libIGCM compatibility version in config.card |
---|
| 80 | # Read UserChoices section |
---|
| 81 | # Read Ensemble section |
---|
| 82 | # Read Post section |
---|
| 83 | # Define all netcdf output directories |
---|
| 84 | #================================== |
---|
| 85 | IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card |
---|
| 86 | |
---|
| 87 | # ------------------------------------------------------------------ |
---|
| 88 | # Activate BigBrother so as to supervise this simulation |
---|
| 89 | # ------------------------------------------------------------------ |
---|
| 90 | IGCM_debug_BigBro_Initialize |
---|
| 91 | |
---|
| 92 | # List whats need to be done |
---|
| 93 | echo "Search directories in ${R_SAVE}" |
---|
| 94 | set +A ListDirectories -- $( IGCM_sys_RshArchive "find ${R_SAVE} ${R_BUFR} ${R_FIGR} -type d | sort | uniq" ) |
---|
| 95 | CountListDirectories=${#ListDirectories[@]} |
---|
| 96 | |
---|
| 97 | # And proceed |
---|
| 98 | if [ ${CountListDirectories} -gt 0 ] ; then |
---|
| 99 | for dir in ${ListDirectories[@]} ; do |
---|
| 100 | IGCM_debug_Print 2 -e "\033[1;31m ${dir}\033[m" |
---|
| 101 | done |
---|
[1376] | 102 | IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/run.card\033[m" |
---|
| 103 | IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Debug\033[m" |
---|
| 104 | IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Script_Output_*.??????\033[m" |
---|
[1355] | 105 | |
---|
[1402] | 106 | echo -e "\033[1;32mDo you REALLY want to erase all those directories and files?\033[m" |
---|
| 107 | echo -n " Your answer (y/n) :" |
---|
[1355] | 108 | read reponse |
---|
| 109 | case ${reponse} in |
---|
| 110 | |
---|
| 111 | oui|OUI|o|y|yes|YES) |
---|
[1401] | 112 | |
---|
| 113 | ERASE=FALSE |
---|
| 114 | if [ X${config_UserChoices_SpaceName} = XTEST ] ; then |
---|
| 115 | ERASE=TRUE |
---|
| 116 | else |
---|
[1402] | 117 | echo -e "\033[1;32mPlease type in the exact Job Name of the simulation to erase?\033[m" |
---|
[1401] | 118 | read jobname |
---|
[1402] | 119 | if [ X${config_UserChoices_JobName} = X${jobname} ] ; then |
---|
[1401] | 120 | ERASE=TRUE |
---|
[1402] | 121 | else |
---|
| 122 | echo "JobName you gave and the one from config.card do not match. Stop here." |
---|
[1401] | 123 | fi |
---|
| 124 | fi |
---|
| 125 | |
---|
| 126 | if [ X${ERASE} = XTRUE ] ; then |
---|
| 127 | echo "OK. It will be erased." |
---|
| 128 | for dir in ${ListDirectories[@]} ; do |
---|
| 129 | IGCM_sys_RshArchive rm -rf ${dir} |
---|
| 130 | done |
---|
| 131 | # Remove dods hardlink |
---|
| 132 | IGCM_sys_Dods_Rm |
---|
| 133 | # Remove run.card |
---|
| 134 | rm -f ${SUBMIT_DIR}/run.card |
---|
| 135 | # Remove Script_Output |
---|
| 136 | rm -f ${SUBMIT_DIR}/Script_Output_*.?????? |
---|
| 137 | # Remove the Debug directory |
---|
| 138 | rm -rf ${SUBMIT_DIR}/Debug |
---|
| 139 | # Send a message telling we want to purge |
---|
| 140 | IGCM_debug_sendAMQP_Purge |
---|
| 141 | echo "done." |
---|
[1483] | 142 | |
---|
| 143 | # Add reset of counter for Script_Output in the main Job |
---|
| 144 | Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} |
---|
| 145 | Script_Output_Job=${Script_Output_Prefix}_${config_UserChoices_JobName} |
---|
| 146 | Script_Output=${Script_Output_Prefix}_${config_UserChoices_JobName}.000001 |
---|
| 147 | |
---|
| 148 | echo -e "\033[1;32mDo you want to change the number in Script_Output? (${Script_Output} into Job) ?" |
---|
| 149 | echo -n -e " Your answer (y/n) : \033[m" |
---|
| 150 | read reponse |
---|
| 151 | case ${reponse} in |
---|
| 152 | |
---|
| 153 | oui|OUI|o|y|yes|YES) |
---|
| 154 | cp ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}_SAVED_$$ |
---|
| 155 | sed -e"s/${Script_Output_Job}.[0-9][0-9][0-9][0-9][0-9][0-9]/${Script_Output}/" ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}_SAVED_$$ >${SUBMIT_DIR}/Job_${config_UserChoices_JobName} |
---|
| 156 | echo "Job : Job_${config_UserChoices_JobName} modified." |
---|
| 157 | echo "Old job saved here : Job_${config_UserChoices_JobName}_SAVED_$$" |
---|
| 158 | ;; |
---|
| 159 | non|NON|n|no|NO) |
---|
| 160 | echo "Nothing done in Job_${config_UserChoices_JobName} !" |
---|
| 161 | ;; |
---|
| 162 | esac |
---|
| 163 | |
---|
[1401] | 164 | fi |
---|
[1355] | 165 | ;; |
---|
| 166 | non|NON|n|no|NO) |
---|
| 167 | echo "Nothing to do !" |
---|
| 168 | ;; |
---|
| 169 | esac |
---|
| 170 | fi |
---|
| 171 | |
---|
| 172 | exit 0 |
---|