Skip to content

Restructure worker.py code. #614

Closed
Closed

Description

@robertnishihara

The file python/ray/worker.py is a bit of a mess. We should restructure it in some of the following ways.

  1. There should be a Worker class which has a local scheduler client, object store client, and Redis client. It should be possible to instantiate multiple Worker objects. More of the functions in worker.py should be part of the Worker class.
  2. There should be a separate Python file that implements the Ray API (and which creates a global Worker object to use as the default worker). The Ray API calls would essentially be forwarded to method calls on the global worker object.
  3. The remote decorator should be implemented in a separate file.

Activity

  1. barrachri commented on Nov 15, 2017

    @barrachri
    Contributor

    @robertnishihara did you start working on this? in case I'd like to help.

  2. robertnishihara commented on Nov 15, 2017

    @robertnishihara
    CollaboratorAuthor

    Thanks! I've been holding off because we've been refactoring the internal APIs, and a lot of the functionality that's currently implemented in Python is going to move into C++, and then hopefully the worker code will be mostly (or entirely) written in Cython.

    For that reason, I'd suggest holding off on this one for now, though if you see low hanging fruit for restructuring things in a cleaner way, then that'd be great :)

  3. danielsuo commented on Nov 15, 2017

    @danielsuo
    Contributor
  4. robertnishihara commented on Nov 15, 2017

    @robertnishihara
    CollaboratorAuthor

    A lot of the internal API work is being brainstormed in #1173. Our main reason for cleaning up the internal C++ APIs is to make it easy to support other language bindings.

    What sort of changes are you making?

  5. danielsuo commented on Nov 15, 2017

    @danielsuo
    Contributor
  6. barrachri commented on Nov 15, 2017

    @barrachri
    Contributor

    Thanks! I've been holding off because we've been refactoring the internal APIs, and a lot of the > functionality that's currently implemented in Python is going to move into C++, and then > hopefully the worker code will be mostly (or entirely) written in Cython.

    From the docs:

    1. Multiple worker processes
    2. One object store per node stores
    3. One local scheduler per node
    4. A global scheduler
    5. A driver is the Python process that the user control

    Which part do you plan to move to C++?
    So Ray will have a C++ core wrapped with Python?

  7. robertnishihara commented on Nov 15, 2017

    @robertnishihara
    CollaboratorAuthor

    Well, the schedulers, object stores, and such are all already in C++. The main part that is in Python is the worker code. Right now the worker code communicates with Redis a lot. We'd like to hide all of the Redis interactions that behind C++ APIs (see #1173).

  8. barrachri commented on Nov 15, 2017

    @barrachri
    Contributor

    Thanks!

    So I'll wait till redis part is moved to C++.

  9. robertnishihara commented on Feb 6, 2019

    @robertnishihara
    CollaboratorAuthor

    Closing in order to consolidate the discussion in #2016.

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