Skip to content
Snippets Groups Projects
Commit b438d41a authored by Moe Jette's avatar Moe Jette
Browse files

modify preempt/qos to use actual job quality of service info (bitmaps and priority)

  from the database
parent 74ab085e
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ documents those changes that are of interest to users and admins. ...@@ -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, Former users of SchedType=sched/gang should set SchedType=sched/backfill,
PreemptType=preempt/partition_prio and PreemptMode=gang,suspend. See PreemptType=preempt/partition_prio and PreemptMode=gang,suspend. See
web and slurm.conf man page for other options. 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. -- In select/linear, optimize job placement across partitions.
-- If the --partition option is used with the sinfo or squeue command then -- If the --partition option is used with the sinfo or squeue command then
print information about even hidden partitions. print information about even hidden partitions.
......
...@@ -43,12 +43,15 @@ ...@@ -43,12 +43,15 @@
#include "src/common/bitstring.h" #include "src/common/bitstring.h"
#include "src/common/log.h" #include "src/common/log.h"
#include "src/common/plugin.h" #include "src/common/plugin.h"
#include "src/common/slurm_accounting_storage.h"
#include "src/slurmctld/slurmctld.h" #include "src/slurmctld/slurmctld.h"
const char plugin_name[] = "Preempt by Quality Of Service (QOS)"; const char plugin_name[] = "Preempt by Quality Of Service (QOS)";
const char plugin_type[] = "preempt/qos"; const char plugin_type[] = "preempt/qos";
const uint32_t plugin_version = 100; 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, static void _sort_pre_job_list(struct job_record **pre_job_p,
int pre_job_inx); int pre_job_inx);
...@@ -104,10 +107,7 @@ extern struct job_record **find_preemptable_jobs(struct job_record *job_ptr) ...@@ -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))) { while ((job_p = (struct job_record *) list_next(job_iterator))) {
if (!IS_JOB_RUNNING(job_p) && !IS_JOB_SUSPENDED(job_p)) if (!IS_JOB_RUNNING(job_p) && !IS_JOB_SUSPENDED(job_p))
continue; continue;
/* FIXME: Change to some QOS comparison */ if (!_qos_preemptable(job_p, job_ptr))
if ((job_p->account == NULL) ||
(job_ptr->account == NULL) ||
(job_p->account[0] >= job_ptr->account[0]))
continue; continue;
if ((job_p->node_bitmap == NULL) || if ((job_p->node_bitmap == NULL) ||
(bit_overlap(job_p->node_bitmap, (bit_overlap(job_p->node_bitmap,
...@@ -134,6 +134,20 @@ extern struct job_record **find_preemptable_jobs(struct job_record *job_ptr) ...@@ -134,6 +134,20 @@ extern struct job_record **find_preemptable_jobs(struct job_record *job_ptr)
return pre_job_p; 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 */ /* Sort a list of jobs, lowest priority jobs are first */
static void _sort_pre_job_list(struct job_record **pre_job_p, static void _sort_pre_job_list(struct job_record **pre_job_p,
int pre_job_inx) int pre_job_inx)
...@@ -149,9 +163,9 @@ static void _sort_pre_job_list(struct job_record **pre_job_p, ...@@ -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 * alternate algorithms could base job priority upon run time
* or other factors */ * or other factors */
for (i=0; i<pre_job_inx; i++) { for (i=0; i<pre_job_inx; i++) {
/* FIXME: Change to some numeric QOS value */ acct_qos_rec_t *qos_ee = pre_job_p[i]->qos_ptr;
if (pre_job_p[i]->account) if (qos_ee)
job_prio[i] = pre_job_p[i]->account[0] << 16; job_prio[i] = (qos_ee->priority & 0xffff) << 16;
else else
job_prio[i] = 0; job_prio[i] = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment