|
62 | 62 | "cell_type": "markdown",
|
63 | 63 | "metadata": {},
|
64 | 64 | "source": [
|
65 |
| - "## General Task and Actor Tips\n", |
| 65 | + "## Tips and Tricks\n", |
| 66 | + "\n", |
| 67 | + "### Jupyter Tips\n", |
| 68 | + "\n", |
| 69 | + "* **Learning Jupyter Lab:** Open _Help > JupyerLab Reference_ for a user guide and detailed information about Jupyter Lab. The _Help_ menu has other references, too.\n", |
| 70 | + "* **Excessive Output:** If the output of a cell is very long, right click on it and select _Enable Scrolling for Outputs_." |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "markdown", |
| 75 | + "metadata": {}, |
| 76 | + "source": [ |
| 77 | + "### General Task and Actor Tips\n", |
66 | 78 | "\n",
|
67 | 79 | "* To create a task from a function or an actor from a class, annotate it with `@ray.remote`.\n",
|
68 | 80 | "* Invoke tasks with `foo.remote(...)`\n",
|
|
78 | 90 | "cell_type": "markdown",
|
79 | 91 | "metadata": {},
|
80 | 92 | "source": [
|
81 |
| - "### Using Existing Functions and Classes\n", |
| 93 | + "#### Using Existing Functions and Classes\n", |
82 | 94 | "\n",
|
83 | 95 | "An existing function can be used as a task by defining a new task function that calls the original function. For example:\n",
|
84 | 96 | "\n",
|
|
125 | 137 | "cell_type": "markdown",
|
126 | 138 | "metadata": {},
|
127 | 139 | "source": [
|
128 |
| - "## Using the Ray Dashboard\n", |
| 140 | + "### Using the Ray Dashboard\n", |
129 | 141 | "\n",
|
130 |
| - "### Opening the Dashboard\n", |
| 142 | + "#### Opening the Dashboard\n", |
131 | 143 | "\n",
|
132 | 144 | "As it executes, `ray.init` prints the dashboard URL.\n",
|
133 | 145 | "\n",
|
|
140 | 152 | "cell_type": "markdown",
|
141 | 153 | "metadata": {},
|
142 | 154 | "source": [
|
143 |
| - "### Profiling Actors\n", |
| 155 | + "#### Profiling Actors\n", |
144 | 156 | "\n",
|
145 | 157 | "The _Logical View_ offers a powerful and convenient way to profile actor performance using [flame graphs](http://www.brendangregg.com/flamegraphs.html). Details are in the [Dashboard docs](https://ray.readthedocs.io/en/latest/ray-dashboard.html#ray-dashboard).\n",
|
146 | 158 | "\n",
|
|
183 | 195 | "cell_type": "markdown",
|
184 | 196 | "metadata": {},
|
185 | 197 | "source": [
|
186 |
| - "## Profiling Code with ray.timeline()\n", |
| 198 | + "### Profiling Code with ray.timeline()\n", |
187 | 199 | "\n",
|
188 | 200 | "The other built-in way to profile performance uses `ray.timeline(file)` ([documentation](https://ray.readthedocs.io/en/latest/package-ref.html#ray.timeline)). It requires a Chrome web browser to view the data. This is the only way to profile tasks.\n",
|
189 | 201 | "\n",
|
|
203 | 215 | "cell_type": "markdown",
|
204 | 216 | "metadata": {},
|
205 | 217 | "source": [
|
206 |
| - "## Using Libraries\n", |
| 218 | + "### Using Libraries\n", |
207 | 219 | "\n",
|
208 | 220 | "If tasks or actors call (or subclass) library code in your project and that code isn't in a _subdirectory_ of the driver script, make sure that the process starting Ray has the correct `PYTHONPATH` set to the library location. For example,\n",
|
209 | 221 | "\n",
|
|
216 | 228 | "cell_type": "markdown",
|
217 | 229 | "metadata": {},
|
218 | 230 | "source": [
|
219 |
| - "## Cleaning Up\n", |
| 231 | + "### Cleaning Up\n", |
220 | 232 | "\n",
|
221 | 233 | "When your driver script exists, it will implicitly call `ray.shutdown()`. This can be useful to do explicitly if you want to restart Ray, for example, in a notebook environment. For example:\n",
|
222 | 234 | "\n",
|
|
0 commit comments