Skip to content

Commit e037b01

Browse files
committed
python: fix filter() method in SchedResourceList class
Problem: The filter() method in the SchedResourceList class does not properly derive the set of ranks given a set of hosts. This is because the implementation assumes the index into the nodelist corresponds directly to broker ranks, but these indices need to then be used to find the broker ranks in the `ranks` attribute. Now that the ResourceSet class exports a host_ranks method, use that instead to fix the incorrect derivation of broker ranks and fix the bug. Fixes #5266
1 parent 8839811 commit e037b01

File tree

1 file changed

+1
-2
lines changed
  • src/bindings/python/flux/resource

1 file changed

+1
-2
lines changed

src/bindings/python/flux/resource/list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def filter(self, include):
5858
try:
5959
include_ranks = IDset(include)
6060
except ValueError:
61-
nodelist = self["all"].nodelist
62-
include_ranks = nodelist.index(include, ignore_nomatch=True)
61+
include_ranks = IDset(self["all"].host_ranks(include, ignore_nomatch=True))
6362
for state in ["all", "down", "allocated"]:
6463
setattr(self, state, self[state].copy_ranks(include_ranks))
6564

0 commit comments

Comments
 (0)