Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions python/ray/experimental/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,3 +1191,19 @@ def error_messages(self, job_id=None):
binary_to_hex(job_id): self._error_messages(ray.ObjectID(job_id))
for job_id in job_ids
}

def dump_task_timeline(self, file_name, num_tasks, start=None, end=None, fwd=True):
"""Fetch a number of task profiles and dump them to a file

Args:
path: The filepath to dump the profiling information to.
num_tasks: A limit on the number of tasks that task_profiles will return.
start: The start point of the time window that is queried for tasks.
end: The end point in time of the time window that is queried for tasks.
fwd: If True, means that zrange will be used. If False, zrevrange.
This argument is only meaningful in conjunction with the
num_tasks argument. This controls whether the tasks returned
are the most recent or the least recent.
"""
task_info = self.task_profiles(num_tasks, start, end, fwd)
self.dump_catapult_trace(file_name, task_info)
4 changes: 1 addition & 3 deletions test/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2295,9 +2295,7 @@ def method(self):
ray.get([actor.method.remote() for actor in actors])

path = os.path.join("/tmp/ray_test_trace")
task_info = ray.global_state.task_profiles(
100, start=0, end=time.time())
ray.global_state.dump_catapult_trace(path, task_info)
ray.global_state.dump_task_timeline(path, 100, start=0, end=time.time())

# TODO(rkn): This test is not perfect because it does not verify that
# the visualization actually renders (e.g., the context of the dumped
Expand Down