From b438d41a2c5c3d94ae8de8d0de20146e7a3fdc10 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 21 Aug 2009 23:59:53 +0000 Subject: [PATCH] modify preempt/qos to use actual job quality of service info (bitmaps and priority) from the database --- NEWS | 1 + src/plugins/preempt/qos/preempt_qos.c | 28 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 8cfd2de5af9..aaf53d56c71 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ documents those changes that are of interest to users and admins. Former users of SchedType=sched/gang should set SchedType=sched/backfill, PreemptType=preempt/partition_prio and PreemptMode=gang,suspend. See web and slurm.conf man page for other options. + PreemptType=preempt/qos uses Quality Of Service information in database. -- In select/linear, optimize job placement across partitions. -- If the --partition option is used with the sinfo or squeue command then print information about even hidden partitions. diff --git a/src/plugins/preempt/qos/preempt_qos.c b/src/plugins/preempt/qos/preempt_qos.c index 5f0da069c7c..0ca830cacea 100644 --- a/src/plugins/preempt/qos/preempt_qos.c +++ b/src/plugins/preempt/qos/preempt_qos.c @@ -43,12 +43,15 @@ #include "src/common/bitstring.h" #include "src/common/log.h" #include "src/common/plugin.h" +#include "src/common/slurm_accounting_storage.h" #include "src/slurmctld/slurmctld.h" const char plugin_name[] = "Preempt by Quality Of Service (QOS)"; const char plugin_type[] = "preempt/qos"; const uint32_t plugin_version = 100; +static bool _qos_preemptable(struct job_record *preemptee, + struct job_record *preemptor); static void _sort_pre_job_list(struct job_record **pre_job_p, int pre_job_inx); @@ -104,10 +107,7 @@ extern struct job_record **find_preemptable_jobs(struct job_record *job_ptr) while ((job_p = (struct job_record *) list_next(job_iterator))) { if (!IS_JOB_RUNNING(job_p) && !IS_JOB_SUSPENDED(job_p)) continue; -/* FIXME: Change to some QOS comparison */ - if ((job_p->account == NULL) || - (job_ptr->account == NULL) || - (job_p->account[0] >= job_ptr->account[0])) + if (!_qos_preemptable(job_p, job_ptr)) continue; if ((job_p->node_bitmap == NULL) || (bit_overlap(job_p->node_bitmap, @@ -134,6 +134,20 @@ extern struct job_record **find_preemptable_jobs(struct job_record *job_ptr) return pre_job_p; } +static bool _qos_preemptable(struct job_record *preemptee, + struct job_record *preemptor) +{ + acct_qos_rec_t *qos_ee = preemptee->qos_ptr; + acct_qos_rec_t *qos_or = preemptee->qos_ptr; + + if ((qos_ee == NULL) || (qos_or == NULL) || + (qos_or->preempt_bitstr == NULL) || + (!bit_test(qos_or->preempt_bitstr, qos_ee->id))) + return false; + return true; + +} + /* Sort a list of jobs, lowest priority jobs are first */ static void _sort_pre_job_list(struct job_record **pre_job_p, int pre_job_inx) @@ -149,9 +163,9 @@ static void _sort_pre_job_list(struct job_record **pre_job_p, * alternate algorithms could base job priority upon run time * or other factors */ for (i=0; i<pre_job_inx; i++) { -/* FIXME: Change to some numeric QOS value */ - if (pre_job_p[i]->account) - job_prio[i] = pre_job_p[i]->account[0] << 16; + acct_qos_rec_t *qos_ee = pre_job_p[i]->qos_ptr; + if (qos_ee) + job_prio[i] = (qos_ee->priority & 0xffff) << 16; else job_prio[i] = 0; -- GitLab