#4059 DNM: Randomize a bit same-rank hosts
Opened a year ago by tkopecek. Modified a year ago
tkopecek/koji randomize-hosts  into  master

file modified
+2
@@ -1,5 +1,6 @@ 

  import json

  import logging

+ import random

  import time

  

  import koji
@@ -335,6 +336,7 @@ 

          # tasks are already in priority order

          for task in self.free_tasks:

              min_avail = task['weight'] - self.capacity_overcommit

+             random.shuffle(task['_hosts'])

              task['_hosts'].sort(key=lambda h: h['_rank'])

              logger.debug('Task %i choices: %s', task['task_id'],

                           [(h['name'], "%(_rank).2f" % h) for h in task['_hosts']])

Randomization could help a bit with assigning to valid builders. Idea to be tested.

Metadata Update from @tkopecek:
- Pull-request tagged with: discussion

a year ago

I'm not sure how likely we are to have same _rank values. I guess when hosts are in same bins and have no tasks.

If we were to add this, it should probably be a config option.

The hosts aren't actually sorted to begin with, so this should be harmless except for the slight extra time.

Metadata