2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Merge pull request #74 from jjohnson42/reworkworkers

Rework IPMI workers
This commit is contained in:
Jarrod Johnson 2017-04-25 15:29:14 -04:00 committed by GitHub
commit 5471aca5b4

View File

@ -273,17 +273,23 @@ def perform_requests(operator, nodes, element, cfg, inputdata):
configdata = cfg.get_node_attributes(nodes, _configattributes)
cfg.decrypt = cryptit
resultdata = queue.LightQueue()
pendingnum = len(nodes)
livingthreads = set([])
for node in nodes:
_ipmiworkers.spawn_n(
livingthreads.add(_ipmiworkers.spawn(
perform_request, operator, node, element, configdata, inputdata,
cfg, resultdata)
while pendingnum:
datum = resultdata.get()
if datum == 'Done':
pendingnum -= 1
else:
yield datum
cfg, resultdata))
while livingthreads:
try:
datum = resultdata.get(timeout=10)
while datum:
if datum != 'Done':
yield datum
datum = resultdata.get_nowait()
except queue.Empty:
pass
for t in list(livingthreads):
if t.dead:
livingthreads.discard(t)
def perform_request(operator, node, element,