def GetRunningAmfNodes(self): """Return a list of existing nodes as AmfNode objects. The \ref clusterinfo.ClusterInfo module provides a much more extensive API """ nodedict = asppycustom.GetRunningNodeList() ret = [] for node in nodedict: ret.append(AmfNode(node["name"], node["slot"])) return ret
def GetAllWorkAssignments(self): """ Return a large nested dictionary describing the cluster's current work assignment state The \ref clusterinfo module provides a much more extensive API """ ret = {} nodes = asppycustom.GetRunningNodeList() for node in nodes: node.update(asppycustom.GetWorkOnNode(node["name"])) ret[node["name"]] = node return ret
def GetNodes(self): """Return a list of existing nodes where each node is a dictionary The \ref clusterinfo module provides a much more extensive API """ nodes = self.GetConfiguredNodeNames() running = asppycustom.GetRunningNodeList() name2slot = {} for r in running: name2slot[r['name']] = r['slot'] ret = [] for nodename in nodes: config = asp.clAmsMgmtNodeGetConfig(self.hdl, nodename) state = asp.clAmsMgmtNodeGetStatus(self.hdl, nodename) slot = name2slot.get(nodename, None) n = AmfNode(nodename, slot) n.setConfig(config) n.setState(state) ret.append(n) return ret