2019-08-20 20:49:15 -07:00
|
|
|
Ray Projects (Experimental)
|
|
|
|
===========================
|
|
|
|
|
|
|
|
Ray projects make it easy to package a Ray application so it can be
|
|
|
|
rerun later in the same environment. They allow for the sharing and
|
|
|
|
reliable reuse of existing code.
|
|
|
|
|
|
|
|
Quick start (CLI)
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# Creates a project in the current directory. It will create a
|
|
|
|
# project.yaml defining the code and environment and a cluster.yaml
|
|
|
|
# describing the cluster configuration. Both will be created in the
|
2019-12-05 16:15:42 -08:00
|
|
|
# ray-project subdirectory of the current directory.
|
2019-08-20 20:49:15 -07:00
|
|
|
$ ray project create <project-name>
|
|
|
|
|
2019-09-05 11:55:42 -07:00
|
|
|
# Create a new session from the given project. Launch a cluster and run
|
|
|
|
# the command, which must be specified in the project.yaml file. If no
|
2019-12-05 16:15:42 -08:00
|
|
|
# command is specified, the "default" command in ray-project/project.yaml
|
2019-09-05 11:55:42 -07:00
|
|
|
# will be used. Alternatively, use --shell to run a raw shell command.
|
|
|
|
$ ray session start <command-name> [arguments] [--shell]
|
2019-08-20 20:49:15 -07:00
|
|
|
|
|
|
|
# Open a console for the given session.
|
|
|
|
$ ray session attach
|
|
|
|
|
2019-09-05 11:55:42 -07:00
|
|
|
# Stop the given session and terminate all of its worker nodes.
|
2019-08-20 20:49:15 -07:00
|
|
|
$ ray session stop
|
|
|
|
|
|
|
|
Examples
|
|
|
|
--------
|
2019-09-05 11:55:42 -07:00
|
|
|
See `the readme <https://github.com/ray-project/ray/blob/master/python/ray/projects/examples/README.md>`__
|
|
|
|
for instructions on how to run these examples:
|
|
|
|
|
2019-12-05 16:15:42 -08:00
|
|
|
- `Open Tacotron <https://github.com/ray-project/ray/blob/master/python/ray/projects/examples/open-tacotron/ray-project/project.yaml>`__:
|
2019-08-20 20:49:15 -07:00
|
|
|
A TensorFlow implementation of Google's Tacotron speech synthesis with pre-trained model (unofficial)
|
2019-12-05 16:15:42 -08:00
|
|
|
- `PyTorch Transformers <https://github.com/ray-project/ray/blob/master/python/ray/projects/examples/pytorch-transformers/ray-project/project.yaml>`__:
|
2019-08-20 20:49:15 -07:00
|
|
|
A library of state-of-the-art pretrained models for Natural Language Processing (NLP)
|
|
|
|
|
|
|
|
Project file format (project.yaml)
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
A project file contains everything required to run a project.
|
|
|
|
This includes a cluster configuration, the environment and dependencies
|
|
|
|
for the application, and the specific inputs used to run the project.
|
|
|
|
|
|
|
|
Here is an example for a minimal project format:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
name: test-project
|
|
|
|
description: "This is a simple test project"
|
|
|
|
repo: https://github.com/ray-project/ray
|
|
|
|
|
|
|
|
# Cluster to be instantiated by default when starting the project.
|
2019-12-05 16:15:42 -08:00
|
|
|
cluster: ray-project/cluster.yaml
|
2019-08-20 20:49:15 -07:00
|
|
|
|
|
|
|
# Commands/information to build the environment, once the cluster is
|
|
|
|
# instantiated. This can include the versions of python libraries etc.
|
|
|
|
# It can be specified as a Python requirements.txt, a conda environment,
|
|
|
|
# a Dockerfile, or a shell script to run to set up the libraries.
|
|
|
|
environment:
|
|
|
|
requirements: requirements.txt
|
|
|
|
|
|
|
|
# List of commands that can be executed once the cluster is instantiated
|
|
|
|
# and the environment is set up.
|
|
|
|
# A command can also specify a cluster that overwrites the default cluster.
|
|
|
|
commands:
|
2019-08-26 14:16:17 -07:00
|
|
|
- name: default
|
|
|
|
command: python default.py
|
|
|
|
help: "The command that will be executed if no command name is specified"
|
2019-08-20 20:49:15 -07:00
|
|
|
- name: test
|
2019-08-26 14:16:17 -07:00
|
|
|
command: python test.py --param1={{param1}} --param2={{param2}}
|
|
|
|
help: "A test command"
|
|
|
|
params:
|
|
|
|
- name: "param1"
|
|
|
|
help: "The first parameter"
|
|
|
|
# The following line indicates possible values this parameter can take.
|
|
|
|
choices: ["1", "2"]
|
|
|
|
- name: "param2"
|
|
|
|
help: "The second parameter"
|
2019-08-20 20:49:15 -07:00
|
|
|
|
|
|
|
Project files have to adhere to the following schema:
|
|
|
|
|
|
|
|
.. jsonschema:: ../../python/ray/projects/schema.json
|
|
|
|
|
|
|
|
Cluster file format (cluster.yaml)
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
This is the same as for the autoscaler, see
|
|
|
|
`Cluster Launch page <autoscaling.html>`_.
|