mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
@@ -29,6 +29,8 @@ class RayTrialExecutor(TrialExecutor):
|
||||
self._avail_resources = Resources(cpu=0, gpu=0)
|
||||
self._committed_resources = Resources(cpu=0, gpu=0)
|
||||
self._resources_initialized = False
|
||||
if ray.is_initialized():
|
||||
self._update_avail_resources()
|
||||
|
||||
def _setup_runner(self, trial):
|
||||
cls = ray.remote(
|
||||
@@ -257,7 +259,16 @@ class RayTrialExecutor(TrialExecutor):
|
||||
self._committed_resources.cpu, self._avail_resources.cpu,
|
||||
self._committed_resources.gpu, self._avail_resources.gpu)
|
||||
else:
|
||||
return ""
|
||||
return "Resources requested: ?"
|
||||
|
||||
def resource_string(self):
|
||||
"""Returns a string describing the total resources available."""
|
||||
|
||||
if self._resources_initialized:
|
||||
return "{} CPUs, {} GPUs".format(self._avail_resources.cpu,
|
||||
self._avail_resources.gpu)
|
||||
else:
|
||||
return "? CPUs, ? GPUs"
|
||||
|
||||
def on_step_begin(self):
|
||||
"""Before step() called, update the available resources."""
|
||||
|
||||
Reference in New Issue
Block a user