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