source: trunk/libIGCM/AA_SaveSourceModifications @ 831

Last change on this file since 831 was 770, checked in by sdipsl, 11 years ago

Adapat headers for ada.
Clean up old headers (platine, cesium, brodie, ...)

  • Property svn:executable set to *
File size: 4.4 KB
Line 
1#-Q- sx9mercure #!/bin/ksh
2#-Q- sx9mercure #####################
3#-Q- sx9mercure ## SX9MERCURE  CEA ##
4#-Q- sx9mercure #####################
5#-Q- sx9mercure #PBS -N SaveSource           # Nom du job
6#-Q- sx9mercure #PBS -j o                    # regroupement des stdout et stderr
7#-Q- sx9mercure #PBS -S /usr/bin/ksh         # shell de soumission
8#-Q- sx9mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
9#-Q- sx9mercure #PBS -l elapstim_req=0:10:00   # Limite temps a 1 heures
10#-Q- sx9mercure #PBS -q scalaire
11#-Q- sx9mercure #PBS -r n
12#-Q- titane #!/bin/ksh
13#-Q- titane ######################
14#-Q- titane ## TITANE   CEA ##
15#-Q- titane ######################
16#-Q- titane #MSUB -r SaveSource     # Nom du job               
17#-Q- titane #MSUB -n 1              # Reservation du processus
18#-Q- titane #MSUB -T 1800           # Limite de temps elapsed du job
19#-Q- titane #MSUB -E "-eo"
20#-Q- titane #MSUB -E "-L /bin/ksh"
21#-Q- titane #MSUB -E "-Ep "${ExeOutDateMax}
22#-Q- titane #MSUB -E "-Ep "${R_OUT_EXE}
23#-Q- titane #MSUB -E "-Ep "${PREFIX}
24#-Q- titane #MSUB -E "-Ep "${SUBMIT_DIR}
25#-Q- titane #MSUB -q testext
26#-Q- titane #MSUB -E '-rn'
27#-Q- lxiv8 ###################### ???
28#-Q- lxiv8 ## OBELIX      LSCE ##
29#-Q- lxiv8 ######################
30#-Q- lxiv8 #PBS -N SaveSource
31#-Q- lxiv8 #PBS -m a
32#-Q- lxiv8 #PBS -j oe
33#-Q- lxiv8 #PBS -q test 
34#-Q- lxiv8 #PBS -o SaveSource.$$
35#-Q- lxiv8 #PBS -S /bin/ksh
36#-Q- default #!/bin/ksh
37#-Q- default ##################
38#-Q- default ## DEFAULT HOST ##
39#-Q- default ##################
40
41#**************************************************************
42# Author: Martial Mancip
43# Contact: Martial.Mancip__at__ipsl.jussieu.fr
44# $Revision::                                          $ Revision of last commit
45# $Author::                                            $ Author of last commit
46# $Date::                                              $ Date of last commit
47# IPSL (2006)
48#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
49#
50#**************************************************************
51
52#set -eu
53#set -vx
54
55date
56
57#-Q- sx8brodie export OMP_NUM_THREADS=1
58#-Q- aix6 export OMP_NUM_THREADS=1
59
60#D- Task type (computing or post-processing)
61TaskType=post-processing
62
63MODIPSL=::modipsl::
64
65#D- Path to libIGCM
66#D- Default : value from AA_job if any
67# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
68# WARNING you must check MirrorlibIGCM variable in sys library.
69# WARNING If this variable is true, you must use libIGCM_POST path instead
70# WARNING of your running libIGCM directory.
71libIGCM=${libIGCM:=::modipsl::/libIGCM}
72
73. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
74      ( ${DEBUG_debug} ) && IGCM_debug_Check
75#-------
76. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
77. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
78
79IGCM_sys_MkdirWork ${RUN_DIR_PATH}
80IGCM_sys_Cd ${RUN_DIR_PATH}
81
82ExeOutDateMax=${ExeOutDateMax:=$1}
83R_OUT_EXE=${R_OUT_EXE:=$2}
84PREFIX=${PREFIX:=$3}
85SUBMIT_DIR=${SUBMIT_DIR:=$4}
86
87cd ${MODIPSL};
88${MODIPSL}/util/script_diff_model ${SUBMIT_DIR} > ${RUN_DIR_PATH}/out_script_diff_model 2>&1
89echo "script_diff_model return" $? >> ${RUN_DIR_PATH}/out_script_diff_model 2>&1
90cd ${RUN_DIR_PATH}
91
92ERR_script_diff_model=$( cat out_script_diff_model | grep "script_diff_model return [0-9]*" | sed -e "s&script_diff_model return *\([0-9]*\)&\1&" )
93
94if [ ! X${ERR_script_diff_model} = X0 ] ; then
95    echo 'Error in script_diff_model :' ${ERR_script_diff_model}
96    exit ${ERR_script_diff_model}
97fi
98
99MODIPSL_SAVE_NAME=$( cat out_script_diff_model | grep "SAVE directory in" | sed -e "s&SAVE directory in  &&" )
100MODIPSL_SAVE=${MODIPSL}/tmp/${MODIPSL_SAVE_NAME}
101if ( [ X${MODIPSL_SAVE_NAME} = X ] || [ ! -d ${MODIPSL_SAVE} ] ) ; then
102    echo 'Error in SaveSourceModifications: no MODIPSL_SAVE_NAME avaible. We STOP'
103    exit 1
104fi
105
106MaxModifiedDate=$( tail -1 ${MODIPSL_SAVE}/Last_log )
107
108cd ${MODIPSL}/tmp
109IGCM_sys_Tar ${RUN_DIR_PATH}/${MODIPSL_SAVE_NAME}.tar ${MODIPSL_SAVE_NAME}
110cd -
111if ( ! ${DEBUG_debug} ) ; then
112    IGCM_sys_Rm -rf ${MODIPSL_SAVE}
113fi
114
115if [ ${MaxModifiedDate} -lt ${ExeOutDateMax} ] ; then
116    IGCM_sys_Put_Out ${MODIPSL_SAVE_NAME}.tar ${R_OUT_EXE}/${PREFIX}_${MODIPSL_SAVE_NAME}_certified.tar
117else
118    IGCM_sys_Put_Out ${MODIPSL_SAVE_NAME}.tar ${R_OUT_EXE}/${PREFIX}_${MODIPSL_SAVE_NAME}_NOTcertified.tar
119fi
120if ( ! ${DEBUG_debug} ) ; then
121    IGCM_sys_Rm ${MODIPSL_SAVE_NAME}.tar
122fi
123
124# Clean RUN_DIR_PATH (necessary for cesium and titane only)
125if ( ! ${DEBUG_debug} ) ; then
126    IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
127fi
Note: See TracBrowser for help on using the repository browser.