source: trunk/libIGCM/AA_purge_simulation

Last change on this file was 1633, checked in by ssenesi, 2 months ago

Manage CesmpInputFrequency?, plus small fixes

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