[1709] | 1 | #!/bin/bash |
---|
| 2 | ###################### |
---|
| 3 | ## TITANE CEA ## |
---|
| 4 | ###################### |
---|
| 5 | #MSUB -r ipsl_pack # Nom du job |
---|
| 6 | #MSUB -eo |
---|
| 7 | #MSUB -n 1 # Reservation du processus |
---|
| 8 | #MSUB -T 86400 # Limite de temps elapsed du job |
---|
| 9 | #MSUB -p gen2211 |
---|
| 10 | #MSUB -q mono |
---|
| 11 | |
---|
[1727] | 12 | # ex : ./launch_ipsl_pack.sh fichier_param_test1.txt |
---|
| 13 | # ex : ./launch_ipsl_pack.sh param_SL.txt |
---|
| 14 | # ex : ./launch_ipsl_pack.sh param_OM.txt |
---|
[1709] | 15 | |
---|
[1875] | 16 | # Est-on sur ulam (machine de l'IDRIS) ? |
---|
| 17 | is_idris_machine=`hostname | grep "ulam" | wc -l ` |
---|
| 18 | ON_IDRIS="no" |
---|
| 19 | if [ "x${is_idris_machine}" != "x0" ] |
---|
| 20 | then |
---|
| 21 | ON_IDRIS="yes" |
---|
| 22 | fi |
---|
| 23 | export ON_IDRIS=${ON_IDRIS} |
---|
| 24 | |
---|
[1822] | 25 | ##### gpdebug : addition ################################## |
---|
| 26 | # Boucle qui gere les parametres du script (permet l'introduction d'une option -f |
---|
| 27 | # qui force l'execution de toute les etapes du script de listes) |
---|
| 28 | execEveryStep=0 |
---|
[1900] | 29 | LISTE_SIMUL_ARG= |
---|
[1822] | 30 | while [ $# -gt 0 ] |
---|
| 31 | do |
---|
| 32 | echo "boucle sur les arguments du script ..." |
---|
| 33 | echo "@=$@" |
---|
| 34 | case $1 in |
---|
| 35 | -f) execEveryStep=1 |
---|
| 36 | echo "force..." |
---|
| 37 | ;; |
---|
[1900] | 38 | *) LISTE_SIMUL_ARG=${1} |
---|
[1822] | 39 | echo "autres..." |
---|
| 40 | ;; |
---|
| 41 | esac |
---|
| 42 | shift |
---|
| 43 | done |
---|
| 44 | export execEveryStep=${execEveryStep} |
---|
[1900] | 45 | |
---|
| 46 | SCRIPT_NAME=$(basename ${0} ) |
---|
| 47 | |
---|
| 48 | # On renseigne les variables d'environnement |
---|
| 49 | export scriptCallingLoad=$SCRIPT_NAME # sert a renseigner "load_ipslPack_env.sh" sur le script l'appelant |
---|
| 50 | . load_ipslPack_env.sh |
---|
| 51 | |
---|
| 52 | if [ "x${LISTE_SIMUL_ARG}" == "x" ] |
---|
[1864] | 53 | then |
---|
[1900] | 54 | if [ -f /ccc/work/cont003/dsm/p86ipsl/PARAM_USER_IPSL/$USER.txt ] |
---|
| 55 | then |
---|
| 56 | echo "The file used is /ccc/work/cont003/dsm/p86ipsl/PARAM_USER_IPSL/$USER.txt" |
---|
| 57 | LISTE_SIMUL="/ccc/work/cont003/dsm/p86ipsl/PARAM_USER_IPSL/$USER.txt" |
---|
| 58 | else |
---|
| 59 | echo "Vous devez passer un fichier en parametre" |
---|
| 60 | exit 1 |
---|
| 61 | fi |
---|
| 62 | else |
---|
| 63 | LISTE_SIMUL=${LISTE_SIMUL_ARG} |
---|
[1864] | 64 | fi |
---|
[1709] | 65 | |
---|
[1900] | 66 | LISTE_SIMUL_NAME=$(basename ${LISTE_SIMUL} ) |
---|
[1822] | 67 | # fichier de progression d'execution |
---|
[1849] | 68 | ficParam=$( basename ${LISTE_SIMUL} ) # gpdebug : modif ici et ligne d'apres |
---|
| 69 | extSuiviListes=`echo ${ficParam} | sed 's;\.[[:alnum:]]*$;;' ` |
---|
[1822] | 70 | # echo "extSuiviListes=$extSuiviListes" # gpdebug : a virer |
---|
[1900] | 71 | #export MonitoringDir="${TMP_MIGR_DATA}/SuiviListes_${extSuiviListes}" |
---|
[1822] | 72 | # echo "MonitoringDir=$MonitoringDir" # gpdebug : a virer |
---|
| 73 | # exit 0 # gpdebug : a virer |
---|
| 74 | |
---|
[1900] | 75 | #export generalMonitorFile=${MonitoringDir}/general.txt |
---|
| 76 | #export nbSimuFile=${MonitoringDir}/nbSimu.txt |
---|
[1822] | 77 | |
---|
| 78 | ##### gpdebug : fin ##################################### |
---|
| 79 | |
---|
| 80 | # LISTE_SIMUL=${1} # gpdebug : suppr --> cette affectation est maintenant faite dans la boucle while des arg du script ################ |
---|
| 81 | |
---|
[1709] | 82 | #LISTE_SIMUL=${JOB_DIR}/param_SL.txt |
---|
| 83 | #LISTE_DMNFS=${JOB_DIR}/SL_information_dmnfs_2012-03-21 |
---|
| 84 | |
---|
| 85 | # LISTE_SIMUL=${JOB_DIR}/param_OM.txt |
---|
| 86 | # LISTE_DMNFS=${JOB_DIR}/OM_information_dmnfs_2012-03-21 |
---|
| 87 | |
---|
[1900] | 88 | #LISTE_SIMUL_NAME=$(basename ${LISTE_SIMUL} ) |
---|
| 89 | #SCRIPT_NAME=$(basename ${0} ) |
---|
[1709] | 90 | |
---|
[1859] | 91 | # On renseigne les variables d'environnement |
---|
[1900] | 92 | #export scriptCallingLoad=$SCRIPT_NAME # sert a renseigner "load_ipslPack_env.sh" sur le script l'appelant |
---|
[1853] | 93 | |
---|
[1900] | 94 | #. load_ipslPack_env.sh |
---|
| 95 | |
---|
| 96 | export JOB_DIR=${TMP_MIGR_DATA} |
---|
| 97 | export EXE_DIR=${LS_SUBCWD:-${PWD}} |
---|
| 98 | |
---|
| 99 | # echo "extSuiviListes=$extSuiviListes" # gpdebug : a virer |
---|
| 100 | export MonitoringDir="${TMP_MIGR_DATA}/SuiviListes_${extSuiviListes}" |
---|
| 101 | # echo "MonitoringDir=$MonitoringDir" # gpdebug : a virer |
---|
| 102 | # exit 0 # gpdebug : a virer |
---|
| 103 | |
---|
| 104 | export generalMonitorFile=${MonitoringDir}/general.txt |
---|
| 105 | export nbSimuFile=${MonitoringDir}/nbSimu.txt |
---|
| 106 | |
---|
| 107 | |
---|
[1863] | 108 | if [ "x${IGCM_DEM}" == "x" ] |
---|
| 109 | then |
---|
| 110 | echo "variable IGCM_DEM non renseignee. STOP." |
---|
| 111 | exit 1 |
---|
| 112 | fi |
---|
| 113 | # rm -f ${IGCM_DEM}/Listing.txt # gpdebug : en cas de reprise, on ne peut pas laisser ca en l'etat --> suppr |
---|
| 114 | # gpdebug : Donc on rajoute le if qui suit |
---|
| 115 | if [ "x${execEveryStep}" == "x1" ] |
---|
| 116 | then |
---|
| 117 | echo "Destruction du repertoire :" |
---|
| 118 | echo "${IGCM_DEM}" |
---|
| 119 | rm -rf ${IGCM_DEM} |
---|
| 120 | fi |
---|
| 121 | |
---|
[1853] | 122 | export IGCM_TMP="${IGCM_DEM}/tmp" # gpdebug : added |
---|
| 123 | # INPUT_DMF_DATA, positionnee par le load_ipslPack_env.sh, sert pour pour PATH_SIMUL_SHORT dans create_config_card.sh |
---|
| 124 | |
---|
[1709] | 125 | export clean_tmp=${clean_tmp:-yes} |
---|
| 126 | export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log |
---|
| 127 | export LOG_LEV=2 |
---|
[1822] | 128 | export FileParam=${LISTE_SIMUL} # gpdebug : pour appel (dans DEM_utilities.sh) a showListsProgress.sh |
---|
| 129 | export FatherPID=$$ # gpdebug : pour appel (dans DEM_utilities.sh) a showListsProgress.sh |
---|
[1709] | 130 | |
---|
| 131 | source ${EXE_DIR}/DEM_utilities.sh |
---|
| 132 | |
---|
[1822] | 133 | # gpdebug : prepare le fichier de suivi de la progression |
---|
| 134 | prepareMonitoringDir |
---|
| 135 | |
---|
| 136 | # gpdebug : Execute la function errorReceive() si reception d'un signal TERM |
---|
| 137 | trap 'DEM_errorReceive' TERM ######## |
---|
| 138 | |
---|
| 139 | # gpdebug : liste des processus à détruire en cas d'erreur bloquante |
---|
| 140 | export listPID=$$ ######## |
---|
| 141 | |
---|
| 142 | # gpdebug : fichier pour la transmission des messages d'erreur d'un fils au prog principal |
---|
[1900] | 143 | export errorMsgFile="${TMP_MIGR_DATA}/errorMsg.txt" ######## |
---|
[1822] | 144 | |
---|
[1709] | 145 | DEM_log -0 "Demarrage de ${SCRIPT_NAME}" |
---|
| 146 | |
---|
| 147 | mkdir -p ${IGCM_DEM} |
---|
| 148 | mkdir -p ${IGCM_TMP} |
---|
| 149 | |
---|
| 150 | rm -rf ${IGCM_TMP}/tmp/* |
---|
| 151 | rm -f ${DEM_LOG} |
---|
| 152 | |
---|
[1713] | 153 | # 0- on cree le listing correspondant au fichier param |
---|
| 154 | # on efface les tests precedents |
---|
[1822] | 155 | |
---|
[1900] | 156 | for DIR in $( awk '{print $0}' ${LISTE_SIMUL} ) ; do |
---|
| 157 | eval DIR_FINAL=$DIR |
---|
| 158 | ./create_listing.sh $DIR_FINAL |
---|
[1713] | 159 | done |
---|
| 160 | |
---|
| 161 | LISTE_DMNFS=${IGCM_DEM}/Listing.txt |
---|
| 162 | |
---|
[1709] | 163 | # 1- A partir de param_list - on recherche l'ensemble des simulations a packer |
---|
| 164 | # la liste creee (liste_simul_$1) est stockee dans $SCRATCHDIR/IGCM_DEM |
---|
| 165 | |
---|
| 166 | ${EXE_DIR}/find_directory_simul.sh ${LISTE_SIMUL} ${LISTE_DMNFS} |
---|
| 167 | |
---|
[1822] | 168 | # sleep 2 # gpdebug : a virer |
---|
| 169 | # echo "Le script principal continue..." # gpdebug : a virer |
---|
| 170 | # exit 0 # gpdebug : a virer |
---|
| 171 | |
---|
| 172 | #################################################################### |
---|
| 173 | # gpdebug : partie vidée pour simplifier. Voir le fichier original. |
---|
| 174 | |
---|
[1709] | 175 | # 2- Pour chacune des simulations listees on cree un fichier config.card correspondant |
---|
| 176 | # ces fichiers seront stockes dans ${IGCM_DEM}/arborescence/ |
---|
| 177 | # un fichier recapitulatif des fichiers config.card (config_card.liste) crees sera stocke dans ${IGCM_DEM} |
---|
| 178 | |
---|
[1717] | 179 | ${EXE_DIR}/create_config_card.sh ${IGCM_DEM}/liste_simul_${LISTE_SIMUL_NAME} ${LISTE_DMNFS} |
---|
[1709] | 180 | |
---|
[1822] | 181 | # exit 0 # gpdebug : a virer ######### |
---|
| 182 | |
---|
[1709] | 183 | #3- recherche de la taille ideale de pack pour chacune des simulations - puis creation des listes |
---|
| 184 | |
---|
| 185 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
| 186 | |
---|
[1714] | 187 | DEM_log -2 ${CONFIG} |
---|
[1709] | 188 | |
---|
| 189 | eval $(grep IGCM_DEM_SIMU ${CONFIG}) |
---|
| 190 | ${EXE_DIR}/calcul_size_simul.sh ${CONFIG} ${LISTE_DMNFS} |
---|
[1822] | 191 | # exit 0 # gpdebug : a virer ######### |
---|
[1714] | 192 | DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} ) |
---|
| 193 | if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then |
---|
| 194 | |
---|
| 195 | DEM_log -3 "la simulation est superieur a 1Go alors on pack" |
---|
[1709] | 196 | ${EXE_DIR}/find_size_pack.sh ${CONFIG} ${LISTE_DMNFS} |
---|
| 197 | ${EXE_DIR}/write_liste_pack.sh ${CONFIG} ${LISTE_DMNFS} |
---|
[1728] | 198 | ${EXE_DIR}/archive_restart.sh ${CONFIG} ${LISTE_DMNFS} |
---|
[1822] | 199 | # DEM_errorSend "${SCRIPT_NAME}:${LINENO}:On arrete expres !" # gpdebug : a virer ######## |
---|
[1728] | 200 | ${EXE_DIR}/archive_debug.sh ${CONFIG} ${LISTE_DMNFS} |
---|
[1714] | 201 | |
---|
[1709] | 202 | fi |
---|
| 203 | done |
---|
[1822] | 204 | #################################################################### |
---|
[1709] | 205 | |
---|
| 206 | DEM_log -0 "Fin de ${SCRIPT_NAME}" |
---|