[tune] Avoid crash in client mode when return results creating logdir (#14115)

This commit is contained in:
Eric Liang
2021-02-15 19:25:14 -08:00
committed by GitHub
parent 350fb5b9d1
commit e434ffe06c
+7 -1
View File
@@ -1,6 +1,7 @@
from typing import Callable, Dict, Sequence, Union
import json
import ray
import ray.cloudpickle as cloudpickle
from collections import deque
import copy
@@ -640,4 +641,9 @@ class Trial:
self.__dict__.update(state)
validate_trainable(self.trainable_name)
self.init_logdir() # Create logdir if it does not exist
# Avoid creating logdir in client mode for returned trial results,
# since the dir might not be creatable locally. TODO(ekl) thsi is kind
# of a hack.
if not ray.util.client.ray.is_connected():
self.init_logdir() # Create logdir if it does not exist