PipelineFX Forum
Qube! => Developer Customization => Topic started by: methodhai on March 06, 2008, 04:58:03 AM
-
Is it possible to retrieve the list of groups and clusters from the within the Python API?
Thanks,
Hai
-
Currently the way to do this is to gather the host information through qb.hostinfo() and then extract out the groups and clusters from there. Here is some sample python to extract out the groups and cluster information using just the qb python module.
Clusters:
clusters = [i['cluster'].strip() for i in qb.hostinfo()]
clusters = [i for i in clusters if len(i) > 0] # remove empty items
clusters = list(set(clusters)) # make sure unique
Groups:
groups = []
for i in qb.hostinfo():
groups.extend(i['groups'].strip().split(','))
groups = [i.strip() for i in groups if len(i) > 0] # remove empty&whitespace
groups = list(set(groups)) # make sure unique
-
Excellent. Thanks Scot.
-
You're welcome Hai.