From 3ec7382ae14f29ce9d1a8fcf1b9faa6d4ad9f50c Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez <alex@schedmd.com> Date: Mon, 27 Nov 2017 11:33:16 -0700 Subject: [PATCH] Fix hetjob component incorrect Priority state reason at allocation time. _top_priority() is used to determine at job allocation time (called from job_allocate()) if any other job has a higher priority than the specified job being allocated. If so, it sets the job state_reason to WAIT_PRIORITY. This patch skips the priority comparison if the two jobs being compared are pack job components from the same heterogeneous job. Bug 4400. --- src/slurmctld/job_mgr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 61bb085f9d5..e1ee9871f8d 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -245,7 +245,7 @@ static void _signal_job(struct job_record *job_ptr, int signal, uint16_t flags); static void _suspend_job(struct job_record *job_ptr, uint16_t op, bool indf_susp); static int _suspend_job_nodes(struct job_record *job_ptr, bool indf_susp); -static bool _top_priority(struct job_record *job_ptr); +static bool _top_priority(struct job_record *job_ptr, uint32_t pack_job_offset); static int _valid_job_part(job_desc_msg_t * job_desc, uid_t submit_uid, bitstr_t *req_bitmap, struct part_record **part_pptr, @@ -4794,7 +4794,7 @@ extern int job_allocate(job_desc_msg_t * job_specs, int immediate, too_fragmented = true; if (independent && (!too_fragmented)) - top_prio = _top_priority(job_ptr); + top_prio = _top_priority(job_ptr, job_specs->pack_job_offset); else top_prio = true; /* don't bother testing, * it is not runable anyway */ @@ -11045,7 +11045,7 @@ extern void sync_job_priorities(void) * IN job_ptr - pointer to selected job * RET true if selected job has highest priority */ -static bool _top_priority(struct job_record *job_ptr) +static bool _top_priority(struct job_record *job_ptr, uint32_t pack_job_offset) { struct job_details *detail_ptr = job_ptr->details; time_t now = time(NULL); @@ -11083,6 +11083,9 @@ static bool _top_priority(struct job_record *job_ptr) list_next(job_iterator))) { if (job_ptr2 == job_ptr) continue; + if ((pack_job_offset != NO_VAL) && (job_ptr->job_id == + (job_ptr2->job_id + pack_job_offset))) + continue; if (!IS_JOB_PENDING(job_ptr2)) continue; if (IS_JOB_COMPLETING(job_ptr2)) { -- GitLab