flux.resource.ResourceSet module
- class flux.resource.ResourceSet.ResourceSet(arg=None, version=1)
Bases:
object
ResourceSet object constructor.
- Parameters
arg -- Argument from which to construct a ResourceSet. arg may be a serialized R string, a decoded Mapping of an R string, or a valid ResourceSet implementation (an instance of ResourceSetImplementation)
version -- R specification version
- Raises
TypeError -- A ResourceSet cannot be instantiated from arg
ValueError -- Invalid R version, or invalid R encoding
KeyError -- arg was a dict without a 'version' key
json.decoder.JSONDecodeError -- arg is an Invalid JSON string
All parameters are optional. ResourceSet() will initialize an empty, version 1 ResourceSet object.
- add(*args)
Add resources to a ResourceSet that are not already members
- append(*args)
Append a ResourceSet to another
- copy()
Return a copy of a ResourceSet
- copy_constraint(constraint)
Return a copy of a ResourceSet containing only those resources that match the RFC 31 constraint object constraint
- Parameters
constraint -- An RFC 31 constraint object in encoded string form or as Python mapping. (The mapping will be converted to a JSON string)
- copy_ranks(ranks)
Copy only the rank or ranks specified from the ResourceSet
- Parameters
ranks -- A flux.idset.IDset object, or number or string which can be converted into an IDset, containing the ranks to copy
- count(name)
Return a count of resource objects within a ResourceSet
- Parameters
name -- The name of the object to count, e.g. "core"
- diff(*args)
Return a new ResourceSet with elements in this set that are not in the others.
Equivalent to
set - other - ...
.
- dumps()
Return a short-form, human-readable string of a ResourceSet object
- encode()
Encode a ResourceSet object to its serialized string representation
- get_properties()
Return an RFC 20 properties object for this ResourceSet
- host_ranks(hosts, ignore_nomatch=False)
Translate a set of hostnames to broker ranks using the current ResourceSet.
- Parameters
ignore_nomatch (bool) --
If True, then hosts that are not in the current ResourceSet are ignored, and only matching hosts result in a returned rank. O/w, FileNotFound error
is raised.
- Returns
list of rank ids in order of provided hosts
- intersect(*args)
Return a new ResourceSet with elements common to this set and all others.
Equivalent to
set & other & ...
.
- property ncores
- property ngpus
- property nnodes
- property nodelist
Return a flux.hostlist.Hostlist containing the list of hosts in this ResourceSet
- property properties
- property ranks
Return a flux.idset.IDset containing the set of ranks in this ResourceSet
- remove_ranks(ranks)
Remove the rank or ranks specified from the ResourceSet
- Parameters
ranks -- A flux.idset.IDset object, or number or string which can be converted into an IDset, containing the ranks to remove
- property rlist
- set_property(name, ranks=None)
Set property 'name' on optional 'ranks' (all ranks if ranks is None)
- property state
An optional state associated with this ResourceSet (e.g. "up")
- union(*args)
Return a new ResourceSet with elements from this set and all others.
Equivalent to
set | other | ...
.