浏览代码

Only if the logger level is higher than DEBUG will the subprocess print to console (#5212)

* Only if the logger level is higher than DEBUG will the subprocess print to console

* adding a comment
/check-for-ModelOverriders
GitHub 4 年前
当前提交
93523775
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 7
      ml-agents-envs/mlagents_envs/env_utils.py

7
ml-agents-envs/mlagents_envs/env_utils.py


import subprocess
from sys import platform
from typing import Optional, List
from mlagents_envs.logging_util import get_logger
from mlagents_envs.logging_util import get_logger, DEBUG
from mlagents_envs.exception import UnityEnvironmentException

logger.debug(f"Running with args {args}")
# Launch Unity environment
subprocess_args = [launch_string] + args
# std_out_option = DEVNULL means the outputs will not be displayed on terminal.
# std_out_option = None is default behavior: the outputs are displayed on terminal.
std_out_option = subprocess.DEVNULL if logger.level > DEBUG else None
try:
return subprocess.Popen(
subprocess_args,

# but may be undesirable in come cases; if so, we'll add a command-line toggle.
# Note that on Windows, the CTRL_C signal will still be sent.
start_new_session=True,
stdout=std_out_option,
stderr=std_out_option,
)
except PermissionError as perm:
# This is likely due to missing read or execute permissions on file.

正在加载...
取消
保存