[tune] fix log dir race condition (#6420)

This commit is contained in:
Yuhao Yang
2019-12-10 21:00:19 -08:00
committed by Richard Liaw
parent c61db84b8d
commit 3db8faab0d
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -552,7 +552,6 @@ def try_to_create_directory(directory_path, warn_if_exist=True):
directory_path: The path of the directory to create.
warn_if_exist (bool): Warn if the directory already exists.
"""
logger = logging.getLogger("ray")
directory_path = os.path.expanduser(directory_path)
if not os.path.exists(directory_path):
try:
@@ -561,6 +560,7 @@ def try_to_create_directory(directory_path, warn_if_exist=True):
if e.errno != errno.EEXIST:
raise e
if warn_if_exist:
logger = logging.getLogger("ray")
logger.warning(
"Attempted to create '{}', but the directory already "
"exists.".format(directory_path))