Commit e6287ed5 authored by Felix Seibert's avatar Felix Seibert
Browse files

fixing popen.communicate() usage

parent 79cb4c7a
......@@ -223,19 +223,19 @@ class OSDManager(object):
div_util.print_process_list(processes)
processes = div_util.run_commands(delete_replica_command_list)
successfull_deletions = []
# successfull_deletions = []
errored_deletions = []
while True:
if self.debug:
print("executing " + str(len(processes)) + " delete replica commands done. Results:")
div_util.print_process_list(processes)
for process in processes:
stdout, stderr = process.communicate()
if stderr == b'':
if process[2] == b'':
pass
else:
errored_deletions.append(process.args)
errored_deletions.append(process[0])
if len(errored_deletions) == 0:
break
......
......@@ -47,15 +47,14 @@ def run_commands(commands, max_processes=200):
for p in running_processes:
p.wait()
return all_processes
return list(map(lambda proc: (proc.args, proc.communicate), all_processes))
def print_process_list(processes):
for process in processes:
print("command: " + str(process.args))
stdout, stderr = process.communicate()
print("stoud: " + str(stdout))
print("stderr: " + str(stderr))
print("command: " + str(process[0]))
print("stoud: " + str(process[1]))
print("stderr: " + str(process[2]))
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment