mirror of
https://github.com/wassname/ray.git
synced 2026-07-07 15:28:52 +08:00
Updating zero capacity resource semantics (#4555)
This commit is contained in:
committed by
Robert Nishihara
parent
bb207a205b
commit
0f42f87ebc
@@ -11,7 +11,7 @@ import time
|
||||
import traceback
|
||||
|
||||
import ray
|
||||
from ray.tune.error import TuneError, AbortTrialExecution
|
||||
from ray.tune.error import AbortTrialExecution
|
||||
from ray.tune.logger import NoopLogger
|
||||
from ray.tune.trial import Trial, Resources, Checkpoint
|
||||
from ray.tune.trial_executor import TrialExecutor
|
||||
@@ -363,17 +363,22 @@ class RayTrialExecutor(TrialExecutor):
|
||||
resources = ray.services.check_and_update_resources(
|
||||
None, None, None)
|
||||
if not resources:
|
||||
logger.warning("Cluster resources not detected. Retrying...")
|
||||
logger.warning(
|
||||
"Cluster resources not detected or are 0. 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`.")
|
||||
if not resources:
|
||||
# NOTE: This hides the possibility that Ray may be waiting for
|
||||
# clients to connect.
|
||||
resources.setdefault("CPU", 0)
|
||||
resources.setdefault("GPU", 0)
|
||||
logger.warning("Cluster resources cannot be detected or are 0. "
|
||||
"You can resume this experiment by passing in "
|
||||
"`resume=True` to `run`.")
|
||||
|
||||
resources = resources.copy()
|
||||
num_cpus = resources.pop("CPU")
|
||||
num_gpus = resources.pop("GPU")
|
||||
num_cpus = resources.pop("CPU", 0)
|
||||
num_gpus = resources.pop("GPU", 0)
|
||||
custom_resources = resources
|
||||
|
||||
self._avail_resources = Resources(
|
||||
|
||||
Reference in New Issue
Block a user