Changeset 1051 for trunk/libIGCM/libIGCM_debug
- Timestamp:
- 09/11/14 16:19:05 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
r1050 r1051 145 145 #D- * Purpose: Take over AMQP C client using mail as a message recipient 146 146 #D- * One argument : base64 encoded message 147 #D- * Attach encoded config.card when starting the simulation 148 147 149 function IGCM_debug_send_AMQP_msg__MAILTUNNEL { 148 150 … … 183 185 184 186 # 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 189 197 fi 190 198 … … 209 217 # Prepare additionnal option 210 218 additionnalOption="-f ${SUBMIT_DIR}/config.card.base64" 219 # 220 initBigBro=true 211 221 else 212 222 additionnalOption= 223 # 224 initBigBro=false 213 225 fi 214 226 … … 237 249 if [ ${status} -gt 0 ] ; then 238 250 IGCM_debug_Print 2 "IGCM_debug_Push/PopStack/ActivateBigBro : command sendAMQPMsg failed error code ${status}" 239 echo 251 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 240 252 exit 241 253 fi … … 306 318 code=2000 307 319 # 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" )\"}" ) 309 321 # Fill the rabbitMQ queue 310 322 IGCM_debug_sendAMQP … … 501 513 code=9000 502 514 # 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" )\"}" ) 504 516 # Fill the rabbitMQ queue 505 517 IGCM_debug_sendAMQP … … 512 524 code=3000 513 525 # 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" )\"}" ) 515 527 # Fill the rabbitMQ queue 516 528 IGCM_debug_sendAMQP … … 541 553 IGCM_debug_PushStack "IGCM_debug_ActivateBigBro" 542 554 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 543 561 if [ X${BigBrother} = Xtrue ] ; then 544 # ID to identify a simulation and the current Job. Still subject to change545 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) 546 564 547 565 # RabbitMQ message code 548 566 if ( ${FirstInitialize} ) ; then 549 567 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}\"" ) 550 574 else 551 575 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" )\"}" ) 555 587 # Fill the rabbitMQ queue (specifying config.card must be send) 556 588 IGCM_debug_sendAMQP activate … … 600 632 code=9999 601 633 # 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" )\"}" ) 603 635 # Fill the rabbitMQ queue 604 636 IGCM_debug_sendAMQP … … 754 786 if [ X${ActivateBigBro} = Xtrue ] ; then 755 787 # 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" )\"}" ) 757 789 # Fill the rabbitMQ queue 758 790 IGCM_debug_sendAMQP
Note: See TracChangeset
for help on using the changeset viewer.