Index: /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 868)
+++ /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 869)
@@ -37,12 +37,4 @@
     echo "Stack of an libIGCM job :" >  ${StackFileLocation}/stack
   fi
-
-  if [ -f ${StackFileLocation}/fullstack ] ;
-  then
-    echo "Full stack of an libIGCM job :" >> ${StackFileLocation}/fullstack
-  else
-    echo "Full stack of an libIGCM job :" >  ${StackFileLocation}/fullstack
-  fi
-
 fi
 
@@ -92,9 +84,8 @@
       decal=0
       until [ $decal -eq ${i} ]; do
-        printf -- ' ' >> ${StackFileLocation}/fullstack
+        printf -- ' '
         (( decal = decal + 1 ))
       done
-      echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
-           "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" >> ${StackFileLocation}/fullstack
+      echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}" "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
       ((i = i + 1))
     done
@@ -135,9 +126,18 @@
     # Fill the rabbitMQ queue
     if [ X${ActivateBigBro} = Xtrue ] ; then
+      # Only cosmetics
+      decal=0
+      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+        printf ' ' >> ${StackFileLocation}/stack
+        (( decal = decal + 1 ))
+      done
+      # RabbitMQ message
       code=2000
       #
-      encodedBody=$( echo "{\"code\":\"${code}\",\"jobid\":\"${jobid}\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" | base64 -w 0 )
+      Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+      encodedBody=$( echo "${Body}" | base64 -w 0 )
       #
       #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
+      echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
       echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
       sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
@@ -145,5 +145,5 @@
       if [ ${status} -gt 0 ] ; then
         IGCM_debug_Print 2 "IGCM_debug_PushStack : command sendAMQPMsg failed error code ${status}"
-        echo  sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
+        echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
         exit
       fi
@@ -154,5 +154,5 @@
 
     # If you want to print CallStack each time :
-    IGCM_debug_CallStack
+    #IGCM_debug_CallStack
   fi
 }
@@ -185,9 +185,18 @@
       # Inform the rabbitMQ queue
       if [ X${ActivateBigBro} = Xtrue ] ; then
+        # Only cosmetics
+        decal=0
+        while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+          printf ' ' >> ${StackFileLocation}/stack
+          (( decal = decal + 1 ))
+        done
+        # RabbitMQ message
         code=9000
         #
-        encodedBody=$( echo "{\"code\":\"${code}\",\"jobid\":\"${jobid}\",\"status\":\"NOK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" | base64 -w 0 )
+        Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"NOK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+        encodedBody=$( echo "{Body}" | base64 -w 0 )
         #
         #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card -b ${encodedBody}
+        echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
         echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
         sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
@@ -195,5 +204,5 @@
         if [ ${status} -gt 0 ] ; then
           IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-          echo  sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
+          echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
           exit
         fi
@@ -205,10 +214,17 @@
       # Inform the rabbitMQ queue
       if [ X${ActivateBigBro} = Xtrue ] ; then
+        # Only cosmetics
+        decal=0
+        while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+          printf ' ' >> ${StackFileLocation}/stack
+          (( decal = decal + 1 ))
+        done
+        # RabbitMQ message
         code=3000
         #
-        encodedBody=$( echo "{\"code\":\"${code}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" | base64 -w 0 )
-
+        Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+        encodedBody=$( echo "{Body}" | base64 -w 0 )
         #
-        #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
+        echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
         echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
         sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
@@ -216,5 +232,5 @@
         if [ ${status} -gt 0 ] ; then
           IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-          echo  sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
+          echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
           exit
         fi
@@ -235,5 +251,5 @@
     fi
   fi
-  IGCM_debug_CallStack
+  #IGCM_debug_CallStack
 }
 
@@ -247,5 +263,15 @@
   # Fill the rabbitMQ queue
   if [ X${BigBrother} = Xtrue ] ; then
-    jobid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE
+    # ID to identify a simulation
+    simuid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE
+    # ID to identify a job. Several Jobs are needed to complete a simulation
+    jobid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE.${CumulPeriod}
+    # Only cosmetics
+    decal=0
+    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+      printf ' ' >> ${StackFileLocation}/stack
+      (( decal = decal + 1 ))
+    done
+    # RabbitMQ message
     if ( ${FirstInitialize} ) ; then
       code=0000
@@ -253,9 +279,10 @@
       code=1000
     fi
-    encodedBody=$( echo "{\"code\":\"${code}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"false\",\"nesting\":\"${IGCM_debug_LenStack}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" | base64 -w 0 )
+    Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"false\",\"nesting\":\"${IGCM_debug_LenStack}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+    encodedBody=$( echo "{Body}" | base64 -w 0 )
     #
     cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64
     #
-    #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
+    echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b "${Body}"      >> ${StackFileLocation}/stack
     echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
     sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
@@ -263,4 +290,5 @@
     if [ ${status} -gt 0 ] ; then
       IGCM_debug_Print 2 "IGCM_debug_ActivateBigBro : command failed error code ${status}"
+      echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
       IGCM_debug_Exit "IGCM_debug_ActivateBigBro"
     fi
@@ -294,4 +322,5 @@
       echo "                        EXIT THE JOB."
       echo
+      IGCM_debug_CallStack
     fi
     if ( $DEBUG_debug ) ; then
@@ -301,9 +330,17 @@
     fi
     if [ X${ActivateBigBro} = Xtrue ] ; then
+      # Only cosmetics
+      decal=0
+      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+        printf ' ' >> ${StackFileLocation}/stack
+        (( decal = decal + 1 ))
+      done
+      # RabbitMQ message
       code=9999
       #
-      encodedBody=$( echo "{\"code\":\"${code}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" | base64 -w 0 )
+      Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+      encodedBody=$( echo "{Body}" | base64 -w 0 )
       #
-      #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card -b ${encodedBody}
+      echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
       echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
       sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
@@ -311,5 +348,5 @@
       if [ ${status} -gt 0 ] ; then
         IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-        echo  sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
+        echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
         exit
       fi
