Ticket #1582: 0002-Fix-1582-spool-project-sharetree-usage-while-qmaster.patch

File 0002-Fix-1582-spool-project-sharetree-usage-while-qmaster.patch, 3.5 KB (added by markdixon, 3 years ago)
  • source/daemons/qmaster/sge_follow.c

    From 57066f424334e3eddf5244891184b346986c99d6 Mon Sep 17 00:00:00 2001
    From: Mark Dixon <m.c.dixon@leeds.ac.uk>
    Date: Fri, 2 Sep 2016 16:12:45 +0100
    Subject: [PATCH 2/2] Fix #1582 spool project sharetree usage while qmaster
     running
    
    The qmaster only writes out sharetree usage data periodically. Some
    tidying in a commit designated RD-2008-02-26-0 introduced faulty logic,
    meaning that usage was not spooled to projects in some situations.
    
    * If there were jobs running, usage would be spooled to user objects
      but not to project objects.
    * If no jobs were running, usage would be spoooled to project objects.
    
    This commit reverts to the original logic.
    ---
     source/daemons/qmaster/sge_follow.c | 30 +++++++++++++++++++-----------
     1 file changed, 19 insertions(+), 11 deletions(-)
    
    diff --git a/source/daemons/qmaster/sge_follow.c b/source/daemons/qmaster/sge_follow.c
    index c232885..9dbf777 100644
    a b sge_follow_order(sge_gdi_ctx_class_t *ctx, 
    11061106
    11071107         sge_mutex_lock("follow_last_update_mutex", SGE_FUNC, __LINE__, &Follow_Control.last_update_mutex);
    11081108
     1109         /* If still undecided, check if we need to spool */
    11091110         if (Follow_Control.is_spooling == NOT_DEFINED) {
    11101111
    1111             now = Follow_Control.now = sge_get_gmt();
     1112            Follow_Control.now = sge_get_gmt();
    11121113
    11131114            DPRINTF((">>next spooling now: %ld next: %ld\n",
    11141115                     (long) Follow_Control.now,
    11151116                     (long) Follow_Control.last_update));
    11161117
    1117             if (now >= Follow_Control.last_update) {
     1118            if (Follow_Control.now >= Follow_Control.last_update) {
    11181119               Follow_Control.is_spooling = DO_SPOOL;
    1119                is_spool = true;
    11201120            } else {
    11211121               Follow_Control.is_spooling = DONOT_SPOOL;
    11221122            }
    1123          } else {
    1124             now =  Follow_Control.now;
     1123         }
     1124
     1125         /* Spool if we need to */
     1126         now =  Follow_Control.now;
     1127         if (Follow_Control.is_spooling == DO_SPOOL) {
     1128            is_spool = true;
    11251129         }
    11261130
    11271131         sge_mutex_unlock("follow_last_update_mutex", SGE_FUNC, __LINE__, &Follow_Control.last_update_mutex);
    sge_follow_order(sge_gdi_ctx_class_t *ctx, 
    12471251
    12481252         sge_mutex_lock("follow_last_update_mutex", SGE_FUNC, __LINE__, &Follow_Control.last_update_mutex);
    12491253
     1254         /* If still undecided, check if we need to spool */
    12501255         if (Follow_Control.is_spooling == NOT_DEFINED) {
    12511256
    1252             now = Follow_Control.now = sge_get_gmt();
     1257            Follow_Control.now = sge_get_gmt();
    12531258
    1254             DPRINTF((">>next spooling now:%ld next: %ld\n",
     1259            DPRINTF((">>next spooling now: %ld next: %ld\n",
    12551260                     (long) Follow_Control.now,
    12561261                     (long) Follow_Control.last_update));
    12571262
    1258             if (now >= Follow_Control.last_update) {
     1263            if (Follow_Control.now >= Follow_Control.last_update) {
    12591264               Follow_Control.is_spooling = DO_SPOOL;
    1260                is_spool = true;
    12611265            } else {
    12621266               Follow_Control.is_spooling = DONOT_SPOOL;
    12631267            }
    1264          } else {
    1265             now =  Follow_Control.now;
     1268         }
     1269
     1270         /* Spool if we need to */
     1271         now =  Follow_Control.now;
     1272         if (Follow_Control.is_spooling == DO_SPOOL) {
     1273            is_spool = true;
    12661274         }
    12671275
    12681276         sge_mutex_unlock("follow_last_update_mutex", SGE_FUNC, __LINE__, &Follow_Control.last_update_mutex);