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:
Eric Liang
2017-11-27 22:57:33 -08:00
committed by Robert Nishihara
parent c1496b8111
commit 37831ae0c3
3 changed files with 26 additions and 1 deletions
+9
View File
@@ -749,6 +749,15 @@ class APITest(unittest.TestCase):
self.assertEqual(ready_ids, [])
self.assertEqual(remaining_ids, [])
# Verify that incorrect usage raises a TypeError.
x = ray.put(1)
with self.assertRaises(TypeError):
ray.wait(x)
with self.assertRaises(TypeError):
ray.wait(1)
with self.assertRaises(TypeError):
ray.wait([1])
def testMultipleWaitsAndGets(self):
# It is important to use three workers here, so that the three tasks
# launched in this experiment can run at the same time.