Skip to content

Commit

Permalink
Fix UI issue for non-json-serializable task arguments. (ray-project#1892
Browse files Browse the repository at this point in the history
)

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

* Simplify approach.
  • Loading branch information
robertnishihara authored and pcmoritz committed Apr 15, 2018
1 parent 3383553 commit 7792032
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions python/ray/experimental/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ def dump_catapult_trace(self,
# 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))

Expand Down
13 changes: 11 additions & 2 deletions test/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ def testDumpTraceFile(self):
ray.init(redirect_output=True)

@ray.remote
def f():
def f(*xs):
return 1

@ray.remote
Expand All @@ -2068,7 +2068,16 @@ def __init__(self):
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])
Expand Down

0 comments on commit 7792032

Please sign in to comment.