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 Apr 14, 2022
1 parent 31df2e5 commit 7255493
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 @@ -67,7 +67,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 affect 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 @@ -76,10 +80,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 @@ -100,10 +106,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 7255493

Please sign in to comment.