Fix UI issue for non-json-serializable task arguments. (#1892)

* Fix UI issue for non-json-serializable task arguments.

* Simplify approach.
This commit is contained in:
Robert Nishihara
2018-04-15 13:54:42 -07:00
committed by Philipp Moritz
parent 3383553dc0
commit 7792032ee3
2 changed files with 15 additions and 2 deletions
+4
View File
@@ -594,6 +594,10 @@ class GlobalState(object):
# TODO (hme): do something to correct slider here,
# slider should be correct to begin with, though.
task_table[task_id] = self.task_table(task_id)
task_table[task_id]["TaskSpec"]["Args"] = [
repr(arg)
for arg in task_table[task_id]["TaskSpec"]["Args"]
]
except Exception as e:
print("Could not find task {}".format(task_id))
+11 -2
View File
@@ -2057,7 +2057,7 @@ class GlobalStateAPI(unittest.TestCase):
ray.init(redirect_output=True)
@ray.remote
def f():
def f(*xs):
return 1
@ray.remote
@@ -2068,7 +2068,16 @@ class GlobalStateAPI(unittest.TestCase):
def method(self):
pass
ray.get([f.remote() for _ in range(10)])
# We use a number of test objects because objects that are not JSON
# serializable caused problems in the past.
test_objects = [
0, 0.5, "hi", b"hi",
ray.put(0),
np.zeros(3), [0], (0, ), {
0: 0
}, True, False, None
]
ray.get([f.remote(obj) for obj in test_objects])
actors = [Foo.remote() for _ in range(5)]
ray.get([actor.method.remote() for actor in actors])
ray.get([actor.method.remote() for actor in actors])