您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
59 行
1.2 KiB
59 行
1.2 KiB
import logging
|
|
|
|
logger = logging.getLogger("mlagents.envs")
|
|
|
|
|
|
class UnityException(Exception):
|
|
"""
|
|
Any error related to ml-agents environment.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class UnityEnvironmentException(UnityException):
|
|
"""
|
|
Related to errors starting and closing environment.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class UnityCommunicationException(UnityException):
|
|
"""
|
|
Related to errors with the communicator.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class UnityActionException(UnityException):
|
|
"""
|
|
Related to errors with sending actions.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class UnityTimeOutException(UnityException):
|
|
"""
|
|
Related to errors with communication timeouts.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class UnityWorkerInUseException(UnityException):
|
|
"""
|
|
This error occurs when the port for a certain worker ID is already reserved.
|
|
"""
|
|
|
|
MESSAGE_TEMPLATE = (
|
|
"Couldn't start socket communication because worker number {} is still in use. "
|
|
"You may need to manually close a previously opened environment "
|
|
"or use a different worker number."
|
|
)
|
|
|
|
def __init__(self, worker_id):
|
|
message = self.MESSAGE_TEMPLATE.format(str(worker_id))
|
|
super(UnityWorkerInUseException, self).__init__(message)
|