Skip to content

Commit caa6acc

Browse files
committed
flux-resource: add queue argument to ResourceSetExtra initializer
Problem: An empty resource set cannot have any associated properties and therefore cannot be in a queue. However, in `flux resource list` output, it may be useful to display an "empty" line of output for one or more queues. For instance, when no nodes are allocated, down, etc. Allow the ResourceSetExtra class to have a forced queue associated with it. If set in the initializer, then instead of iterating properties to deterimine the resource set queue the manually set queue is simply returned. This allows an empty resource set to have an associated queue.
1 parent 777145b commit caa6acc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cmd/flux-resource.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,9 @@ def drain_list(args):
492492

493493

494494
class ResourceSetExtra(ResourceSet):
495-
def __init__(self, arg=None, version=1, flux_config=None):
495+
def __init__(self, arg=None, version=1, flux_config=None, queue=None):
496496
self.flux_config = flux_config
497+
self._queue = queue
497498
if isinstance(arg, ResourceSet):
498499
self._rset = arg
499500
if arg.state:
@@ -517,6 +518,13 @@ def propertiesx(self):
517518

518519
@property
519520
def queue(self):
521+
# Note: queue may be set manually in self._queue for an empty
522+
# ResourceSet, which cannot otherwise have an associated queue.
523+
if self._queue is not None:
524+
return self._queue
525+
526+
# If self._queue is not set, then build list of queues from
527+
# set properties and queue configuration:
520528
queues = ""
521529
if self.flux_config and "queues" in self.flux_config:
522530
if not self.ranks:

0 commit comments

Comments
 (0)