[tune] 10 second timeout for stopping (#1169)

* 10 second timeout for stopping

* prints for travis

* lint

* try better returning mechanism

* lint
This commit is contained in:
Richard Liaw
2017-10-29 00:49:29 -07:00
committed by GitHub
parent 6852e8839e
commit 304c3cade4
+9 -3
View File
@@ -122,9 +122,15 @@ class Trial(object):
try:
if self.agent:
self.agent.stop.remote()
self.agent.__ray_terminate__.remote(
self.agent._ray_actor_id.id())
stop_tasks = []
stop_tasks.append(self.agent.stop.remote())
stop_tasks.append(self.agent.__ray_terminate__.remote(
self.agent._ray_actor_id.id()))
_, unfinished = ray.wait(
stop_tasks, num_returns=2, timeout=10000)
if unfinished:
print(("Stopping %s Actor was unsuccessful, "
"but moving on...") % self)
except Exception:
print("Error stopping agent:", traceback.format_exc())
self.status = Trial.ERROR