-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from anyscale/remove-bokay
Removing the dependencies which cause errors in the Dockerfile
- Loading branch information
Showing
26 changed files
with
763 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
advanced-ray/01-Ray-Tasks-Revisited.ipynb: "from bokeh.layouts import gridplot\n", | ||
advanced-ray/01-Ray-Tasks-Revisited.ipynb: "from bokeh.plotting import figure, output_file, show\n", | ||
advanced-ray/01-Ray-Tasks-Revisited.ipynb: "import bokeh.io\n", | ||
advanced-ray/01-Ray-Tasks-Revisited.ipynb: "bokeh.io.reset_output()\n", | ||
advanced-ray/01-Ray-Tasks-Revisited.ipynb: "bokeh.io.output_notebook()\n", | ||
|
||
ray-crash-course/actor_lesson_util.py:import holoviews as hv | ||
ray-crash-course/actor_lesson_util.py:from holoviews import dim, opts | ||
ray-crash-course/actor_lesson_util.py:from holoviews.streams import Pipe, Buffer | ||
ray-crash-course/actor_lesson_util.py:from holoviews.plotting.util import process_cmap | ||
ray-crash-course/task_lesson_util.py:import holoviews as hv | ||
ray-crash-course/task_lesson_util.py:from holoviews import opts | ||
ray-crash-course/task_lesson_util.py:from holoviews.streams import Counter, Tap | ||
|
||
ray-crash-course/bokeh_util.py:from bokeh.layouts import gridplot | ||
ray-crash-course/bokeh_util.py:from bokeh.plotting import figure, output_file, show | ||
ray-crash-course/bokeh_util.py:import bokeh.io | ||
ray-crash-course/bokeh_util.py:bokeh.io.reset_output() | ||
ray-crash-course/bokeh_util.py:bokeh.io.output_notebook() | ||
ray-crash-course/bokeh_util.py: from bokeh.plotting import show | ||
ray-crash-course/solutions/Ray-Crash-Course-Solutions.ipynb: "from bokeh_util import two_lines_plot, means_stddevs_plot # Some plotting utilities in `./bokeh_util.py`.\n", | ||
ray-crash-course/solutions/Ray-Crash-Course-Solutions.ipynb: "from bokeh.plotting import show, figure\n", | ||
ray-crash-course/solutions/Ray-Crash-Course-Solutions.ipynb: "from bokeh.layouts import gridplot" | ||
|
||
ray-crash-course/actor_lesson_util.py:hv.extension('bokeh') | ||
ray-crash-course/task_lesson_util.py:from bokeh_util import square_circle_plot, two_lines_plot, means_stddevs_plot | ||
ray-crash-course/task_lesson_util.py:hv.extension('bokeh') | ||
ray-crash-course/task_lesson_util.py:from bokeh.layouts import gridplot, layout | ||
ray-crash-course/task_lesson_util.py:from bokeh.models import Slider, Button | ||
ray-crash-course/task_lesson_util.py:from bokeh.plotting import figure, output_file, show | ||
ray-crash-course/02-Ray-Actors.ipynb: "from bokeh_util import two_lines_plot # utility we used in the previous lesson\n", | ||
ray-crash-course/02-Ray-Actors.ipynb: "from bokeh.plotting import show, figure\n", | ||
ray-crash-course/02-Ray-Actors.ipynb: "from bokeh.layouts import gridplot" | ||
ray-crash-course/01-Ray-Tasks.ipynb: "from bokeh_util import two_lines_plot, means_stddevs_plot # Some plotting utilities in `./bokeh_util.py`.\n", | ||
ray-crash-course/01-Ray-Tasks.ipynb: "from bokeh.plotting import show, figure\n", | ||
ray-crash-course/01-Ray-Tasks.ipynb: "from bokeh.layouts import gridplot" | ||
|
||
ray-project/requirements.txt:bokeh==2.1.1 | ||
|
||
ray-rllib/explore-rllib/solutions/Explore-RLlib-Solutions.ipynb: "import bokeh.io\n", | ||
ray-rllib/explore-rllib/solutions/Explore-RLlib-Solutions.ipynb: "bokeh.io.reset_output()\n", | ||
ray-rllib/explore-rllib/solutions/Explore-RLlib-Solutions.ipynb: "bokeh.io.output_notebook()" | ||
ray-rllib/explore-rllib/01-Application-Cart-Pole.ipynb: "import bokeh.io\n", | ||
ray-rllib/explore-rllib/01-Application-Cart-Pole.ipynb: "bokeh.io.reset_output()\n", | ||
ray-rllib/explore-rllib/01-Application-Cart-Pole.ipynb: "bokeh.io.output_notebook()" | ||
ray-rllib/explore-rllib/02-Bipedal-Walker.ipynb: "import bokeh.io\n", | ||
ray-rllib/explore-rllib/02-Bipedal-Walker.ipynb: "bokeh.io.reset_output()\n", | ||
ray-rllib/explore-rllib/02-Bipedal-Walker.ipynb: "bokeh.io.output_notebook()" | ||
ray-rllib/solutions/Ray-RLlib-Solutions.ipynb: "import bokeh.io\n", | ||
ray-rllib/solutions/Ray-RLlib-Solutions.ipynb: "bokeh.io.reset_output()\n", | ||
ray-rllib/solutions/Ray-RLlib-Solutions.ipynb: "bokeh.io.output_notebook()" | ||
|
||
ray-rllib/01-Introduction-to-Reinforcement-Learning.ipynb: "import bokeh.io\n", | ||
ray-rllib/01-Introduction-to-Reinforcement-Learning.ipynb: "bokeh.io.reset_output()\n", | ||
ray-rllib/01-Introduction-to-Reinforcement-Learning.ipynb: "bokeh.io.output_notebook()" | ||
|
||
util/line_plots.py:from bokeh.plotting import figure, show, output_file | ||
util/line_plots.py:from bokeh.models import Band, ColumnDataSource, Range1d | ||
util/line_plots.py:from bokeh.models.tools import HoverTool | ||
util/line_plots.py:import bokeh.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Exercise 1 - Simple Data Parallel Example\n", | ||
"\n", | ||
"**GOAL:** The goal of this exercise is to show how to run simple tasks in parallel.\n", | ||
"\n", | ||
"The Python script used in this exercise runs too slowly, although its computation is embarrassingly parallel. Use Ray to execute the functions in parallel to speed up the script." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Concept for this Exercise - Remote Functions\n", | ||
"\n", | ||
"The standard way to turn a Python function into a *remote function* is to add the `@ray.remote` decorator. Here is an example.\n", | ||
"\n", | ||
"```python\n", | ||
"# A regular Python function.\n", | ||
"def regular_function():\n", | ||
" return 1\n", | ||
"\n", | ||
"# A Ray remote function.\n", | ||
"@ray.remote\n", | ||
"def remote_function():\n", | ||
" return 1\n", | ||
"```\n", | ||
"\n", | ||
"The differences are the following:\n", | ||
"\n", | ||
"1. **Invocation:** The regular version is called with `regular_function()`, whereas the remote version is called with `remote_function.remote()`.\n", | ||
"2. **Return values:** `regular_function` immediately executes and returns `1`, whereas `remote_function` immediately returns an *object ref* (a future) and then creates a task that will be executed on a worker process. The result can be obtained with `ray.get`.\n", | ||
" ```python\n", | ||
" >>> regular_function()\n", | ||
" 1\n", | ||
" \n", | ||
" >>> remote_function.remote()\n", | ||
" ObjectID(1c80d6937802cd7786ad25e50caf2f023c95e350)\n", | ||
" \n", | ||
" >>> ray.get(remote_function.remote())\n", | ||
" 1\n", | ||
" ```\n", | ||
"3. **Parallelism:** Invocations of `regular_function` happen **serially**, for example\n", | ||
" ```python\n", | ||
" # These happen serially.\n", | ||
" for _ in range(4):\n", | ||
" regular_function()\n", | ||
" ```\n", | ||
" whereas invocations of `remote_function` happen in **parallel**, for example\n", | ||
" ```python\n", | ||
" # These happen in parallel.\n", | ||
" for _ in range(4):\n", | ||
" remote_function.remote()\n", | ||
" ```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This example needs to run four tasks concurrently.\n", | ||
"To illustrate how these tasks run in parallel, we'll tell Ray explicitly that there are four CPUs.\n", | ||
"\n", | ||
"Usually this is not done.\n", | ||
"By default, Ray does not schedule more tasks concurrently than there are CPUs. \n", | ||
"Instead it computes the number of CPUs using `psutil.cpu_count()`:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import psutil\n", | ||
"\n", | ||
"psutil.cpu_count()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"First, let's start Ray using `ray.init` -- with the `num_cpus` set explicitly.\n", | ||
"This starts a number of processes. \n", | ||
"The other argument `ignore_reinit_error=True` simply ignores errors if this cell gets re-run multiple times." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ray\n", | ||
"import time\n", | ||
"\n", | ||
"ray.init(num_cpus=4, ignore_reinit_error=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**EXERCISE:** The function below run too slow. Turn it into a remote function using the `@ray.remote` decorator." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# This function is a proxy for a more interesting and computationally\n", | ||
"# intensive function.\n", | ||
"def slow_function(i):\n", | ||
" time.sleep(1)\n", | ||
" return i" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**EXERCISE:** The loop below takes too long. The four function calls could be executed in parallel.\n", | ||
"Instead of four seconds, it should only take one second for total run time.\n", | ||
"\n", | ||
"Once `slow_function` has been made a remote function, execute these four tasks in parallel by calling `slow_function.remote()`.\n", | ||
"Then obtain the results by calling `ray.get` on a list of the resulting object refs." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Sleep a little to improve the accuracy of the timing measurements below.\n", | ||
"# We do this because workers may still be starting up in the background.\n", | ||
"time.sleep(2.0)\n", | ||
"start_time = time.time()\n", | ||
"\n", | ||
"results = [slow_function(i) for i in range(4)]\n", | ||
" \n", | ||
"end_time = time.time()\n", | ||
"duration = end_time - start_time\n", | ||
"\n", | ||
"print('The results are {}. This took {} seconds. Run the next cell to see '\n", | ||
" 'if the exercise was done correctly.'.format(results, duration))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**VERIFY:** Run some checks to verify that the changes you made to the code were correct. Some of the checks should fail when you initially run the cells. After completing the exercises, the checks should pass." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert results == [0, 1, 2, 3], 'Did you remember to call ray.get?'\n", | ||
"assert duration < 1.1, ('The loop took {} seconds. This is too slow.'\n", | ||
" .format(duration))\n", | ||
"assert duration > 1, ('The loop took {} seconds. This is too fast.'\n", | ||
" .format(duration))\n", | ||
"\n", | ||
"print('Success! The example took {} seconds.'.format(duration))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**EXERCISE:** Use the UI to view the task timeline and to verify that the four tasks were executed in parallel. You can do this as follows.\n", | ||
"\n", | ||
"1. Run the following cell to generate a JSON file containing the profiling data.\n", | ||
"2. Download the timeline file by right clicking on `timeline01.json` in the navigator to the left and choosing **\"Download\"**.\n", | ||
"3. Open [`chrome://tracing/`](chrome://tracing/) in the Chrome web browser, click on the **\"Load\"** button and load the downloaded JSON file.\n", | ||
"\n", | ||
"To navigate within the timeline, do the following.\n", | ||
"- Move around by clicking and dragging.\n", | ||
"- Zoom in and out by holding **alt** (or **option**) and scrolling.\n", | ||
"\n", | ||
"**NOTE:** The timeline visualization will only work in **Chrome**." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ray.timeline(filename=\"timeline01.json\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.4" | ||
}, | ||
"toc": { | ||
"base_numbering": 1, | ||
"nav_menu": {}, | ||
"number_sections": false, | ||
"sideBar": true, | ||
"skip_h1_title": false, | ||
"title_cell": "Table of Contents", | ||
"title_sidebar": "Contents", | ||
"toc_cell": false, | ||
"toc_position": { | ||
"height": "calc(100% - 180px)", | ||
"left": "10px", | ||
"top": "150px", | ||
"width": "382.391px" | ||
}, | ||
"toc_section_display": true, | ||
"toc_window_display": true | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,7 +171,6 @@ | |
"## Getting Help\n", | ||
"\n", | ||
"* The [#tutorial channel](https://ray-distributed.slack.com/archives/C011ML23W5B) on the [Ray Slack](https://ray-distributed.slack.com). [Click here](https://forms.gle/9TSdDYUgxYs8SA9e8) to join.\n", | ||
"* [Email](mailto:[email protected])\n", | ||
"\n", | ||
"Find an issue? Please report it!\n", | ||
"\n", | ||
|
@@ -206,7 +205,7 @@ | |
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.7" | ||
"version": "3.7.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
|
Oops, something went wrong.