mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
Batch nodes to plugin calls
Every node was serialized in being passed to plugins. Fix this by grouping the nodes by the handler function, and then calling them by batch. This still serializes each plugin, but for now this should suffice.
This commit is contained in:
parent
735cc268d1
commit
6a3025837b
@ -426,16 +426,22 @@ def handle_node_request(configmanager, inputdata, operation,
|
||||
plugpath = None
|
||||
if 'default' in plugroute:
|
||||
plugpath = plugroute['default']
|
||||
nodesbyhandler = {}
|
||||
for node in nodes:
|
||||
for attrname in plugroute['pluginattrs']:
|
||||
if attrname in nodeattr[node]:
|
||||
plugpath = nodeattr[node][attrname]['value']
|
||||
if plugpath is not None:
|
||||
hfunc = getattr(pluginmap[plugpath], operation)
|
||||
passvalues.append(hfunc(
|
||||
nodes=(node,), element=pathcomponents,
|
||||
configmanager=configmanager,
|
||||
inputdata=inputdata))
|
||||
if hfunc in nodesbyhandler:
|
||||
nodesbyhandler[hfunc].append(node)
|
||||
else:
|
||||
nodesbyhandler[hfunc] = [node]
|
||||
for hfunc in nodesbyhandler.iterkeys():
|
||||
passvalues.append(hfunc(
|
||||
nodes=nodesbyhandler[hfunc], element=pathcomponents,
|
||||
configmanager=configmanager,
|
||||
inputdata=inputdata))
|
||||
if isnoderange:
|
||||
return itertools.chain(*passvalues)
|
||||
elif isinstance(passvalues[0], console.Console):
|
||||
|
Loading…
Reference in New Issue
Block a user