Hi,
Say I have a function run_trial
to be called by tune.run
with different hyperparameter configurations. Further, inside run_trial
, a remote function is called and the result is retrieved via ray.get
.
However when executing tune.run(run_trial)
, none of the trials is finished and Ray outputs that tasks cannot be scheduled.
An MWE is:
import ray
import time
from ray import tune
@ray.remote
def remote_hello(name):
"""a function to be called inside MyClass"""
time.sleep(1)
return "Hello, {}!".format(name)
class MyClass:
def hello(self, name):
ret_id = remote_hello.remote(name)
return ray.get(ret_id)
def run_trial(config):
obj = MyClass()
ret = obj.hello(config['name'])
tune.report(ret=ret)
trial_config = {
'name': tune.choice(['Ray', 'Tune'])
}
analysis = tune.run(
run_trial,
config=trial_config,
num_samples=2,
)
The output is something like:
The actor or task with ID {some id} cannot be scheduled right now. You can ignore this message if this Ray cluster is expected to auto-scale or if you specified a runtime_env for this actor or task, which may take time to install. Otherwise, this is likely due to all cluster resources being claimed by actors. To resolve the issue, consider creating fewer actors or increasing the resources available to this Ray cluster.
Required resources for this actor or task: {CPU_group_0: 1.000000}