mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 17:23:09 +08:00
Add a nicer warning message when you pass the wrong thing to ray.wait() (#1239)
* add warnings * fix python mode * Small changes and add tests. * Fix test failure.
This commit is contained in:
committed by
Robert Nishihara
parent
c1496b8111
commit
37831ae0c3
@@ -2223,6 +2223,22 @@ def wait(object_ids, num_returns=1, timeout=None, worker=global_worker):
|
||||
A list of object IDs that are ready and a list of the remaining object
|
||||
IDs.
|
||||
"""
|
||||
|
||||
if isinstance(object_ids, ray.local_scheduler.ObjectID):
|
||||
raise TypeError(
|
||||
"wait() expected a list of ObjectID, got a single ObjectID")
|
||||
|
||||
if not isinstance(object_ids, list):
|
||||
raise TypeError("wait() expected a list of ObjectID, got {}".format(
|
||||
type(object_ids)))
|
||||
|
||||
if worker.mode != PYTHON_MODE:
|
||||
for object_id in object_ids:
|
||||
if not isinstance(object_id, ray.local_scheduler.ObjectID):
|
||||
raise TypeError(
|
||||
"wait() expected a list of ObjectID, "
|
||||
"got list containing {}".format(type(object_id)))
|
||||
|
||||
check_connected(worker)
|
||||
with log_span("ray:wait", worker=worker):
|
||||
check_main_thread()
|
||||
|
||||
Reference in New Issue
Block a user