1 | #!/bin/bash |
---|
2 | |
---|
3 | # TMP_MIGR_DATA = repertoire temporaire de travail |
---|
4 | export TMP_MIGR_DATA="$SCRATCHDIR/TEST_PACK" |
---|
5 | # INPUT_DMF_DATA = repertoire contenant les donnees de l'utilisateur |
---|
6 | ## ATTENTION : il ne faut pas de "/" en fin de path |
---|
7 | export INPUT_DMF_DATA="/ccc/store/cont003/dsm/p86caub/dmf_import/IGCM_OUT" |
---|
8 | # OUTPUT_STORE / OUTPUT_WORK = repertoire de stockage des donnees une fois traitees |
---|
9 | export OUTPUT_STORE="$SCRATCHDIR/TEST_PACK/PSEUDO_DMNFS_STORE" |
---|
10 | export OUTPUT_WORK="$SCRATCHDIR/TEST_PACK/PSEUDO_DMNFS_WORK" |
---|
11 | |
---|
12 | #IGCM_DEM = espace dans lequel nous stockerons nos listes de fichiers packables |
---|
13 | export IGCM_DEM=${TMP_MIGR_DATA}"/IGCM_DEM" |
---|
14 | #OUPUT_CHECK = espace pour faire des operations de double verification durant le processus de package |
---|
15 | export OUTPUT_CHECK=${TMP_MIGR_DATA}"/PSEUDO_DMNFS_CHECK" |
---|
16 | #OUTPUT_PROGRESS = espace permettant la gestion des reprises en cas d'arret non prevu ou d'echec. |
---|
17 | export OUTPUT_PROGRESS=${TMP_MIGR_DATA}"/PSEUDO_DMNFS_PROGRESS" |
---|
18 | |
---|
19 | # Variables d'environnement |
---|
20 | |
---|
21 | # Sur curie en sequentiel |
---|
22 | # export OUTPUT_PROGRESS="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS_SEQ" |
---|
23 | # export OUTPUT_STORE="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_STORE_SEQ" |
---|
24 | # export OUTPUT_WORK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_WORK_SEQ" |
---|
25 | |
---|
26 | |
---|
27 | # Pour titane |
---|
28 | #export IGCM_DEM="/scratch/cont003/pierreg/IGCM_DEM" |
---|
29 | #export INPUT_DMF_DATA="/scratch/cont003/pierreg/datasLabo/dataDMNFS_simple1" |
---|
30 | #export OUTPUT_STORE="/scratch/cont003/pierreg/PSEUDO_DMNFS_STORE" |
---|
31 | #export OUTPUT_WORK="/scratch/cont003/pierreg/PSEUDO_DMNFS_WORK" |
---|
32 | #export OUTPUT_CHECK="/scratch/cont003/pierreg/PSEUDO_DMNFS_CHECK" |
---|
33 | #export OUTPUT_PROGRESS="/scratch/cont003/pierreg/PSEUDO_DMNFS_PROGRESS" |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | # Determination du chemin pour le rep ${PSEUDO_DMNFS_PROGRESS}/USER (seulement pour la partie de pack) |
---|
38 | # ------------------------------------------------------------------ |
---|
39 | # Le rep ${OUTPUT_PROGRESS} contiendra des sous rep USER |
---|
40 | # ${OUTPUT_PROGRESS}/USER contiendra, pour l'utilisateur USER : |
---|
41 | # * la liste des taches a executer en parallele par le prog c/mpi |
---|
42 | # * la nouvelle liste des taches qui n'ont pas ete reussies dans un premier temps |
---|
43 | # * les sorties des taches executees en parallele (traitement des liste de fichiers) |
---|
44 | # L'idee est de regrouper ces elements dans un rep ${OUTPUT_PROGRESS}/USER |
---|
45 | # Pour determiner le rep USER, on parcourt ${IGCM_DEM}/config_card.liste. |
---|
46 | # La chaine de caract commune a toutes les lignes de ce fichier est le rep USER, |
---|
47 | # que l'on cree ensuite dans ${OUTPUT_PROGRESS} |
---|
48 | |
---|
49 | function find_intersection |
---|
50 | { |
---|
51 | # Trouve la sous chaine commune de 2 chaines de caract |
---|
52 | local string1=$1 |
---|
53 | local string2=$2 |
---|
54 | |
---|
55 | local lengthString1=${#string1} |
---|
56 | local lengthString2=${#string2} |
---|
57 | |
---|
58 | local longestString= |
---|
59 | local smallestString= |
---|
60 | if [ $lengthString1 -ge $lengthString2 ] |
---|
61 | then |
---|
62 | longestString=$string1 |
---|
63 | smallestString=$string2 |
---|
64 | else |
---|
65 | longestString=$string2 |
---|
66 | smallestString=$string1 |
---|
67 | fi |
---|
68 | |
---|
69 | while [ "x`echo $longestString | grep $smallestString `" == "x" ] |
---|
70 | do |
---|
71 | smallestString=$( dirname $smallestString ) |
---|
72 | done |
---|
73 | echo "$smallestString" |
---|
74 | } |
---|
75 | |
---|
76 | |
---|
77 | scriptCallingThisOne="$scriptCallingLoad" |
---|
78 | # echo "scriptCallingThisOne=$scriptCallingThisOne" |
---|
79 | |
---|
80 | if [ "x${scriptCallingThisOne}" != "xlaunch_ipsl_pack.sh" ] |
---|
81 | then |
---|
82 | |
---|
83 | echo "specific loading for pack script." |
---|
84 | |
---|
85 | COMMON_STRING=`head -n 1 ${IGCM_DEM}/config_card.liste | awk '{print $1}' | xargs dirname ` |
---|
86 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
87 | |
---|
88 | PATH_SIMU=$( dirname $CONFIG ) |
---|
89 | INTERSECT=$( find_intersection $PATH_SIMU $COMMON_STRING ) |
---|
90 | COMMON_STRING=$INTERSECT |
---|
91 | |
---|
92 | done |
---|
93 | |
---|
94 | # echo "COMMON_STRING=$COMMON_STRING" |
---|
95 | |
---|
96 | PATH_TO_ADD=`echo $COMMON_STRING | sed "s;${IGCM_DEM};;" | sed 's;^/;;' ` |
---|
97 | # echo "PATH_TO_ADD=$PATH_TO_ADD" |
---|
98 | |
---|
99 | USER_OUTPUT_PROGRESS="${OUTPUT_PROGRESS}/${PATH_TO_ADD}" |
---|
100 | export USER_OUTPUT_PROGRESS=`echo $USER_OUTPUT_PROGRESS | sed 's;/$;;' ` |
---|
101 | export DETAILLED_OUTPUT="${USER_OUTPUT_PROGRESS}/detailed_pack_output" |
---|
102 | |
---|
103 | # creation du rep ${IGCM_DEM}/PSEUDO_DMNFS_PROGRESS/USER |
---|
104 | mkdir -p ${USER_OUTPUT_PROGRESS} |
---|
105 | |
---|
106 | # creation d'un rep specifique pour les sorties detaillees des operations de pack |
---|
107 | mkdir -p ${DETAILLED_OUTPUT} |
---|
108 | |
---|
109 | fi |
---|