#4040 Use builder's maxjobs setting
Closed a year ago by mikem. Opened a year ago by tkopecek.
tkopecek/koji issue4038  into  master

file modified
+13
@@ -24,6 +24,7 @@ 

  

  import errno

  import hashlib

+ import json

  import logging

  import os

  import re
@@ -1025,9 +1026,21 @@ 

                  else:

                      self.logger.info("Lingering task %r (pid %r)" % (id, pid))

  

+     def _get_host_data(self):

+         data = {

+             'methods': list(self.handlers.keys()),

+             'maxjobs': self.options.maxjobs,

+             # TODO: now it would be duplicated by updateHost

+             #'ready': self.ready,

+             #'task_load': self.task_load,

+             #cpu_load, free_mem, free_disk, ...

+         }

+         return data

+ 

      def getNextTask(self):

          self.ready = self.readyForTask()

          self.session.host.updateHost(self.task_load, self.ready)

+         self.session.host.setHostData(json.dumps(self._get_host_data()))

          if not self.ready:

              self.logger.info("Not ready for task")

              return False

file modified
+6 -2
@@ -298,6 +298,7 @@ 

              h_refused = refusals.get(task['task_id'], {})

              for host in self.hosts_by_bin.get(task['_bin'], []):

                  if (host['ready'] and host['_ntasks'] < self.maxjobs and

+                         host['_ntasks'] < host['data']['maxjobs'] and

                          host['capacity'] - host['_load'] > min_avail and

                          host['id'] not in h_refused):

                      task['_hosts'].append(host)
@@ -324,7 +325,8 @@ 

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

              for host in task['_hosts']:

                  if (host['capacity'] - host['_load'] > min_avail and

-                         host['_ntasks'] < self.maxjobs):

+                         host['_ntasks'] < self.maxjobs and

+                         host['_ntasks'] < host['data']['maxjobs']):

                      # add run entry

                      self.assign(task, host)

                      # update our totals and rank
@@ -535,6 +537,7 @@ 

              ('host.ready', 'ready'),

              ('host_config.arches', 'arches'),

              ('host_config.capacity', 'capacity'),

+             ('scheduler_host_data.data', 'data'),

          )

          fields, aliases = zip(*fields)

  
@@ -547,7 +550,8 @@ 

                  'host_config.active IS TRUE',

              ],

              joins=[

-                 'host_config ON host.id = host_config.host_id'

+                 'LEFT JOIN host_config ON host.id = host_config.host_id',

+                 'LEFT JOIN scheduler_host_data ON host.id = scheduler_host_data.host_id',

              ]

          )

  

Use builder's maxjobs setting and cap it by hub's MaxJobs.

Maybe drop hub's settings completely?

Pull-Request has been closed by mikem

a year ago
Metadata