Ignore:
Timestamp:
11/09/10 16:02:49 (14 years ago)
Author:
sdipsl
Message:
  • Add a IGCM_config_Check function to test coherency between post-processing frequency. See #29. Will exit before execution if incoherency are found (example rebuild every 6 months, having a 1Y PeriodLenght? and a 2 months TimeSeriesFrequency?...)
  • libIGCM_post.ksh refactoring, making general function to handle frequency, easier to read hopefully. Still some simplification to add
  • DRYRUN was not maintain since a long time. Fix that. Minor adaptation still need to be done for sx8 and sx9 (ie when you want to DRYRUN from a machine initially devoted to the post-processing). DRYRUN is aimed for developpement purpose, prefer StandAlone? method to post-process after the fact.
  • we clean SUBMIT_DIR keeping only the 5 youngest Script_Output_* files. Good for workdir quota.
  • simplify rebuildFrom* options : remove R_SAVE and config_UserChoices_JobName used by IGCM_Patch_20091118_mask.ksh. rebuild.ksh will define that ; AA_create* already know that.
  • when exiting because of a RErun an old job : be more explicit and point the files who initiated this action, together with a link to clean_month.job
  • remove some redundant typeset
  • clean libIGCM_sys.ksh : remove machines
  • and cosmetics.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r373 r380  
    269269            IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 
    270270            PeriodLengthInDays=0 
    271             typeset i 
    272271            i=0 
    273272            until [ $i -ge $PeriodLengthInYears ] ; do  
     
    280279            IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 
    281280            PeriodLengthInDays=0 
    282             typeset i 
    283281            i=0 
    284282            until [ $i -ge $PeriodLengthInMonths ] ; do  
     
    300298 
    301299    IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" 
    302  
     300} 
     301 
     302#=================================== 
     303function IGCM_config_Check 
     304{ 
     305    IGCM_debug_PushStack "IGCM_config_Check" 
     306 
     307    # If one of the following modulo is not zero : 
     308    # we will issue an error then explain and exit in 
     309    # AA_job IGCM_debug_Verif_Exit call before binary submission 
     310 
     311    echo 
     312    IGCM_debug_Print 1 "IGCM_config_Check :" 
     313    echo 
     314 
     315    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
     316        AsynchronousRebuild=true 
     317        IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 
     318        echo 
     319        # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero 
     320        IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 
     321        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency 
     322        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency 
     323    else 
     324        AsynchronousRebuild=false 
     325        IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 
     326        IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 
     327        echo 
     328        #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 
     329        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength 
     330        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength 
     331    fi 
     332 
     333    IGCM_debug_PopStack "IGCM_config_Check" 
    303334} 
    304335 
     
    435466        if [ ${DRYRUN} -le 0 ] ; then 
    436467            if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then 
    437                 IGCM_debug_Exit "IGCM_config_PeriodStart" "RErun an old job." 
     468                IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 
    438469                IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 
    439470                IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 
    440                 IGCM_debug_Print 1 " the whole ${R_SAVE} tree." 
     471                IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 
     472                IGCM_debug_Print 1 " This exit has been initiated because at least ${R_OUT_KSH}/${PREFIX}_${Exe_Output} exists." 
    441473                IGCM_debug_Verif_Exit 
    442474            fi 
     
    476508    #==================================# 
    477509 
    478     typeset i 
    479     (( i=0 )) 
    480     if ( ${FirstInitialize} ) ; then 
    481         run_Log_LastExeSize="" 
    482         for comp in ${config_ListOfComponents[*]} ; do 
    483             run_Log_LastExeSize[$i]=0 
    484             (( i=i+1 )) 
    485         done 
    486     else 
    487         IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    488     fi 
    489  
     510    if [ ${DRYRUN} -le 1 ] ; then 
     511        (( i=0 )) 
     512        if ( ${FirstInitialize} ) ; then 
     513            run_Log_LastExeSize="" 
     514            for comp in ${config_ListOfComponents[*]} ; do 
     515                run_Log_LastExeSize[$i]=0 
     516                (( i=i+1 )) 
     517            done 
     518        else 
     519            IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
     520        fi 
     521    fi 
    490522    #==================================# 
    491523    #         And Build ExeDate        # 
     
    532564        (( i=i+1 )) 
    533565 
    534         if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
    535             if ( ${FirstInitialize} ) ; then 
    536                 IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" 
    537             else 
    538                 IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
    539                 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
     566        if [ ${DRYRUN} -le 1 ] ; then 
     567            if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
     568                if ( ${FirstInitialize} ) ; then 
     569                    IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" 
     570                else 
     571                    IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
     572                    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
     573                fi 
     574                eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    540575            fi 
    541             eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    542576        fi 
    543577    done 
    544578 
    545579    if [ ${DRYRUN} -le 1 ] ; then 
    546         typeset ExeCpuLog 
    547580        tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt 
    548581        ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) 
     
    688721 
    689722    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then 
    690  
    691723        #==========================# 
    692724        # End of entire simulation # 
     
    704736            IGCM_sys_Tree ${R_SAVE} 
    705737        fi 
    706      
    707738    else 
    708  
    709739        #=================# 
    710740        # Submit next job # 
     
    719749        # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR 
    720750        IGCM_sys_Cd ${SUBMIT_DIR} 
     751        # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} 
     752        ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? > /dev/null 2>&1 | wc -l ) 
     753        [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) 
     754        # Submit next job and come back 
    721755        IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} 
    722756        IGCM_sys_Cd - 
Note: See TracChangeset for help on using the changeset viewer.