handle missing host data, use self.maxjobs as default
This commit is contained in:
parent
8b554bd3ca
commit
fadee51aff
1 changed files with 8 additions and 5 deletions
|
|
@ -191,7 +191,6 @@ class TaskScheduler(object):
|
||||||
self.active_tasks = []
|
self.active_tasks = []
|
||||||
self.free_tasks = []
|
self.free_tasks = []
|
||||||
|
|
||||||
# TODO these things need proper config
|
|
||||||
self.maxjobs = context.opts['MaxJobs']
|
self.maxjobs = context.opts['MaxJobs']
|
||||||
self.capacity_overcommit = context.opts['CapacityOvercommit']
|
self.capacity_overcommit = context.opts['CapacityOvercommit']
|
||||||
self.ready_timeout = context.opts['ReadyTimeout']
|
self.ready_timeout = context.opts['ReadyTimeout']
|
||||||
|
|
@ -282,6 +281,11 @@ class TaskScheduler(object):
|
||||||
host.setdefault('_load', 0.0)
|
host.setdefault('_load', 0.0)
|
||||||
host.setdefault('_ntasks', 0)
|
host.setdefault('_ntasks', 0)
|
||||||
host.setdefault('_demand', 0.0)
|
host.setdefault('_demand', 0.0)
|
||||||
|
# host data might be unset
|
||||||
|
hostdata = host['data']
|
||||||
|
if hostdata is None:
|
||||||
|
hostdata = {}
|
||||||
|
host.setdefault('_maxjobs', hostdata.get('maxjobs') or self.maxjobs)
|
||||||
# temporary test code
|
# temporary test code
|
||||||
logger.info(f'Host: {host}')
|
logger.info(f'Host: {host}')
|
||||||
ldiff = host['task_load'] - host['_load']
|
ldiff = host['task_load'] - host['_load']
|
||||||
|
|
@ -297,8 +301,8 @@ class TaskScheduler(object):
|
||||||
min_avail = min(0, task['weight'] - self.capacity_overcommit)
|
min_avail = min(0, task['weight'] - self.capacity_overcommit)
|
||||||
h_refused = refusals.get(task['task_id'], {})
|
h_refused = refusals.get(task['task_id'], {})
|
||||||
for host in self.hosts_by_bin.get(task['_bin'], []):
|
for host in self.hosts_by_bin.get(task['_bin'], []):
|
||||||
if (host['ready'] and host['_ntasks'] < self.maxjobs and
|
if (host['ready'] and
|
||||||
host['_ntasks'] < host['data']['maxjobs'] and
|
host['_ntasks'] < host['_maxjobs'] and
|
||||||
host['capacity'] - host['_load'] > min_avail and
|
host['capacity'] - host['_load'] > min_avail and
|
||||||
host['id'] not in h_refused):
|
host['id'] not in h_refused):
|
||||||
task['_hosts'].append(host)
|
task['_hosts'].append(host)
|
||||||
|
|
@ -325,8 +329,7 @@ class TaskScheduler(object):
|
||||||
[(h['name'], "%(_rank).2f" % h) for h in task['_hosts']])
|
[(h['name'], "%(_rank).2f" % h) for h in task['_hosts']])
|
||||||
for host in task['_hosts']:
|
for host in task['_hosts']:
|
||||||
if (host['capacity'] - host['_load'] > min_avail and
|
if (host['capacity'] - host['_load'] > min_avail and
|
||||||
host['_ntasks'] < self.maxjobs and
|
host['_ntasks'] < host['_maxjobs']):
|
||||||
host['_ntasks'] < host['data']['maxjobs']):
|
|
||||||
# add run entry
|
# add run entry
|
||||||
self.assign(task, host)
|
self.assign(task, host)
|
||||||
# update our totals and rank
|
# update our totals and rank
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue