Skip to content

Commit

Permalink
[tune] Improve error message when Ray crashes (ray-project#3795)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardliaw authored Feb 15, 2019
1 parent 7cf62a1 commit bb7c4ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/ray/tune/ray_trial_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import traceback

import ray
from ray.tune.error import TuneError
from ray.tune.logger import NoopLogger
from ray.tune.trial import Trial, Resources, Checkpoint
from ray.tune.trial_executor import TrialExecutor
Expand Down Expand Up @@ -270,6 +271,11 @@ def _update_avail_resources(self, num_retries=5):
logger.warning("Cluster resources not detected. Retrying...")
time.sleep(0.5)

if not resources or "CPU" not in resources:
raise TuneError("Cluster resources cannot be detected. "
"You can resume this experiment by passing in "
"`resume=True` to `run_experiments`.")

resources = resources.copy()
num_cpus = resources.pop("CPU")
num_gpus = resources.pop("GPU")
Expand Down

0 comments on commit bb7c4ce

Please sign in to comment.