Ticket #1549: 0001-Fix-1549-sge_calc_tickets-preserve-project-usage-aft.patch

File 0001-Fix-1549-sge_calc_tickets-preserve-project-usage-aft.patch, 2.3 KB (added by markdixon, 5 years ago)

Second attempt at fix

  • source/libs/sched/sgeee.c

    From 69e8c3613958bd94131d8378530c2c7aa4cf3b86 Mon Sep 17 00:00:00 2001
    From: Mark Dixon <m.c.dixon@leeds.ac.uk>
    Date: Wed, 2 Sep 2015 12:17:53 +0100
    Subject: [PATCH] Fix #1549 sge_calc_tickets - preserve project usage after qmaster restart
    
    As well as the spool's project objects, usage is stored in user objects.
    This commit regenerates the project usage from the available user objects
    during the first scheduling run.
    
    Without this change, project usage associated with users is lost across
    qmaster restarts.
    ---
     source/libs/sched/sgeee.c |   28 ++++++++++++++++++++++++++++
     1 files changed, 28 insertions(+), 0 deletions(-)
    
    diff --git a/source/libs/sched/sgeee.c b/source/libs/sched/sgeee.c
    index 1182640..6437dae 100644
    a b sge_calc_tickets( scheduler_all_data_t *lists, 
    26412641      calculate_default_decay_constant(sconf_get_halftime());
    26422642   }
    26432643
     2644   /*------------------------------------------------------------------------
     2645    * First scheduling interval - complete project initialisation:
     2646    * Project usage can be spooled to user objects as well as project objects.
     2647    * Now that this has been suitably decayed, add to the project objects.
     2648    *------------------------------------------------------------------------*/
     2649
     2650   if (do_usage && sge_scheduling_run == 1) {
     2651      lListElem *user;
     2652      for_each(user, lists->user_list) {
     2653         lListElem *uu_project;
     2654         for_each(uu_project, lGetList(user, UU_project)) {
     2655            /* Add usage held in user object to project */
     2656            lListElem *project = prj_list_locate(lists->project_list,
     2657                                             lGetString(uu_project, UPP_name));
     2658            if (project) {
     2659               if (lGetList(project, PR_usage)) {
     2660                  usage_list_sum(lGetList(project, PR_usage),
     2661                                 lGetList(uu_project, UPP_usage));
     2662               } else {
     2663                  lSetList(project, PR_usage,
     2664                           lCopyList("usage", lGetList(uu_project, UPP_usage)));
     2665               }
     2666            }
     2667         }
     2668      }
     2669   }
     2670
     2671
    26442672   /*-------------------------------------------------------------
    26452673    * Init job_ref_count in each share tree node to zero
    26462674    *-------------------------------------------------------------*/