Skip to content

Commit

Permalink
plugin: add queue_factor to priority calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoussa1 committed Mar 7, 2022
1 parent 5a5cc6e commit bd82a54
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/plugins/mf_priority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ struct queue_info {
*
* fairshare: the ratio between the amount of resources allocated vs. resources
* consumed.
*
* urgency: a user-controlled factor to prioritize their own jobs.
*
* queue: a factor that can further increase or decrease the priority of a job
* based on the queue passed in.
*/
int64_t priority_calculation (flux_plugin_t *p,
flux_plugin_arg_t *args,
Expand All @@ -71,10 +75,12 @@ int64_t priority_calculation (flux_plugin_t *p,
int urgency)
{
double fshare_factor = 0.0, priority = 0.0;
int fshare_weight;
int queue_factor = 0;
int fshare_weight, queue_weight;
struct bank_info *b;

fshare_weight = 100000;
queue_weight = 10000;

if (urgency == FLUX_JOB_URGENCY_HOLD)
return FLUX_JOB_PRIORITY_MIN;
Expand All @@ -95,10 +101,16 @@ int64_t priority_calculation (flux_plugin_t *p,
}

fshare_factor = b->fairshare;
queue_factor = b->queue_factor;

priority = (fshare_weight * fshare_factor) + (urgency - 16);
priority = round ((fshare_weight * fshare_factor) +
(queue_weight * queue_factor) +
(urgency - 16));

if (priority < 0)
return FLUX_JOB_PRIORITY_MIN;

return abs (round (priority));
return priority;
}


Expand Down

0 comments on commit bd82a54

Please sign in to comment.