Commit 691c46d8 authored by Paul Rich's avatar Paul Rich
Browse files

Draining now respecting reservations over disjoint queues

There was a way to set up resrvations across disjoint queues that caused
one set of queues to ignore that a reservation was pending because the
reservation wasn't associated with that equivalence class.  This caused
forbidden locations to not be set.
parent d74e221f
......@@ -673,7 +673,7 @@ class CraySystem(BaseSystem):
for node_id in expand_num_list(node_hunk):
if str(node_id) in eq_class['data']:
eq_class['reservations'].add(res_name)
break
break
#don't send what could be a large block list back in the returun
for key in eq_class:
eq_class[key] = list(eq_class[key])
......@@ -681,7 +681,6 @@ class CraySystem(BaseSystem):
self.current_equivalence_classes.append(eq_class)
return equiv
@staticmethod
def _setup_special_locaitons(job):
forbidden = set([str(loc) for loc in chain_loc_list(job.get('forbidden', []))])
......@@ -876,6 +875,8 @@ class CraySystem(BaseSystem):
if int(job['nodes']) > len(available_node_list):
# Insufficient operational nodes for this job at all
continue
elif len(node_id_list) == 0:
pass #allow for draining pass to run.
elif int(job['nodes']) <= len(node_id_list):
# enough nodes are in a working state to consider the job.
# enough nodes are idle that we can run this job
......@@ -1056,7 +1057,7 @@ class CraySystem(BaseSystem):
#assemble from locaion list:
exp_location = []
if isinstance(location, list):
exp_location = self.chain_loc_list(location)
exp_location = chain_loc_list(location)
elif isinstance(location, str):
exp_location = expand_num_list(location)
else:
......
......@@ -384,6 +384,20 @@ class TestCraySystem(object):
assert val == self.system.current_equivalence_classes, (
"val/current_equivalence_class mismatch\nReturn: %s\nInternal: %s")
def test_find_queue_equivalence_classes_disjoint_reservation(self):
'''CraySystem.find_queue_equivalence_classes: bind reservation all eq classes'''
self.system.nodes['1'].queues = ['foo']
self.system.nodes['2'].queues = ['foo']
val = self.system.find_queue_equivalence_classes({'test':'1-2,4-5'}, ['default', 'foo'], [])
self.system.current_equivalence_classes
expect = [{'reservations': ['test'], 'queues': ['foo']},
{'reservations': ['test'], 'queues': ['default']}]
assert self.system.current_equivalence_classes == expect, (
'Expected %s, got %s' % (expect,
self.system.current_equivalence_classes))
assert val == self.system.current_equivalence_classes, (
"val/current_equivalence_class mismatch\nReturn: %s\nInternal: %s")
def test_clear_draining_for_queues_full_clear(self):
'''CraySystem._clear_draining_for_queues: clear queue's draining times'''
for node in self.system.nodes.values():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment