浏览代码

[bug-fix] Set logging level in subprocesses (#3874)

/release_1_branch
GitHub 5 年前
当前提交
e57144f9
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 9
      ml-agents/mlagents/trainers/subprocess_env_manager.py

9
ml-agents/mlagents/trainers/subprocess_env_manager.py


from multiprocessing.connection import Connection
from queue import Empty as EmptyQueueException
from mlagents_envs.base_env import BaseEnv, BehaviorName
from mlagents_envs.logging_util import get_logger
from mlagents_envs import logging_util
from mlagents.trainers.env_manager import EnvManager, EnvironmentStep, AllStepResult
from mlagents_envs.timers import (
TimerNode,

from mlagents.trainers.brain_conversion_utils import behavior_spec_to_brain_parameters
logger = get_logger(__name__)
logger = logging_util.get_logger(__name__)
class EnvironmentCommand(enum.Enum):

pickled_env_factory: str,
worker_id: int,
engine_configuration: EngineConfig,
log_level: int = logging_util.INFO,
) -> None:
env_factory: Callable[
[int, List[SideChannel]], UnityEnvironment

engine_configuration_channel.set_configuration(engine_configuration)
stats_channel = StatsSideChannel()
env: BaseEnv = None
# Set log level. On some platforms, the logger isn't common with the
# main process, so we need to set it again.
logging_util.set_log_level(log_level)
def _send_response(cmd_name: EnvironmentCommand, payload: Any) -> None:
parent_conn.send(EnvironmentResponse(cmd_name, worker_id, payload))

pickled_env_factory,
worker_id,
engine_configuration,
logger.level,
),
)
child_process.start()

正在加载...
取消
保存