1 | #!/bin/bash |
---|
2 | |
---|
3 | # Variables d'environnement |
---|
4 | export IGCM_DEM="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/IGCM_DEM" |
---|
5 | export INPUT_DMF_DATA="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME_DATAS" |
---|
6 | export OUTPUT_STORE="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_STORE" |
---|
7 | export OUTPUT_WORK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_WORK" |
---|
8 | export OUTPUT_CHECK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_CHECK" |
---|
9 | export OUTPUT_PROGRESS="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS" |
---|
10 | |
---|
11 | # Pour titane |
---|
12 | #export IGCM_DEM="/scratch/cont003/pierreg/IGCM_DEM" |
---|
13 | #export INPUT_DMF_DATA="/scratch/cont003/pierreg/datasLabo/dataDMNFS_simple1" |
---|
14 | #export OUTPUT_STORE="/scratch/cont003/pierreg/PSEUDO_DMNFS_STORE" |
---|
15 | #export OUTPUT_WORK="/scratch/cont003/pierreg/PSEUDO_DMNFS_WORK" |
---|
16 | #export OUTPUT_CHECK="/scratch/cont003/pierreg/PSEUDO_DMNFS_CHECK" |
---|
17 | #export OUTPUT_PROGRESS="/scratch/cont003/pierreg/PSEUDO_DMNFS_PROGRESS" |
---|
18 | |
---|
19 | |
---|
20 | # Determination du chemin pour le rep ${PSEUDO_DMNFS_PROGRESS}/USER |
---|
21 | # ------------------------------------------------------------------ |
---|
22 | # Le rep ${OUTPUT_PROGRESS} contiendra des sous rep USER |
---|
23 | # ${OUTPUT_PROGRESS}/USER contiendra, pour l'utilisateur USER : |
---|
24 | # * la liste des taches a executer en parallele par le prog c/mpi |
---|
25 | # * la nouvelle liste des taches qui n'ont pas ete reussies dans un premier temps |
---|
26 | # * les sorties des taches executees en parallele (traitement des liste de fichiers) |
---|
27 | # L'idee est de regrouper ces elements dans un rep ${OUTPUT_PROGRESS}/USER |
---|
28 | # Pour determiner le rep USER, on parcourt ${IGCM_DEM}/config_card.liste. |
---|
29 | # La chaine de caract commune a toutes les lignes de ce fichier est le rep USER, |
---|
30 | # que l'on cree ensuite dans ${OUTPUT_PROGRESS} |
---|
31 | |
---|
32 | function find_intersection |
---|
33 | { |
---|
34 | # Trouve la sous chaine commune de 2 chaines de caract |
---|
35 | local string1=$1 |
---|
36 | local string2=$2 |
---|
37 | |
---|
38 | local lengthString1=${#string1} |
---|
39 | local lengthString2=${#string2} |
---|
40 | |
---|
41 | local longestString= |
---|
42 | local smallestString= |
---|
43 | if [ $lengthString1 -ge $lengthString2 ] |
---|
44 | then |
---|
45 | longestString=$string1 |
---|
46 | smallestString=$string2 |
---|
47 | else |
---|
48 | longestString=$string2 |
---|
49 | smallestString=$string1 |
---|
50 | fi |
---|
51 | |
---|
52 | while [ "x`echo $longestString | grep $smallestString `" == "x" ] |
---|
53 | do |
---|
54 | smallestString=$( dirname $smallestString ) |
---|
55 | done |
---|
56 | echo "$smallestString" |
---|
57 | } |
---|
58 | |
---|
59 | COMMON_STRING=`head -n 1 ${IGCM_DEM}/config_card.liste | awk '{print $1}' | xargs dirname ` |
---|
60 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
61 | |
---|
62 | PATH_SIMU=$( dirname $CONFIG ) |
---|
63 | INTERSECT=$( find_intersection $PATH_SIMU $COMMON_STRING ) |
---|
64 | COMMON_STRING=$INTERSECT |
---|
65 | |
---|
66 | done |
---|
67 | |
---|
68 | # echo "COMMON_STRING=$COMMON_STRING" |
---|
69 | |
---|
70 | PATH_TO_ADD=`echo $COMMON_STRING | sed "s;${IGCM_DEM};;" | sed 's;^/;;' ` |
---|
71 | # echo "PATH_TO_ADD=$PATH_TO_ADD" |
---|
72 | |
---|
73 | USER_OUTPUT_PROGRESS="${OUTPUT_PROGRESS}/${PATH_TO_ADD}" |
---|
74 | export USER_OUTPUT_PROGRESS=`echo $USER_OUTPUT_PROGRESS | sed 's;/$;;' ` |
---|
75 | export DETAILLED_OUTPUT="${USER_OUTPUT_PROGRESS}/detailed_pack_output" |
---|
76 | |
---|
77 | # creation du rep ${IGCM_DEM}/PSEUDO_DMNFS_PROGRESS/USER |
---|
78 | mkdir -p ${USER_OUTPUT_PROGRESS} |
---|
79 | |
---|
80 | # creation d'un rep specifique pour les sorties detaillees des operations de pack |
---|
81 | mkdir -p ${DETAILLED_OUTPUT} |
---|
82 | |
---|
83 | |
---|