Ignore:
Timestamp:
10/09/15 16:04:04 (9 years ago)
Author:
sdipsl
Message:
  • rationalyze somehow message code logic
  • extend the information gathered by big brother
  • clean up
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r1243 r1244  
    2929#================================================== 
    3030# GENERATE RANDOM ERROR ; only apply if ( ${DEBUG_debug} ) 
    31 typeset RandomError=false 
     31typeset -r RandomError=false 
    3232 
    3333#================================================== 
     
    3939# libIGCM_CurrentTag 
    4040# Current libIGCM tag, check compatibilty with *.card 
    41 typeset -r libIGCM_CurrentTag="1.0" 
     41typeset -r libIGCMVersion="2.7" 
    4242 
    4343#================================================== 
     
    337337      IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /\",\"/g" ) 
    338338    fi 
    339  
    340     # Unplugged message 4000 handling for now. To ease downstream treatment. 
    341     #if [ X${ActivateBigBro} = Xtrue ] ; then 
    342     #  # RabbitMQ message code "PUSHSTACK" 
    343     #  code=4000 
    344     #  # RabbitMQ message body 
    345     #  Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${IGCM_debug_Stack[0]}\",\"arguments\":[\"${IGCM_debug_StackArgs[0]}\"],\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
    346     #  # Fill the rabbitMQ queue 
    347     #  IGCM_debug_sendAMQP 
    348     #fi 
    349339 
    350340    # Increment LenStack 
     
    542532 
    543533      # Unplugged message 4900 handling for now. To ease downstream treatment. 
    544       #if [ X${ActivateBigBro} = Xtrue ] ; then 
    545       #  # RabbitMQ message code "ERROR HAS BEEN TRIGGERED" 
    546       #  code=4900 
    547       #  # RabbitMQ message body 
    548       #  Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
    549       #  # Fill the rabbitMQ queue 
    550       #  IGCM_debug_sendAMQP 
    551       #fi 
     534      if [ X${ActivateBigBro} = Xtrue ] ; then 
     535        if [ X${TaskType} = Xcomputing ]; then 
     536          # RabbitMQ message code "COMPUTING JOBs COMMAND FAILURE" 
     537          code=1900 
     538        elif [ X${TaskType} = Xpost-processing ]; then 
     539          # RabbitMQ message code "POST-PROCESSING JOBs COMMAND FAILURE" 
     540          code=2900 
     541        elif [ X${TaskType} = Xchecking ]; then 
     542          # RabbitMQ message code "POST-PROCESSING FROM CHECKER JOBs COMMAND FAILURE" 
     543          code=3900 
     544        fi 
     545        # RabbitMQ message body 
     546        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
     547 
     548        # Fill the rabbitMQ queue 
     549        IGCM_debug_sendAMQP 
     550      fi 
    552551    else 
    553552      # Inform the stack file 
     
    555554        echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName} 
    556555      fi 
    557  
    558       # Unplugged message 4100 handling for now. To ease downstream treatment. 
    559       #if [ X${ActivateBigBro} = Xtrue ] ; then 
    560       #  # RabbitMQ message code "POPSTACK" 
    561       #  code=4100 
    562       #  # RabbitMQ message body 
    563       #  Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
    564       #  # Fill the rabbitMQ queue 
    565       #  IGCM_debug_sendAMQP 
    566       #fi 
    567556    fi 
    568557 
     
    590579  IGCM_debug_PushStack "IGCM_debug_BigBro_Initialize" 
    591580 
    592   typeset postProcessingName postProcessingDate postProcessingDimn postProcessingComp postProcessingFile 
     581  typeset postProcessingIDLength postProcessingName postProcessingDate postProcessingDimn postProcessingComp postProcessingFile 
    593582 
    594583# Message type standard fields: 
     
    601590    # create a unique ID for this specific job 
    602591    jobuid=$(uuidgen) 
     592 
     593    # get the assigned id by the scheduler for that job 
     594    IGCM_sys_getJobSchedulerID jobSchedulerID 
    603595 
    604596    if [ X${TaskType} = Xcomputing ]; then 
     
    610602        IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration simuid ${simuid} 
    611603        # Standard fields for the first message 
    612         genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"activity\":\"IPSL\",\"name\":\"${config_UserChoices_JobName}\",\"experiment\":\"${config_UserChoices_ExperimentName}\",\"space\":\"${config_UserChoices_SpaceName}\",\"model\":\"${config_UserChoices_TagName}\",\"startDate\":\"${config_UserChoices_DateBegin}\",\"endDate\":\"${config_UserChoices_DateEnd}\",\"login\":\"${LOGIN}\",\"centre\":\"${CENTER}\",\"machine\":\"${MASTER}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
     604        genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"activity\":\"IPSL\",\"name\":\"${config_UserChoices_JobName}\",\"experiment\":\"${config_UserChoices_ExperimentName}\",\"space\":\"${config_UserChoices_SpaceName}\",\"model\":\"${config_UserChoices_TagName}\",\"startDate\":\"${config_UserChoices_DateBegin}\",\"endDate\":\"${config_UserChoices_DateEnd}\",\"login\":\"${LOGIN}\",\"centre\":\"${CENTER}\",\"machine\":\"${MASTER}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
    613605        # RabbitMQ message body with specific fields associated message codes treated here 
    614606        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
     
    622614        simuid=${run_Configuration_simuid} 
    623615        # Using standard fields for message others than the first one. Still subject to change 
    624         genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
     616        genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
    625617        # RabbitMQ message body with specific fields associated message codes treated here 
    626         Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
     618        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"jobSchedulerID\":\"${jobSchedulerID}\",\"jobSubmissionPath\":\"${SUBMIT_DIR}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 
    627619        # Fill the rabbitMQ queue 
    628620        IGCM_debug_sendAMQP 
     
    632624      # Be sure that the genericSimulationID will be small from now on 
    633625      # Using standard fields for messages others than the first one. Still subject to change 
    634       genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
     626      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
    635627 
    636628    elif [ X${TaskType} = Xpost-processing ]; then 
     
    641633      simuid=${run_Configuration_simuid} 
    642634      # Using standard fields for message others than the first one. Still subject to change 
    643       genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
     635      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
    644636       
    645637      # Specify the post-processing task we are dealing with 
    646       n=$( echo "${Script_Post_Output}" | tr -d -c "\." | wc -c ) 
     638      postProcessingIDLength=$( echo "${Script_Post_Output}" | tr -d -c "\." | wc -c ) 
    647639      postProcessingName=$( echo "${Script_Post_Output}" | gawk -F. '{print $1}' ) 
    648640      postProcessingDate=$( echo "${Script_Post_Output}" | gawk -F. '{print $2}' ) 
     
    650642      postProcessingComp="null" 
    651643      postProcessingFile="null" 
    652       if [ ${n} -eq 3 ] ; then 
     644      if [ ${postProcessingIDLength} -eq 3 ] ; then 
    653645        postProcessingDimn=$( echo "${Script_Post_Output}" | gawk -F. '{print $3}' ) 
    654       elif [ ${n} -eq 5 ] ; then 
     646      elif [ ${postProcessingIDLength} -eq 5 ] ; then 
    655647        postProcessingComp=$( echo "${Script_Post_Output}" | gawk -F. '{print $4}' ) 
    656648        postProcessingFile=$( echo "${Script_Post_Output}" | gawk -F. '{print $5}' ) 
     
    658650 
    659651      # RabbitMQ message body with specific fields associated message codes treated here 
    660       Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\",\"postProcessingName\":\"${postProcessingName}\",\"postProcessingDate\":\"${postProcessingDate}\",\"postProcessingDimn\":\"${postProcessingDimn}\",\"postProcessingComp\":\"${postProcessingComp}\",\"postProcessingFile\":\"${postProcessingFile}\"}" ) 
     652      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"jobSchedulerID\":\"${jobSchedulerID}\",\"jobSubmissionPath\":\"${SUBMIT_DIR}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\",\"postProcessingName\":\"${postProcessingName}\",\"postProcessingDate\":\"${postProcessingDate}\",\"postProcessingDimn\":\"${postProcessingDimn}\",\"postProcessingComp\":\"${postProcessingComp}\",\"postProcessingFile\":\"${postProcessingFile}\"}" ) 
    661653      # Fill the rabbitMQ queue 
    662654      IGCM_debug_sendAMQP 
     
    692684        elif ( ${ExitFlag} ) ; then 
    693685          # RabbitMQ message code "EXIT THE JOBS BECAUSE ERROR(S) HAS BEEN TRIGGERED" 
    694           code=9999 
     686          code=1999 
    695687          FlushAMQP=true 
    696688        else 
     
    701693        if ( ${ExitFlag} ) ; then 
    702694          # RabbitMQ message code "POST-PROCESSING JOB FAILS" 
    703           code=2900 
     695          code=2999 
    704696          FlushAMQP=true 
    705           else 
     697        else 
    706698          # RabbitMQ message code "POST-PROCESSING JOB ENDS" 
    707699          code=2100 
     700          FlushAMQP=true 
     701        fi 
     702      elif [ X${TaskType} = Xchecking ]; then 
     703        if ( ${ExitFlag} ) ; then 
     704          # RabbitMQ message code "POST-PROCESSING JOB FAILS" 
     705          code=3999 
     706          FlushAMQP=true 
     707        else 
     708          # RabbitMQ message code "POST-PROCESSING JOB ENDS" 
     709          code=3100 
    708710          FlushAMQP=true 
    709711        fi 
Note: See TracChangeset for help on using the changeset viewer.