Index: trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1243)
+++ trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1244)
@@ -29,5 +29,5 @@
 #==================================================
 # GENERATE RANDOM ERROR ; only apply if ( ${DEBUG_debug} )
-typeset RandomError=false
+typeset -r RandomError=false
 
 #==================================================
@@ -39,5 +39,5 @@
 # libIGCM_CurrentTag
 # Current libIGCM tag, check compatibilty with *.card
-typeset -r libIGCM_CurrentTag="1.0"
+typeset -r libIGCMVersion="2.7"
 
 #==================================================
@@ -337,14 +337,4 @@
       IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /\",\"/g" )
     fi
-
-    # Unplugged message 4000 handling for now. To ease downstream treatment.
-    #if [ X${ActivateBigBro} = Xtrue ] ; then
-    #  # RabbitMQ message code "PUSHSTACK"
-    #  code=4000
-    #  # RabbitMQ message body
-    #  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" )\"}" )
-    #  # Fill the rabbitMQ queue
-    #  IGCM_debug_sendAMQP
-    #fi
 
     # Increment LenStack
@@ -542,12 +532,21 @@
 
       # Unplugged message 4900 handling for now. To ease downstream treatment.
-      #if [ X${ActivateBigBro} = Xtrue ] ; then
-      #  # RabbitMQ message code "ERROR HAS BEEN TRIGGERED"
-      #  code=4900
-      #  # RabbitMQ message body
-      #  Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
-      #  # Fill the rabbitMQ queue
-      #  IGCM_debug_sendAMQP
-      #fi
+      if [ X${ActivateBigBro} = Xtrue ] ; then
+        if [ X${TaskType} = Xcomputing ]; then
+          # RabbitMQ message code "COMPUTING JOBs COMMAND FAILURE"
+          code=1900
+        elif [ X${TaskType} = Xpost-processing ]; then
+          # RabbitMQ message code "POST-PROCESSING JOBs COMMAND FAILURE"
+          code=2900
+        elif [ X${TaskType} = Xchecking ]; then
+          # RabbitMQ message code "POST-PROCESSING FROM CHECKER JOBs COMMAND FAILURE"
+          code=3900
+        fi
+        # RabbitMQ message body
+        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
+
+        # Fill the rabbitMQ queue
+        IGCM_debug_sendAMQP
+      fi
     else
       # Inform the stack file
@@ -555,14 +554,4 @@
         echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName}
       fi
-
-      # Unplugged message 4100 handling for now. To ease downstream treatment.
-      #if [ X${ActivateBigBro} = Xtrue ] ; then
-      #  # RabbitMQ message code "POPSTACK"
-      #  code=4100
-      #  # RabbitMQ message body
-      #  Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
-      #  # Fill the rabbitMQ queue
-      #  IGCM_debug_sendAMQP
-      #fi
     fi
 
@@ -590,5 +579,5 @@
   IGCM_debug_PushStack "IGCM_debug_BigBro_Initialize"
 
-  typeset postProcessingName postProcessingDate postProcessingDimn postProcessingComp postProcessingFile
+  typeset postProcessingIDLength postProcessingName postProcessingDate postProcessingDimn postProcessingComp postProcessingFile
 
 # Message type standard fields:
@@ -601,4 +590,7 @@
     # create a unique ID for this specific job
     jobuid=$(uuidgen)
+
+    # get the assigned id by the scheduler for that job
+    IGCM_sys_getJobSchedulerID jobSchedulerID
 
     if [ X${TaskType} = Xcomputing ]; then
@@ -610,5 +602,5 @@
         IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration simuid ${simuid}
         # Standard fields for the first message
-        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}\"" )
+        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}\"" )
         # RabbitMQ message body with specific fields associated message codes treated here
         Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
@@ -622,7 +614,7 @@
         simuid=${run_Configuration_simuid}
         # Using standard fields for message others than the first one. Still subject to change
-        genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
+        genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
         # RabbitMQ message body with specific fields associated message codes treated here
-        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
+        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" )\"}" )
         # Fill the rabbitMQ queue
         IGCM_debug_sendAMQP
@@ -632,5 +624,5 @@
       # Be sure that the genericSimulationID will be small from now on
       # Using standard fields for messages others than the first one. Still subject to change
-      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
+      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
 
     elif [ X${TaskType} = Xpost-processing ]; then
@@ -641,8 +633,8 @@
       simuid=${run_Configuration_simuid}
       # Using standard fields for message others than the first one. Still subject to change
-      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
+      genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
       
       # Specify the post-processing task we are dealing with
-      n=$( echo "${Script_Post_Output}" | tr -d -c "\." | wc -c )
+      postProcessingIDLength=$( echo "${Script_Post_Output}" | tr -d -c "\." | wc -c )
       postProcessingName=$( echo "${Script_Post_Output}" | gawk -F. '{print $1}' )
       postProcessingDate=$( echo "${Script_Post_Output}" | gawk -F. '{print $2}' )
@@ -650,7 +642,7 @@
       postProcessingComp="null"
       postProcessingFile="null"
-      if [ ${n} -eq 3 ] ; then
+      if [ ${postProcessingIDLength} -eq 3 ] ; then
         postProcessingDimn=$( echo "${Script_Post_Output}" | gawk -F. '{print $3}' )
-      elif [ ${n} -eq 5 ] ; then
+      elif [ ${postProcessingIDLength} -eq 5 ] ; then
         postProcessingComp=$( echo "${Script_Post_Output}" | gawk -F. '{print $4}' )
         postProcessingFile=$( echo "${Script_Post_Output}" | gawk -F. '{print $5}' )
@@ -658,5 +650,5 @@
 
       # RabbitMQ message body with specific fields associated message codes treated here
-      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}\"}" )
+      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}\"}" )
       # Fill the rabbitMQ queue
       IGCM_debug_sendAMQP
@@ -692,5 +684,5 @@
         elif ( ${ExitFlag} ) ; then
           # RabbitMQ message code "EXIT THE JOBS BECAUSE ERROR(S) HAS BEEN TRIGGERED"
-          code=9999
+          code=1999
           FlushAMQP=true
         else
@@ -701,9 +693,19 @@
         if ( ${ExitFlag} ) ; then
           # RabbitMQ message code "POST-PROCESSING JOB FAILS"
-          code=2900
+          code=2999
           FlushAMQP=true
-          else
+        else
           # RabbitMQ message code "POST-PROCESSING JOB ENDS"
           code=2100
+          FlushAMQP=true
+        fi
+      elif [ X${TaskType} = Xchecking ]; then
+        if ( ${ExitFlag} ) ; then
+          # RabbitMQ message code "POST-PROCESSING JOB FAILS"
+          code=3999
+          FlushAMQP=true
+        else
+          # RabbitMQ message code "POST-PROCESSING JOB ENDS"
+          code=3100
           FlushAMQP=true
         fi
