Index: TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py	(revision 2433)
@@ -391,2 +391,3 @@
 
   exit(0)
+
Index: TOOLS/ConsoGENCMIP6/bin/gencmip6.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/gencmip6.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/gencmip6.py	(revision 2433)
@@ -184,8 +184,4 @@
       missing_values="nan",
     )
-    # print(data)
-    # print(type(data))
-    # print(data.shape)
-    # print(data.size)
     dates, utheos = zip(*data)
 
@@ -207,4 +203,7 @@
     else:
       self.date_init = dt.datetime(self.deadline.year, 1, 1)
+
+    delta = self.deadline - self.date_init
+    self.days = delta.days + 1
 
 
@@ -245,2 +244,3 @@
 if __name__ == '__main__':
   pass
+
Index: TOOLS/ConsoGENCMIP6/bin/plot_bilan.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/plot_bilan.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/plot_bilan.py	(revision 2433)
@@ -180,9 +180,5 @@
   ax_conso.bar(xcoord, consos, align="center", color="linen",
                linewidth=line_width, label="conso (heures)")
-  # ax_conso.plot(xcoord, conso_per_day, line_style, color="blue",
-  #               linewidth=1, markersize=8, alpha=0.5,
-  #               # solid_capstyle="round", solid_joinstyle="round",
-  #               label="conso journaliÃšre idÃ©ale (heures)")
-  ax_conso.axhline(y=conso_per_day[0], color="blue", alpha=0.5,
+  ax_conso.axhline(y=conso_per_day, color="blue", alpha=0.5,
                    label="conso journaliÃšre idÃ©ale (heures)")
 
@@ -365,6 +361,5 @@
   consos    = np.array(consos, dtype=float)
 
-  conso_per_day = np.array([gencmip6.alloc / nb_items
-                              for item in selected_items], dtype=float)
+  conso_per_day = gencmip6.alloc / gencmip6.days
 
   theo_uses = np.array([100.*item.theo_use for item in selected_items],
@@ -418,2 +413,3 @@
 
   exit(0)
+
Index: TOOLS/ConsoGENCMIP6/bin/plot_jobs.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/plot_jobs.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/plot_jobs.py	(revision 2433)
@@ -166,12 +166,16 @@
 
 ########################################
-def plot_data(ax, xcoord, xlabels, run_jobs, pen_jobs):
+def plot_data(ax, xcoord, xlabels, run_jobs, pen_jobs, conso_per_day):
   """
   """
+  line_width = 0.
 
   ax.bar(xcoord, run_jobs, align="center", color="lightgreen",
-         linewidth=0.1, label="running jobs cores")
+         linewidth=line_width, label="jobs running")
   ax.bar(xcoord, pen_jobs, bottom=run_jobs, align="center",
-         color="indianred", linewidth=0.1, label="pending jobs cores")
+         color="indianred", linewidth=line_width, label="jobs pending")
+
+  ax.axhline(y=conso_per_day, color="blue", alpha=0.5,
+             label="conso journaliÃšre idÃ©ale")
 
 
@@ -192,5 +196,5 @@
   xcoord_maj = [x for x, l in zip(xcoord, xlabels)
                    if l.hour == 0 or l.hour == 12]
