#!/bin/bash # TMP_MIGR_DATA = repertoire temporaire de travail export TMP_MIGR_DATA="$SCRATCHDIR/TEST_PACK" # INPUT_DMF_DATA = repertoire contenant les donnees de l'utilisateur ## ATTENTION : il ne faut pas de "/" en fin de path export INPUT_DMF_DATA="/ccc/store/cont003/dsm/p86caub/dmf_import/IGCM_OUT" # OUTPUT_STORE / OUTPUT_WORK = repertoire de stockage des donnees une fois traitees export OUTPUT_STORE="$SCRATCHDIR/TEST_PACK/PSEUDO_DMNFS_STORE" export OUTPUT_WORK="$SCRATCHDIR/TEST_PACK/PSEUDO_DMNFS_WORK" #IGCM_DEM = espace dans lequel nous stockerons nos listes de fichiers packables export IGCM_DEM=${TMP_MIGR_DATA}"/IGCM_DEM" #OUPUT_CHECK = espace pour faire des operations de double verification durant le processus de package export OUTPUT_CHECK=${TMP_MIGR_DATA}"/PSEUDO_DMNFS_CHECK" #OUTPUT_PROGRESS = espace permettant la gestion des reprises en cas d'arret non prevu ou d'echec. export OUTPUT_PROGRESS=${TMP_MIGR_DATA}"/PSEUDO_DMNFS_PROGRESS" # Variables d'environnement # Sur curie en sequentiel # export OUTPUT_PROGRESS="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS_SEQ" # export OUTPUT_STORE="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_STORE_SEQ" # export OUTPUT_WORK="/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_WORK_SEQ" # Pour titane #export IGCM_DEM="/scratch/cont003/pierreg/IGCM_DEM" #export INPUT_DMF_DATA="/scratch/cont003/pierreg/datasLabo/dataDMNFS_simple1" #export OUTPUT_STORE="/scratch/cont003/pierreg/PSEUDO_DMNFS_STORE" #export OUTPUT_WORK="/scratch/cont003/pierreg/PSEUDO_DMNFS_WORK" #export OUTPUT_CHECK="/scratch/cont003/pierreg/PSEUDO_DMNFS_CHECK" #export OUTPUT_PROGRESS="/scratch/cont003/pierreg/PSEUDO_DMNFS_PROGRESS" # Determination du chemin pour le rep ${PSEUDO_DMNFS_PROGRESS}/USER (seulement pour la partie de pack) # ------------------------------------------------------------------ # Le rep ${OUTPUT_PROGRESS} contiendra des sous rep USER # ${OUTPUT_PROGRESS}/USER contiendra, pour l'utilisateur USER : # * la liste des taches a executer en parallele par le prog c/mpi # * la nouvelle liste des taches qui n'ont pas ete reussies dans un premier temps # * les sorties des taches executees en parallele (traitement des liste de fichiers) # L'idee est de regrouper ces elements dans un rep ${OUTPUT_PROGRESS}/USER # Pour determiner le rep USER, on parcourt ${IGCM_DEM}/config_card.liste. # La chaine de caract commune a toutes les lignes de ce fichier est le rep USER, # que l'on cree ensuite dans ${OUTPUT_PROGRESS} function find_intersection { # Trouve la sous chaine commune de 2 chaines de caract local string1=$1 local string2=$2 local lengthString1=${#string1} local lengthString2=${#string2} local longestString= local smallestString= if [ $lengthString1 -ge $lengthString2 ] then longestString=$string1 smallestString=$string2 else longestString=$string2 smallestString=$string1 fi while [ "x`echo $longestString | grep $smallestString `" == "x" ] do smallestString=$( dirname $smallestString ) done echo "$smallestString" } scriptCallingThisOne="$scriptCallingLoad" # echo "scriptCallingThisOne=$scriptCallingThisOne" if [ "x${scriptCallingThisOne}" != "xlaunch_ipsl_pack.sh" ] then echo "specific loading for pack script." COMMON_STRING=`head -n 1 ${IGCM_DEM}/config_card.liste | awk '{print $1}' | xargs dirname ` for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do PATH_SIMU=$( dirname $CONFIG ) INTERSECT=$( find_intersection $PATH_SIMU $COMMON_STRING ) COMMON_STRING=$INTERSECT done # echo "COMMON_STRING=$COMMON_STRING" PATH_TO_ADD=`echo $COMMON_STRING | sed "s;${IGCM_DEM};;" | sed 's;^/;;' ` # echo "PATH_TO_ADD=$PATH_TO_ADD" USER_OUTPUT_PROGRESS="${OUTPUT_PROGRESS}/${PATH_TO_ADD}" export USER_OUTPUT_PROGRESS=`echo $USER_OUTPUT_PROGRESS | sed 's;/$;;' ` export DETAILLED_OUTPUT="${USER_OUTPUT_PROGRESS}/detailed_pack_output" # creation du rep ${IGCM_DEM}/PSEUDO_DMNFS_PROGRESS/USER mkdir -p ${USER_OUTPUT_PROGRESS} # creation d'un rep specifique pour les sorties detaillees des operations de pack mkdir -p ${DETAILLED_OUTPUT} fi