Ray timeline custom events

How severe does this issue affect your experience of using Ray?

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

I try a demo and get a timeline file. it shows like below.

my script is:

import ray

ray.init()

@ray.remote
def f(x):
    return x * x

future = f.remote(2.0)
value = ray.get(future)
print(value)

import time
time.sleep(1)
ray.timeline(filename="./ray_timeline.json")``

submit_task is in ray core and task::f is my own function. I want to know when ray.get(future) is executed. What should I do? Is there an in-build function to do this?
something likes this

start=time.time()
do some
end=time.time()-start

By custom events, I can figure out how tasks or actors work on different nodes.

Unfortunately there is no public API for this, but there is a private API for profiling events. I think this is a useful addition, so I went ahead and opened a github issue to track this.

For now, you can use the private API, but note that this may get deprecated without warning in future releases.

import ray._private.profiling as profiling

with profiling.profile("custom event"):
  ...