You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prototype experimental ray.status API or design alternative API. #953
One API that may be useful for some workloads is the ability to call ray.status(object_id) and within a task to be able to call ray.update_status(value) or something like that.
For hyperparameter search, this could notify the driver about progress. It could also be used to make decisions about cancelling certain tasks or actors (see #854).
This introduces challenges for handling failures and recovering prior state.
I'm actually not quite sure about whether we should have status API around object or task. The current Ray API exposes only object IDs but not task IDs, with which we can only have status around objects. However, the status around task seems more natural regarding to the purpose of using the status (and of course, the task status can contain the status for its written objects, but not the opposite).
Then ray.status(id1), ray.status(id2), and ray.status(id3) would all return the same thing.
It is possible to have something like ray.status(task_id). The task ID is partially exposed at the moment through the information in ray.global_state.object_table(), which has a mapping from the ID of an object to the ID of the task that created it.
One other thing that wasn't specified: I'm imagining ray.status as a non-blocking call which immediately returns the latest status (which is None if there is no status).
As @pcmoritz brought up. Once we can pass actor handles to tasks/actors (#1075), then we will be able to do this for free. For example:
@ray.remoteclassStatusActor(object):
defupdate_status(self, status):
self.status=statusdefget_status(self):
returnself.status@ray.remotedeffoo(status_actor):
foriinrange(100):
# Do some work
...
# Report statusstatus_actor.update_status.remote(i)
# On the driver, create a status actor and start a task.status_actor=StatusActor.remote()
foo.remote(status_actor)
# Read the statuses and do something.whileTrue:
status=ray.get(status_actor.get_status.remote())
# Do something based on the status.
Activity
imzhenyu commentedon Sep 9, 2017
I'm actually not quite sure about whether we should have status API around object or task. The current Ray API exposes only object IDs but not task IDs, with which we can only have status around objects. However, the status around task seems more natural regarding to the purpose of using the status (and of course, the task status can contain the status for its written objects, but not the opposite).
robertnishihara commentedon Sep 9, 2017
Right, the advantage of
ray.status(object_id)is just the the user already has the task ID, but presumably if you doThen
ray.status(id1),ray.status(id2), andray.status(id3)would all return the same thing.It is possible to have something like
ray.status(task_id). The task ID is partially exposed at the moment through the information inray.global_state.object_table(), which has a mapping from the ID of an object to the ID of the task that created it.One other thing that wasn't specified: I'm imagining
ray.statusas a non-blocking call which immediately returns the latest status (which isNoneif there is no status).[-]Prototype experimental ray.status API.[/-][+]Prototype experimental ray.status API or design alternative API.[/+]robertnishihara commentedon Oct 16, 2017
Some work on this in #1134.
robertnishihara commentedon Oct 17, 2017
As @pcmoritz brought up. Once we can pass actor handles to tasks/actors (#1075), then we will be able to do this for free. For example:
robertnishihara commentedon Feb 2, 2018
Closing for now since this can be done with actors.