Ticket #1552: 0001-Fix-1552-Sort-advance-reservations-when-reading-list.patch

File 0001-Fix-1552-Sort-advance-reservations-when-reading-list.patch, 2.5 KB (added by markdixon, 4 years ago)
  • source/libs/sgeobj/sge_advance_reservation.c

    From b77cacc9a7654ba63b760d9c74193432405e600d Mon Sep 17 00:00:00 2001
    From: Mark Dixon <m.c.dixon@leeds.ac.uk>
    Date: Thu, 3 Sep 2015 11:08:04 +0100
    Subject: [PATCH] Fix #1552 Sort advance reservations when reading list from spool
    
    Sort advance reservations by AR_id when reading the list of them from
    the spool. This avoids an odd sort order being presented to the user
    via tools like qrstat.
    ---
     source/libs/sgeobj/sge_advance_reservation.c |   26 ++++++++++++++++++++++++++
     source/libs/sgeobj/sge_advance_reservation.h |    2 ++
     source/libs/spool/sge_spooling_utilities.c   |    3 +++
     3 files changed, 31 insertions(+), 0 deletions(-)
    
    diff --git a/source/libs/sgeobj/sge_advance_reservation.c b/source/libs/sgeobj/sge_advance_reservation.c
    index 2e8b595..56bb1f4 100644
    a b bool sge_ar_has_errors(lListElem *ar) { 
    488488
    489489   DRETURN(ret);
    490490}
     491
     492/****** sge_advance_reservation/ar_list_sort() ********************************
     493*  NAME
     494*     ar_list_sort() -- Sort a AR_Type list
     495*
     496*  SYNOPSIS
     497*     int ar_list_sort(lList *this_list)
     498*
     499*  FUNCTION
     500*     Sort a AR_Type list
     501*
     502*  INPUTS
     503*     lList *this_list - AR_Type list
     504*
     505*  RESULT
     506*     int - error state
     507*         0 - OK
     508*        -1 - Error
     509*******************************************************************************/
     510int ar_list_sort(lList *this_list) {
     511   DENTER(BASIS_LAYER, "ar_list_sort");
     512
     513   int ret = lPSortList(this_list, "%I+", AR_id);
     514
     515   DRETURN(ret);
     516}
  • source/libs/sgeobj/sge_advance_reservation.h

    diff --git a/source/libs/sgeobj/sge_advance_reservation.h b/source/libs/sgeobj/sge_advance_reservation.h
    index 556eab4..96e46d8 100644
    a b void ar_state2dstring(ar_state_t state, dstring *state_as_string); 
    9292
    9393bool sge_ar_has_errors(lListElem *ar);
    9494
     95int ar_list_sort(lList *this_list);
     96
    9597#endif /* __SGE_ADVANCE_RESERVATION_H */
  • source/libs/spool/sge_spooling_utilities.c

    diff --git a/source/libs/spool/sge_spooling_utilities.c b/source/libs/spool/sge_spooling_utilities.c
    index d8e5e4e..00e15af 100644
    a b spool_default_validate_list_func(lList **answer_list, 
    587587         ret = sconf_validate_config_(answer_list);
    588588         break;
    589589      case SGE_TYPE_JOB:
     590         break;
    590591      case SGE_TYPE_AR:
     592         ar_list_sort(*object_type_get_master_list(SGE_TYPE_AR));
     593         break;
    591594      default:
    592595         break;
    593596   }