Skip to content

Commit

Permalink
Move priority_sort_part_tier from slurmctld to libslurm to make it po…
Browse files Browse the repository at this point in the history
…ssible

to run the regression tests 24.* without changing that code since it links
directly to the priority plugin where that function isn't defined.

Bug 5558

Continuation of commit 21d2ab6
  • Loading branch information
dannyauble committed Aug 13, 2018
1 parent 85362a8 commit 67a82c3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -3,6 +3,9 @@ documents those changes that are of interest to users and administrators.

* Changes in Slurm 17.11.10
===========================
-- Move priority_sort_part_tier from slurmctld to libslurm to make it possible
to run the regression tests 24.* without changing that code since it links
directly to the priority plugin where that function isn't defined.

* Changes in Slurm 17.11.9-2
============================
Expand Down
13 changes: 13 additions & 0 deletions src/common/slurm_priority.c
Expand Up @@ -70,6 +70,19 @@ static plugin_context_t *g_priority_context = NULL;
static pthread_mutex_t g_priority_context_lock = PTHREAD_MUTEX_INITIALIZER;
static bool init_run = false;

extern int priority_sort_part_tier(void *x, void *y)
{
struct part_record *parta = *(struct part_record **) x;
struct part_record *partb = *(struct part_record **) y;

if (parta->priority_tier > partb->priority_tier)
return -1;
if (parta->priority_tier < partb->priority_tier)
return 1;

return 0;
}

/*
* Initialize context for priority plugin
*/
Expand Down
5 changes: 5 additions & 0 deletions src/common/slurm_priority.h
Expand Up @@ -44,6 +44,11 @@
#include "src/slurmctld/slurmctld.h"
#include "src/common/slurm_accounting_storage.h"

/*
* Sort partitions on Priority Tier.
*/
extern int priority_sort_part_tier(void *x, void *y);

extern int slurm_priority_init(void);
extern int slurm_priority_fini(void);
extern uint32_t priority_g_set(uint32_t last_prio, struct job_record *job_ptr);
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/priority/multifactor/priority_multifactor.c
Expand Up @@ -60,6 +60,7 @@

#include "src/common/parse_time.h"
#include "src/common/slurm_mcs.h"
#include "src/common/slurm_priority.h"
#include "src/common/slurm_time.h"
#include "src/common/xstring.h"
#include "src/common/gres.h"
Expand Down Expand Up @@ -585,7 +586,7 @@ static uint32_t _get_priority_internal(time_t start_time,
}

i = 0;
list_sort(job_ptr->part_ptr_list, sort_part_tier);
list_sort(job_ptr->part_ptr_list, priority_sort_part_tier);
part_iterator = list_iterator_create(job_ptr->part_ptr_list);
while ((part_ptr = (struct part_record *)
list_next(part_iterator))) {
Expand Down
2 changes: 1 addition & 1 deletion src/slurmctld/job_mgr.c
Expand Up @@ -4593,7 +4593,7 @@ static int _select_nodes_parts(struct job_record *job_ptr, bool test_only,
int best_rc = -1, part_limits_rc = WAIT_NO_REASON;

if (job_ptr->part_ptr_list) {
list_sort(job_ptr->part_ptr_list, sort_part_tier);
list_sort(job_ptr->part_ptr_list, priority_sort_part_tier);
iter = list_iterator_create(job_ptr->part_ptr_list);
while ((part_ptr = list_next(iter))) {
job_ptr->part_ptr = part_ptr;
Expand Down
13 changes: 0 additions & 13 deletions src/slurmctld/partition_mgr.c
Expand Up @@ -156,19 +156,6 @@ extern void set_partition_tres()
list_for_each(part_list, _calc_part_tres, NULL);
}

extern int sort_part_tier(void *x, void *y)
{
struct part_record *parta = *(struct part_record **) x;
struct part_record *partb = *(struct part_record **) y;

if (parta->priority_tier > partb->priority_tier)
return -1;
if (parta->priority_tier < partb->priority_tier)
return 1;

return 0;
}

/*
* build_part_bitmap - update the total_cpus, total_nodes, and node_bitmap
* for the specified partition, also reset the partition pointers in
Expand Down
5 changes: 0 additions & 5 deletions src/slurmctld/slurmctld.h
Expand Up @@ -2530,11 +2530,6 @@ waitpid_timeout(const char *, pid_t, int *, int);
*/
extern void set_partition_tres();

/*
* Sort partitions on Priority Tier.
*/
extern int sort_part_tier(void *x, void *y);

/*
* Update job's federated siblings strings.
*
Expand Down

0 comments on commit 67a82c3

Please sign in to comment.