diff --git a/src/plugins/sched/builtin/builtin_wrapper.c b/src/plugins/sched/builtin/builtin_wrapper.c index e8126b8121a8f2491b598e31c595e48a2c08c050..e63588f3de45c3ba0482d65906488b7b6a44a5a8 100644 --- a/src/plugins/sched/builtin/builtin_wrapper.c +++ b/src/plugins/sched/builtin/builtin_wrapper.c @@ -67,11 +67,7 @@ slurm_sched_plugin_schedule( void ) /* TAG( slurm_sched_plugin_initial_priority ) */ /**************************************************************************/ u_int32_t -slurm_sched_plugin_initial_priority( void ) +slurm_sched_plugin_initial_priority( u_int32_t max_prio ) { - /* - * Any non-zero number will do. The built-in scheduler - * is FIFO by nature and so priority is not really important. - */ - return 1; + return (max_prio - 1); } diff --git a/src/plugins/sched/wiki/wiki_wrapper.cpp b/src/plugins/sched/wiki/wiki_wrapper.cpp index 037bc2835da12beca9b43d21159fb8f3df5e0f3a..1ba534f0864c9bc8779024cd04847702c1aeb68f 100644 --- a/src/plugins/sched/wiki/wiki_wrapper.cpp +++ b/src/plugins/sched/wiki/wiki_wrapper.cpp @@ -162,7 +162,7 @@ slurm_sched_plugin_schedule( void ) // TAG( slurm_sched_plugin_initial_priority ) // ************************************************************************** extern "C" u_int32_t -slurm_sched_plugin_initial_priority( void ) +slurm_sched_plugin_initial_priority( u_int32_t max_prio ) { // * // Wiki is a polling scheduler, so the initial priority is diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 84abb7347b4572bd6b17b1c6e3342becc4de5113..d9ced46ea2f2db3831ce7fa2612d0c643b6e1347 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -73,7 +73,7 @@ List job_list = NULL; /* job_record list */ time_t last_job_update; /* time of last update to job records */ /* Local variables */ -static int default_prio = TOP_PRIORITY; +static uint32_t maximum_prio = TOP_PRIORITY; static int hash_table_size = 0; static int job_count = 0; /* job's in the system */ static long job_id_sequence = -1; /* first job_id to assign new job */ @@ -504,8 +504,8 @@ static int _load_job_state(Buf buffer) _add_job_hash(job_ptr); } - if ((default_prio >= priority) && (priority > 1)) - default_prio = priority - 1; + if ((maximum_prio >= priority) && (priority > 1)) + maximum_prio = priority; if (job_id_sequence <= job_id) job_id_sequence = job_id + 1; @@ -2614,7 +2614,9 @@ static void _set_job_prio(struct job_record *job_ptr) { xassert(job_ptr); xassert (job_ptr->magic == JOB_MAGIC); - job_ptr->priority = slurm_sched_initial_priority(); + job_ptr->priority = slurm_sched_initial_priority(maximum_prio); + if (job_ptr->priority > 0) + maximum_prio = MIN(job_ptr->priority, maximum_prio); } diff --git a/src/slurmctld/sched_plugin.c b/src/slurmctld/sched_plugin.c index 014e36f9ae9bc5c9ada54eeac2f1e7ab5bfdd83d..aed71c14bfd49b5f4235424c898f0c94e1d3a225 100644 --- a/src/slurmctld/sched_plugin.c +++ b/src/slurmctld/sched_plugin.c @@ -40,7 +40,7 @@ /* ************************************************************************ */ typedef struct slurm_sched_ops { int (*schedule) ( void ); - u_int32_t (*initial_priority) ( void ); + u_int32_t (*initial_priority) ( u_int32_t ); } slurm_sched_ops_t; @@ -240,10 +240,10 @@ slurm_sched_schedule( void ) /* TAG( slurm_sched_initital_priority ) */ /* *********************************************************************** */ u_int32_t -slurm_sched_initial_priority( void ) +slurm_sched_initial_priority( u_int32_t max_prio ) { if ( slurm_sched_init() < 0 ) return SLURM_ERROR; - return (*(g_sched_context->ops.initial_priority))(); + return (*(g_sched_context->ops.initial_priority))( max_prio ); } diff --git a/src/slurmctld/sched_plugin.h b/src/slurmctld/sched_plugin.h index 43b56ea591ac76836ea5f0fde2ad11fb9ad41332..1f4cd5fdf7e3bcb4a4d603e6c786ded15641b549 100644 --- a/src/slurmctld/sched_plugin.h +++ b/src/slurmctld/sched_plugin.h @@ -24,7 +24,7 @@ int slurm_sched_schedule( void ); /* * Supply the initial SLURM priority for a newly-submitted job. */ -u_int32_t slurm_sched_initial_priority( void ); +u_int32_t slurm_sched_initial_priority( u_int32_t max_prio ); /* **************************************************************************