Skip to content

Commit

Permalink
[tune] 10 second timeout for stopping (ray-project#1169)
Browse files Browse the repository at this point in the history
* 10 second timeout for stopping

* prints for travis

* lint

* try better returning mechanism

* lint
  • Loading branch information
richardliaw authored Oct 29, 2017
1 parent 6852e88 commit 304c3ca
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/ray/tune/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ def stop(self, error=False):

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
Expand Down

0 comments on commit 304c3ca

Please sign in to comment.