flux.hostlist module

class flux.hostlist.Hostlist(arg='', handle=None)

Bases: WrapperPimpl

A Flux hostlist object

The Hostlist class wraps libflux-hostlist to implement a list of hosts which can be converted to and from the RFC 29 hostlist encoding.

class InnerWrapper(handle=None)

Bases: Wrapper

append(*args)

Append one or more arguments to a Hostlist

Args may be either a Hostlist or any valid argument to Hostlist()

copy()

Copy a Hostlist object

count()

Return the number of hosts in Hostlist

delete(hosts)

Delete host or hosts from Hostlist

param: hosts: A Hostlist or string in RFC 29 hostlist encoding

encode()

Encode a Hostlist to an RFC 29 hostlist string

expand()

Convert a Hostlist to a Python list

find(host)

Return the position of a host in a Hostlist

index(hosts, ignore_nomatch=False)

Return a list of integers corresponding to the indices of hosts in the current Hostlist. :param hosts: List of hosts to find :type hosts: str, Hostlist :param ignore_nomatch: Ignore hosts in hosts that are not

present in Hostlist. Otherwise, FileNotFound error is raised with the missing hosts.

sort()

Sort a Hostlist

uniq()

Sort and remove duplicate hostnames from Hostlist

class flux.hostlist.HostlistIterator(hostlist)

Bases: object

flux.hostlist.decode(arg)

Decode a string or iterable of strings in RFC 29 hostlist format to a Hostlist object