source: TOOLS/ConsoGENCI/trunk/launch_conso.sh @ 4605

Last change on this file since 4605 was 3083, checked in by labetoulle, 7 years ago

Overall update (typos, get_project_list.py, ...)

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
2#
3# ==================================================================== #
4# Author: Sonia Labetoulle                                             #
5# Contact: sonia.labetoulle _at_ ipsl.jussieu.fr                       #
6# Created: March 21 2016                                               #
7# History:                                                             #
8# Modification:                                                        #
9# ==================================================================== #
10# Launch everything needed to track the consumption                    #
11# for GENCI projects.                                                  #
12# To be executed by a cron                                             #
13# ======================================================================
14
15date
16whereami=$( hostname -s )
17
18# set -vx
19
20# .. System dependant steps ..
21# ============================
22
23python_exe="python"
24case ${whereami} in
25  pc-236) 
26    echo "maison"
27    python_exe="/opt/epd7/bin/python"
28    ;;
29  curie*)
30    echo "curie"
31    # ... Initialize module command ...
32    # ---------------------------------
33    if [ -f /etc/bashrc ] ; then
34      . /etc/bashrc
35    fi
36    # ... Load python ...
37    # -------------------
38    # python/2.7.3 is the default, but it comes with matplotlib 1.2,
39    # which is too old (no context manager for PdfPages)
40    module load python/2.7.8
41    ;;
42  *)
43    echo "Unknown host ${whereami}, exit"
44    exit 1
45    ;;
46esac
47
48# Go to root directory
49# ====================
50ROOT_DIR=$( dirname $0 )
51cd ${ROOT_DIR}
52BIN_DIR=${ROOT_DIR}/bin
53
54declare -A proj_center=(["gencmip6"]="tgcc" ["rgzi"]="idris")
55
56for projet in "${!proj_center[@]}"
57do
58  centre=${proj_center[${projet}]}
59
60  echo -e "\n* ${projet}/${centre}"
61  echo -e "================================================="
62
63  # .. Insert cpt data into database ..
64  # ===================================
65  echo -e "1) Insert cpt data into table"
66  echo -e "-------------------------------------------------"
67  ${python_exe} ${BIN_DIR}/insert_conso_tbl.py -v ${projet} ${centre}
68  RC=$?
69  if [ ${RC} -gt 1 ] ; then
70    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
71    echo "!                                    ! "
72    echo "!   ERROR: script ended abnormally   !"
73    echo "!                                    ! "
74    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
75  elif [ ${RC} -ne 0 ] ; then
76    echo -e "\n   => nothing to do for ${projet}/${centre}"
77    continue
78  fi
79
80  echo "test"
81
82  # .. Plot daily consumption ..
83  # ============================
84  echo -e "\n2) Plot daily consumption"
85  echo -e "-------------------------------------------------"
86  ${python_exe} ${BIN_DIR}/plot_bilan.py -vdf ${projet} ${centre}
87done
88
Note: See TracBrowser for help on using the repository browser.