-  xlabels_maj = ["{:%d-%m-%d %Hh}".format(l) for l in xlabels
+  xlabels_maj = ["{:%d-%m %Hh}".format(l) for l in xlabels
                  if l.hour == 0 or l.hour == 12]
   ax.set_xticks(xcoord, minor=True)
@@ -285,7 +289,4 @@
       full_data = np.append(full_data, values=data)
 
-  # print(full_data)
-  # print(full_data.size)
-
   # .. Get project info ..
   # ======================
@@ -324,16 +325,15 @@
 
   xcoord   = np.linspace(1, nb_items, num=nb_items)
-  xlabels  = np.array([date for date, run, pen in full_data])
-  # xlabels  = ["{:%d-%m-%d %H:%M}".format(date)
-  #             for date, run, pen in full_data]
-
-  run_jobs = np.array([run for date, run, pen in full_data],
-                        dtype=int)
-  pen_jobs = np.array([pen for date, run, pen in full_data],
-                        dtype=int)
-
-  print(xcoord, xlabels)
-  print(run_jobs)
-  print(pen_jobs)
+  if full_data.size > 1:
+    xlabels  = np.array([date for date, run, pen in full_data])
+    run_jobs = np.array([run for date, run, pen in full_data],
+                          dtype=int)
+    pen_jobs = np.array([pen for date, run, pen in full_data],
+                          dtype=int)
+  else:
+    xlabels , run_jobs, pen_jobs = full_data.tolist()
+    xlabels = list(xlabels)
+    run_jobs = list(run_jobs )
+    pen_jobs = list(pen_jobs )
 
   # cumul     = np.array([item.conso for item in selected_items],
@@ -344,6 +344,5 @@
   # consos    = np.array(consos, dtype=float)
 
-  # conso_per_day = np.array([gencmip6.alloc / nb_items
-  #                             for item in selected_items], dtype=float)
+  conso_per_day = gencmip6.alloc / (gencmip6.days * 24.)
 
   # theo_uses = np.array([100.*item.theo_use for item in selected_items],
@@ -362,5 +361,5 @@
   # ... Plot data ...
   # -----------------
-  plot_data(ax, xcoord, xlabels, run_jobs, pen_jobs)
+  plot_data(ax, xcoord, xlabels, run_jobs, pen_jobs, conso_per_day)
 
   # # ... Tweak figure ...
@@ -396,2 +395,3 @@
 
   exit(0)
+
Index: TOOLS/ConsoGENCMIP6/bin/plot_login.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/plot_login.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/plot_login.py	(revision 2433)
@@ -271,2 +271,3 @@
 
   exit(0)
+
Index: TOOLS/ConsoGENCMIP6/bin/plot_store.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/plot_store.py	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/bin/plot_store.py	(revision 2433)
@@ -305,2 +305,3 @@
 
   exit(0)
+
Index: TOOLS/ConsoGENCMIP6/bin/run_pen_v2.sh
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/run_pen_v2.sh	(revision 2433)
+++ TOOLS/ConsoGENCMIP6/bin/run_pen_v2.sh	(revision 2433)
@@ -0,0 +1,112 @@
+#!/bin/bash
+#
+# cron pour garder trace des jobs running et en attente
+# a executer chaque heure
+# ======================================================================
+#. /etc/profile
+
+# Functions
+# =========
+function get_run {
+  ccc_mpp -n | grep gencmip6 | grep ' RUN '
+}
+
+function get_pen {
+  ccc_mpp -n | grep gencmip6 | grep ' PEN '
+}
+
+
+# Default values
+# ==============
+fg_dry=false
+fg_verbose=false
+
+fg_all=true
+
+# Get arguments from command line
+# ===============================
+while getopts :hdaltsv Opt ; do
+  case $Opt in
+    h)
+      echo "usage: $0 [-h]Â [-a] [-d] [-v]"
+      echo ""
+      echo "options :"
+      echo "  -h : print this help and exit"
+      echo "  -d : dry run, no file produced"
+      echo "  -a : produce all files (default)"
+      echo "  -v : verbose"
+      exit 0 ;;
+    d)
+      fg_dry=true
+      ;;
+    a)
+      fg_all=true
+      ;;
+    v)
+      fg_verbose=true
+      ;;
+    :)
+      echo "$0: -"${OPTARG}" option: missing value"
+      exit 1
+      ;;
+    \?)
+      echo "$0: -"${OPTARG}" option: not supported"
+      exit 1
+      ;;
+  esac
+done
+shift $(($OPTIND-1))
+
+
+# Files and directories
+# =====================
+LOCAL_DIR="/ccc/cont003/home/dsm/p86ipsl/ConsoGENCMIP6/output"
+SAVE_DIR="/ccc/work/cont003/dsm/p86ipsl/ConsoGENCMIP6/data"
+
+if ( ${fg_dry} ) ; then
+  OUT_PENDING="/dev/stdout"
+  OUT_TOUSJOBS="/dev/stdout"
+else
+  OUT_PENDING="OUT_JOBS_PENDING"
+  OUT_TOUSJOBS="OUT_TOUSJOBS"
+fi
+
+Today=$( date +"%F" )
+Now=$( date +"%F-%R" )
+
+
+# Produce files
+# =============
+
+cd ${LOCAL_DIR}
+
+# 1- Nombre de procs running et pending
+# -------------------------------------
+if ( ${fg_all} ) ; then
+  get_run | \
+      gawk -v Now="$Now" ' {NPROC+=$4} END {printf "%16s %-6d ", Now, NPROC }' \
+      > ${OUT_PENDING}
+  get_pen | \
+      gawk               ' {NPROC+=$4} END {printf     " %-6d ",      NPROC }' \
+      >> ${OUT_PENDING}
+  printf "\n" >> ${OUT_PENDING}
+
+fi
+
+# 2- tous les jobs running et pending
+# -----------------------------------
+
+if ( ${fg_all} ) ; then
+  get_run > ${OUT_TOUSJOBS}
+  get_pen >> ${OUT_TOUSJOBS}
+fi
+
+# Save files (WORK)
+# =================
+if ( ! ${fg_dry} ) ; then
+  Suffix=$( echo ${Today} | sed 's/-//g' )
+  [ -f ${SAVE_DIR}/${OUT_PENDING}_${Suffix} ] || echo "AAAA-MM-DD HH:MM RUN   PENDING" > ${SAVE_DIR}/${OUT_PENDING}_${Suffix}
+  cat ${OUT_PENDING} >>${SAVE_DIR}/${OUT_PENDING}_${Suffix}
+  cp ${OUT_TOUSJOBS} ${SAVE_DIR}/${OUT_TOUSJOBS}_${Suffix}
+fi
+
Index: TOOLS/ConsoGENCMIP6/launch_conso.sh
===================================================================
--- TOOLS/ConsoGENCMIP6/launch_conso.sh	(revision 2432)
+++ TOOLS/ConsoGENCMIP6/launch_conso.sh	(revision 2433)
@@ -73,2 +73,3 @@
 
 printf "\nEnd of script OK\n"
+
