Changeset 1051


Ignore:
Timestamp:
09/11/14 16:19:05 (10 years ago)
Author:
sdipsl
Message:

update message content
# Message type standard fields:
https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields
# Message type dictionnary and custom fields:
https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary

Location:
trunk/libIGCM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_job

    r1036 r1051  
    166166#D- 
    167167#D--------------------------------------------------------------------== 
    168 #D- 0. SYSTEM ENVIRONMENT 
    169 #D-    - Define variables for Number of processors 
    170 #D-    - Define MPI variables 
    171 #D-    - Define batch scheduler variables 
    172 #D-    - Source IGCM Library 
    173 #D-    - Get RESOLution in .resol file (temporary) 
     168#D- 0.0 SYSTEM ENVIRONMENT 
     169#D-     - Define variables for Number of processors 
     170#D-     - Define MPI variables 
     171#D-     - Define batch scheduler variables 
     172#D-     - Source IGCM Library 
     173#D-     - Get RESOLution in .resol file (temporary) 
    174174#D--------------------------------------------------------------------== 
    175175 
     
    200200#D- 
    201201#D--------------------------------------------------------------------== 
     202#D- 0.1 COMMON ENVIRONMENT 
     203#D-     - Read libIGCM compatibility version in config.card 
     204#D-     - Read UserChoices section 
     205#D-     - Read Ensemble section 
     206#D-     - Read Post section 
     207#D-     - Define all netcdf output directories 
     208#D--------------------------------------------------------------------== 
     209IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card 
     210 
     211# ------------------------------------------------------------------ 
     212# Activate BigBrother so as to supervise this simulation 
     213# ------------------------------------------------------------------ 
     214IGCM_debug_ActivateBigBro 
     215 
     216#D- 
     217#D--------------------------------------------------------------------== 
    202218#D- 1. INITIALIZE CONFIGURATION 
    203219#D-    - Simulation configuration 
     
    207223#D-    - Read or initialize CumulPeriod 
    208224#D-    - run.card 
    209 #D---------------------------------------------------------------------== 
     225#D--------------------------------------------------------------------== 
    210226IGCM_config_Initialize 
    211227 
     
    248264# ------------------------------------------------------------------ 
    249265IGCM_debug_Verif_Exit 
    250  
    251 # ------------------------------------------------------------------ 
    252 # Activate BigBrother so as to supervise this simulation 
    253 # ------------------------------------------------------------------ 
    254 IGCM_debug_ActivateBigBro 
    255266 
    256267#D- 
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r1049 r1051  
    176176    ls -lta ${SUBMIT_DIR} 
    177177  fi 
    178  
    179   #================================== 
    180   # Read libIGCM compatibility version in config.card 
    181   # Read UserChoices section 
    182   # Read Ensemble section 
    183   # Read Post section 
    184   # Define all netcdf output directories 
    185   #================================== 
    186   IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card 
    187178 
    188179  #================================== 
     
    12411232      code=1100 
    12421233      # RabbitMQ message body 
    1243       Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"OK\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     1234      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    12441235      # Fill the rabbitMQ queue 
    12451236      IGCM_debug_sendAMQP 
     
    12641255        code=0100 
    12651256        # RabbitMQ message body 
    1266         Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"OK\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     1257        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    12671258        # Fill the rabbitMQ queue 
    12681259        IGCM_debug_sendAMQP 
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r1050 r1051  
    145145#D- * Purpose: Take over AMQP C client using mail as a message recipient 
    146146#D- * One argument : base64 encoded message 
     147#D- * Attach encoded config.card when starting the simulation 
     148 
    147149function IGCM_debug_send_AMQP_msg__MAILTUNNEL { 
    148150 
     
    183185 
    184186  # send mail 
    185   if ( [ ${send_messages} -eq 1 ] || [ X${FlushAMQP} = XTRUE ] ) ; then 
    186     mail -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient}  < ${buffer} # send buffer 
    187     rm -f $buffer ; touch ${buffer}                                   # clear buffer 
    188     touch ${last_mail_date__file}                                     # memorize last mail date 
     187 
     188  if [ X${initBigBro}=Xtrue ] ; then 
     189    mailx -s "[TEMPORARY AMQP CHANNEL]" -a ${SUBMIT_DIR}/config.card.base64 ${mail_recipient} < ${buffer} # send buffer 
     190    rm -f $buffer ; touch ${buffer}                                    # clear buffer 
     191    touch ${last_mail_date__file}                                      # memorize last mail date 
     192    initBigBro=false 
     193  elif ( [ ${send_messages} -eq 1 ] || [ X${FlushAMQP} = XTRUE ] ) ; then 
     194    mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient}  < ${buffer} # send buffer 
     195    rm -f $buffer ; touch ${buffer}                                    # clear buffer 
     196    touch ${last_mail_date__file}                                      # memorize last mail date 
    189197  fi 
    190198 
     
    209217    # Prepare additionnal option 
    210218    additionnalOption="-f ${SUBMIT_DIR}/config.card.base64" 
     219    #  
     220    initBigBro=true 
    211221  else 
    212222    additionnalOption= 
     223    # 
     224    initBigBro=false 
    213225  fi 
    214226 
     
    237249  if [ ${status} -gt 0 ] ; then 
    238250    IGCM_debug_Print 2 "IGCM_debug_Push/PopStack/ActivateBigBro : command sendAMQPMsg failed error code ${status}" 
    239     echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}" 
     251    echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 
    240252    exit 
    241253  fi 
     
    306318      code=2000 
    307319      # RabbitMQ message body 
    308       Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     320      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    309321      # Fill the rabbitMQ queue 
    310322      IGCM_debug_sendAMQP 
     
    501513        code=9000 
    502514        # RabbitMQ message body 
    503         Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"NOK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     515        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    504516        # Fill the rabbitMQ queue 
    505517        IGCM_debug_sendAMQP 
     
    512524        code=3000 
    513525        # RabbitMQ message body 
    514         Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"OK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     526        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    515527        # Fill the rabbitMQ queue 
    516528        IGCM_debug_sendAMQP 
     
    541553  IGCM_debug_PushStack "IGCM_debug_ActivateBigBro" 
    542554 
     555# Message type standard fields: 
     556# https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields 
     557 
     558# Message type dictionnary and custom fields: 
     559# https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary 
     560 
    543561  if [ X${BigBrother} = Xtrue ] ; then 
    544     # ID to identify a simulation and the current Job. Still subject to change 
    545     GenericSimulationID=$( echo "\"simulationName\":\"${config_UserChoices_JobName}\",\"Experiment\":\"${config_UserChoices_ExperimentName}\",\"SpaceName\":\"${config_UserChoices_SpaceName}\",\"Model\":\"${config_UserChoices_TagName}\",\"Login\":\"${LOGIN}\",\"Center\":\"${CENTER}\",\"Machine\":\"${MASTER}\",\"CumulPeriod\":\"${CumulPeriod}\"" ) 
     562    # create a unique ID for this specific job 
     563    jobuid=$(uuidgen) 
    546564 
    547565    # RabbitMQ message code 
    548566    if ( ${FirstInitialize} ) ; then 
    549567      code=0000 
     568      # create and persist a unique id for this simulation 
     569      simuid=$(uuidgen) 
     570      IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration simuid ${simuid} 
     571 
     572      # Standard fields for the first message 
     573      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"activity\":\"IPSL\",\"name\":\"${config_UserChoices_JobName}\",\"cumulPeriod\":\"${CumulPeriod}\",\"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}\"" ) 
    550574    else 
    551575      code=1000 
    552     fi 
    553     # RabbitMQ message body 
    554     Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"OK\",\"out\":\"false\",\"nesting\":\"${IGCM_debug_LenStack}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     576      # 
     577      # retrieve this simulation's unique id  
     578      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration simuid 
     579      simuid=${config_Configuration_simuid} 
     580 
     581      # Standard fields for message others than the first one. Still subject to change 
     582      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"cumulPeriod\":\"${CumulPeriod}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) 
     583    fi 
     584 
     585    # RabbitMQ message body with specific fields associated message codes treated here 
     586    Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    555587    # Fill the rabbitMQ queue (specifying config.card must be send) 
    556588    IGCM_debug_sendAMQP activate 
     
    600632      code=9999 
    601633      # RabbitMQ message body 
    602       Body=$( echo "{${GenericSimulationID},\"code\":\"${code}\",\"uuid\":\"$(uuidgen)\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     634      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    603635      # Fill the rabbitMQ queue 
    604636      IGCM_debug_sendAMQP 
     
    754786  if [ X${ActivateBigBro} = Xtrue ] ; then 
    755787    # RabbitMQ message body 
    756     Body=$( echo "{${instrumentationContent},\"uuid\":\"$(uuidgen)\",\"timestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
     788    Body=$( echo "{${genericSimulationID},${instrumentationContent},\"msgCode\":\"7000\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%d-%T-%N" )\"}" ) 
    757789    # Fill the rabbitMQ queue 
    758790    IGCM_debug_sendAMQP 
Note: See TracChangeset for help on using the changeset viewer.