未验证 提交 0ebb57de 编写于 作者: B Bo Zhou 提交者: GitHub

comiit (#392)

上级 78417815
......@@ -171,22 +171,28 @@ def start_master(port, cpu_num, monitor_port, debug, log_server_port_range):
# Redirect the output to DEVNULL to solve the warning log.
_ = subprocess.Popen(
master_command, stdout=FNULL, stderr=subprocess.STDOUT)
master_command, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True)
if cpu_num > 0:
# Sleep 1s for master ready
time.sleep(1)
_ = subprocess.Popen(
worker_command, stdout=FNULL, stderr=subprocess.STDOUT)
worker_command,
stdout=FNULL,
stderr=subprocess.STDOUT,
close_fds=True)
if _IS_WINDOWS:
# TODO(@zenghsh3) redirecting stdout of monitor subprocess to FNULL will cause occasional failure
tmp_file = tempfile.TemporaryFile()
_ = subprocess.Popen(monitor_command, stdout=tmp_file)
_ = subprocess.Popen(monitor_command, stdout=tmp_file, close_fds=True)
tmp_file.close()
else:
_ = subprocess.Popen(
monitor_command, stdout=FNULL, stderr=subprocess.STDOUT)
monitor_command,
stdout=FNULL,
stderr=subprocess.STDOUT,
close_fds=True)
FNULL.close()
if cpu_num > 0:
......@@ -285,7 +291,7 @@ def start_worker(address, cpu_num, log_server_port_range):
str(cpu_num), "--log_server_port",
str(log_server_port)
]
p = subprocess.Popen(command)
p = subprocess.Popen(command, close_fds=True)
if not is_log_server_started(get_ip_address(), log_server_port):
click.echo("# Fail to start the log server.")
......
......@@ -138,10 +138,7 @@ class TestLogServer(unittest.TestCase):
else:
FNULL = open(os.devnull, 'w')
monitor_proc = subprocess.Popen(
command,
stdout=FNULL,
stderr=subprocess.STDOUT,
)
command, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True)
# Start worker
cluster_addr = 'localhost:{}'.format(master_port)
......
......@@ -69,7 +69,7 @@ class TestJob(unittest.TestCase):
file_path = __file__.replace('reset_job_test', 'simulate_client')
command = [sys.executable, file_path]
proc = subprocess.Popen(command)
proc = subprocess.Popen(command, close_fds=True)
for _ in range(6):
if master.cpu_num == 0:
break
......
......@@ -227,7 +227,11 @@ class Worker(object):
# Redirect the output to DEVNULL
FNULL = open(os.devnull, 'w')
for _ in range(job_num):
subprocess.Popen(command, stdout=FNULL, stderr=subprocess.STDOUT)
subprocess.Popen(
command,
stdout=FNULL,
stderr=subprocess.STDOUT,
close_fds=True)
FNULL.close()
new_jobs = []
......@@ -402,10 +406,7 @@ class Worker(object):
else:
FNULL = open(os.devnull, 'w')
log_server_proc = subprocess.Popen(
command,
stdout=FNULL,
stderr=subprocess.STDOUT,
)
command, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True)
FNULL.close()
log_server_address = "{}:{}".format(self.worker_ip, port)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册