source: TOOLS/SURPACK_IPSL/SaveNewSimuPack.sh @ 2160

Last change on this file since 2160 was 2160, checked in by acosce, 11 years ago

Some update on surpack tools

1) add a script to move new pack on store and remove old simulation after checking results
2) make some improvement on launch_ipsl_pack.sh and other scripts

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#!/bin/bash
2
3
4# 1- faire un mv de la simu d'origine en JobName.BF (BF = Before Pack)
5# 2- copier sur le store la simu repackee sur Pseudo_dmnfs_store
6# 3- effacer dans JobName_BF les fichiers contenus dans les listes correctement traitees
7
8#----------------------------------------------------------------
9#----------------------------------------------------------------
10# On renseigne les variables d'environnement
11. load_ipslPack_env.sh
12
13export JOB_DIR=${TMP_MIGR_DATA}
14export EXE_DIR=${LS_SUBCWD:-${PWD}}
15
16SCRIPT_NAME=$(basename ${0} )
17
18export IGCM_TMP="${IGCM_DEM}/tmp"  # gpdebug : added
19
20export config_card=${IGCM_DEM}/config_card.liste
21
22source ${EXE_DIR}/DEM_utilities.sh
23#----------------------------------------------------------------
24#----------------------------------------------------------------
25
26# Gestion de l'option de lancement
27# si -R --> alors on active le stockage sur le store et le remove des anciennes donnees
28
29execRmv=0
30while [ $# -gt 0 ]
31do
32    case $1 in
33        -h) echo "script permettant de creer la liste des fichiers a effacer sur le store"
34            echo "-rmv  : le surpack est copie sur le store et les anciennes donnees surpackees sont effacees"
35            ;;
36        -rmv) execRmv=1
37            ;;
38        *) echo "option non reconnue"
39            exit
40            ;;
41    esac
42    shift
43done
44
45
46
47# liste des simus
48totalNbOfList=0
49for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste )
50do
51    PATH_SIMU=$( dirname $CONFIG )
52    nbListInConfig=`find $PATH_SIMU -name "*list" | wc -l `
53    totalNbOfList=$(( $totalNbOfList + $nbListInConfig ))
54
55
56# liste des tar RESTART et DEBUG a effacer
57    config_card=$PATH_SIMU/config_card_*
58    eval $(grep PATH_SIMUL_FULL ${config_card}) 
59    eval $(grep IGCM_DEM_SIMU ${config_card})
60    eval $(grep JobName ${config_card}) 
61   
62    SIMU=${PATH_SIMUL_FULL}
63    SIMU_BF=${SIMU}.BF
64   
65    LITTLE_PATH=`echo $PATH_SIMUL_FULL | sed  "s%${INPUT_DMF_DATA}%%"`
66
67
68    cd ${USER_OUTPUT_PROGRESS}
69    find . -name "removedFiles*" > liste_files.txt
70    rmv_file_bis=${USER_OUTPUT_PROGRESS}/rmv_afterSurPack.txt
71    rm -f ${rmv_file_bis}
72    for removedfile in `awk '{print $0}' liste_files.txt`; do
73        rmv_file=${removedfile}
74
75
76        if [[ -f  ${rmv_file_bis} ]] ; then
77            cp ${rmv_file} ${rmv_file_bis}
78        else
79            cat  ${rmv_file} >> ${rmv_file_bis}
80        fi
81       
82        mkdir -p ${IGCM_DEM_SIMU}/restart_rmv
83        rm -rf ${IGCM_DEM_SIMU}/restart_rmv/*
84        for archive in  `awk '{print $2}' ${IGCM_DEM_SIMU}/liste_restart_files_config.txt`; do
85            not_rmv=0
86            ccc_hsm get $archive
87            tar tf $archive > ${IGCM_DEM_SIMU}/restart_rmv/archive.rmv
88            for fichier in  `awk '{print $0}' ${IGCM_DEM_SIMU}/restart_rmv/archive.rmv`; do
89                FindFile=`grep $fichier $rmv_file`
90                if [ "X$FindFile" == "X" ]; then
91                    echo "$archive tar to be conserved"
92                    not_rmv=1
93                fi
94            done
95            if [ $not_rmv == 0 ] ; then
96                echo "rm -f $archive" >> ${rmv_file_bis}
97            fi
98            rm -f ${IGCM_DEM_SIMU}/restart_rmv/archive.rmv
99        done
100       
101        mkdir -p ${IGCM_DEM_SIMU}/debug_rmv
102        rm -rf ${IGCM_DEM_SIMU}/debug_rmv/*
103        for archive in  `awk '{print $0}' ${IGCM_DEM_SIMU}/liste_debug_files_config.txt`; do
104            not_rmv=0
105            ccc_hsm get $archive
106            tar tf $archive > ${IGCM_DEM_SIMU}/debug_rmv/archive.rmv
107            for fichier in  `awk '{print $0}' ${IGCM_DEM_SIMU}/debug_rmv/archive.rmv`; do
108                FindFile=`grep $fichier $rmv_file`
109                if [ "X$FindFile" == "X" ]; then
110                    echo "$archive tar to be conserved"
111                    not_rmv=1
112                fi
113            done
114            if [ $not_rmv == 0 ] ; then
115                echo "rm -f $archive" >> ${rmv_file_bis}
116            fi
117            rm -f ${IGCM_DEM_SIMU}/debug_rmv/archive.rmv
118        done
119    done
120    sed -i -e "s%${SIMU}\/%${SIMU_BF}\/%g" ${rmv_file_bis}
121    chmod 755 ${rmv_file_bis}
122
123
124    if [[ $execRmv == 1 ]] ; then 
125# sauver l'ancienne version
126        mv ${SIMU} ${SIMU_BF}
127#copier sur le store la nouvelle
128        mv ${OUTPUT_STORE}${LITTLE_PATH}  ${SIMU}
129#copie du repertoire Exe qui ne change pas
130        cp -r ${SIMU_BF}/Exe ${SIMU}/.
131# effacer dans l'ancienne version les fichiers de rmv_file_bis
132        ${rmv_file_bis}
133    fi
134done
135echo $totalNbOfList
136
Note: See TracBrowser for help on using the repository browser.