Ignore:
Timestamp:
Jun 17, 2009, 8:10:41 PM (15 years ago)
Author:
rosiere
Message:

modif distexe script

Location:
trunk/IPs/systemC/processor/Morpheo/Script
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Script/distexe.sh

    r124 r126  
    77VERSION="1.0"
    88
    9 # Need : test, echo, cd, dirname, basename, ssh
     9# Need : test, echo, cd, dirname, basename, ssh, ps aux
    1010
    1111#-----[ distexe_usage ]-------------------------------------
     
    103103    fi;
    104104
     105    local FILE_CPT="${PATH_EXE}/control-"$(basename ${FILE_CMD});
     106   
    105107    header;
    106108    echo "  * {"$(my_date)"} <${HOSTNAME}> file : ${FILE_CMD}";
     
    108110
    109111    local hosts="${DISTEXE_HOSTS}";
     112    local -a commands;
     113    local -i cpt=0;
    110114
    111115    for line in ${hosts}; do
     
    116120
    117121        # lunch service
    118         local cmd="export MORPHEO_SCRIPT=${MORPHEO_SCRIPT};${MORPHEO_SCRIPT}/execute_n.sh ${PATH_EXE} ${FILE_CMD} ${nb_process};";
     122        local cmd="export MORPHEO_SCRIPT=${MORPHEO_SCRIPT};${MORPHEO_SCRIPT}/execute_n.sh ${PATH_EXE} ${FILE_CMD} ${FILE_CPT} ${nb_process};";
    119123        ssh ${host} ${cmd} &
     124
     125        commands[${cpt}]="${cmd}";
     126        cpt=$((${cpt}+1));
    120127    done;
    121128
    122129    echo "  * {"$(my_date)"} <${HOSTNAME}> all hosts working";
    123130
     131    cpt=0;
     132    while test ${cpt} -lt ${#commands[*]}; do
     133        local -i res=1
     134
     135        while test ${res} -ne 0; do
     136            res=$(ps aux | grep -c "${commands[${cpt}]}");
     137        done
     138
     139        cpt=$((${cpt}+1));
     140    done;
     141
     142    echo "  * {"$(my_date)"} <${HOSTNAME}> all hosts is done";
     143    rm ${FILE_CPT};
    124144}
    125145
  • trunk/IPs/systemC/processor/Morpheo/Script/execute.sh

    r124 r126  
    127127        # Test if command is empty !
    128128        if test ! -z "${COMMAND[${CPT}]}"; then
     129#           echo "  * {"$(my_date)"} <${ID}> execute command [${CPT}] : ${COMMAND[${CPT}]}";
     130            echo "  * {"$(my_date)"} <${ID}> command [${CPT}] : execute";
    129131            local PATH_CURRENT=${PWD};
    130132            cd    ${PATH_WORK}        &> /dev/null;
    131133            mkdir "Task_${CPT}"       &> /dev/null;
    132134            cd    "Task_${CPT}"       &> /dev/null;
    133 #           echo "  * {"$(my_date)"} <${ID}> execute command [${CPT}] : ${COMMAND[${CPT}]}";
    134             echo "  * {"$(my_date)"} <${ID}> execute command [${CPT}]";
    135135            echo "id   : ${ID}"        >  ${OUTPUT_FILE_INFO};
    136136            echo "host : ${HOSTNAME}" >>  ${OUTPUT_FILE_INFO};
     
    143143            ./${OUTPUT_FILE_CMD}      &>  ${OUTPUT_FILE_OUT};
    144144            cd    ${PATH_CURRENT}     &> /dev/null;
     145            echo "  * {"$(my_date)"} <${ID}> command [${CPT}] : done";
    145146        fi;
    146147    done;
  • trunk/IPs/systemC/processor/Morpheo/Script/execute_n.sh

    r124 r126  
    2727function execute_n_usage ()
    2828{
    29     echo "Usage     : ${0} path_word file [ nb_process ]";
     29    echo "Usage     : ${0} path_word file_cmd file_cpt [ nb_process ]";
    3030    echo "Arguments : ";
    3131    echo " * path_work  : directory to execute command";
    32     echo " * file       : list of command";
     32    echo " * file_cmd   : list of command";
     33    echo " * file_cpt   : file to control";
    3334    echo " * nb_process : number of process (default (and maximum) is the number of processor)";
    3435    echo "";
     
    4546function execute_n_test_usage ()
    4647{
    47     if test ${#} -ne 2 -a ${#} -ne 3; then
     48    if test ${#} -ne 3 -a ${#} -ne 4; then
    4849        execute_n_usage;
    4950    fi;
     
    7677    local    PATH_WORK=${1};
    7778    local    FILE_CMD=${2};
    78     local    FILE_CPT;
     79    local    FILE_CPT=${3};
    7980    local    FILE_CPU;
    8081    local    ID="cpu-${HOSTNAME}-$$"
     
    8283    execute_n_test_usage ${*};
    8384
    84     if test ${#} -eq 3; then
    85         if test ${3} -lt ${NB_PROCESS}; then
    86             NB_PROCESS=${3};
     85    if test ${#} -eq 4; then
     86        if test ${4} -lt ${NB_PROCESS}; then
     87            NB_PROCESS=${4};
    8788        fi;   
    8889    fi;
    8990
    90     FILE_CPT="${PATH_WORK}/control-"$(basename ${FILE_CMD});
    9191    FILE_CPU="${PATH_WORK}/${ID}";
    9292
Note: See TracChangeset for help on using the changeset viewer.