Skip to content

Prototype experimental ray.status API or design alternative API. #953

Closed

Description

@robertnishihara

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.

cc @imzhenyu

Activity

  1. imzhenyu commented on Sep 9, 2017

    @imzhenyu
    Contributor

    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).

  2. robertnishihara commented on Sep 9, 2017

    @robertnishihara
    CollaboratorAuthor

    Right, the advantage of ray.status(object_id) is just the the user already has the task ID, but presumably if you do

    @ray.remote(num_return_vals=3)
    def f():
        return 1, 2, 3
    
    id1, id2, id3 = f.remote()

    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).

  3. changed the title [-]Prototype experimental ray.status API.[/-] [+]Prototype experimental ray.status API or design alternative API.[/+] on Oct 5, 2017
  4. robertnishihara commented on Oct 16, 2017

    @robertnishihara
    CollaboratorAuthor

    Some work on this in #1134.

  5. robertnishihara commented on Oct 17, 2017

    @robertnishihara
    CollaboratorAuthor

    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.remote
    class StatusActor(object):
        def update_status(self, status):
            self.status = status
    
        def get_status(self):
            return self.status
    
    @ray.remote
    def foo(status_actor):
        for i in range(100):
            # Do some work
            ...
            # Report status
            status_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.
    while True:
        status = ray.get(status_actor.get_status.remote())
        # Do something based on the status.
  6. robertnishihara commented on Feb 2, 2018

    @robertnishihara
    CollaboratorAuthor

    Closing for now since this can be done with actors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions