| 1 |
.. _deploying-cli: |
| 2 |
|
| 3 |
Command Line |
| 4 |
============ |
| 5 |
|
| 6 |
This is the most fundamental way to deploy Dask on multiple machines. In |
| 7 |
production environments this process is often automated by some other resource |
| 8 |
manager. Hence, it is rare that people need to follow these instructions |
| 9 |
explicitly. Instead, these instructions are useful to help understand what |
| 10 |
*cluster managers* and other automated tooling is doing under the hood and to |
| 11 |
help users deploy onto platforms that have no automated tools today. |
| 12 |
|
| 13 |
A ``dask.distributed`` network consists of one ``dask scheduler`` process and |
| 14 |
several ``dask worker`` processes that connect to that scheduler. These are |
| 15 |
normal Python processes that can be executed from the command line. We launch |
| 16 |
the ``dask scheduler`` executable in one process and the ``dask worker`` |
| 17 |
executable in several processes, possibly on different machines. |
| 18 |
|
| 19 |
To accomplish this, launch ``dask scheduler`` on one node:: |
| 20 |
|
| 21 |
$ dask scheduler |
| 22 |
Scheduler at: tcp://192.0.0.100:8786 |
| 23 |
|
| 24 |
Then, launch ``dask worker`` on the rest of the nodes, providing the address to |
| 25 |
the node that hosts ``dask scheduler``:: |
| 26 |
|
| 27 |
$ dask worker tcp://192.0.0.100:8786 |
| 28 |
Start worker at: tcp://192.0.0.1:12345 |
| 29 |
Registered to: tcp://192.0.0.100:8786 |
| 30 |
|
| 31 |
$ dask worker tcp://192.0.0.100:8786 |
| 32 |
Start worker at: tcp://192.0.0.2:40483 |
| 33 |
Registered to: tcp://192.0.0.100:8786 |
| 34 |
|
| 35 |
$ dask worker tcp://192.0.0.100:8786 |
| 36 |
Start worker at: tcp://192.0.0.3:27372 |
| 37 |
Registered to: tcp://192.0.0.100:8786 |
| 38 |
|
| 39 |
The workers connect to the scheduler, which then sets up a long-running network |
| 40 |
connection back to the worker. The workers will learn the location of other |
| 41 |
workers from the scheduler. |
| 42 |
|
| 43 |
|
| 44 |
Handling Ports |
| 45 |
-------------- |
| 46 |
|
| 47 |
The scheduler and workers both need to accept TCP connections on an open port. |
| 48 |
By default, the scheduler binds to port ``8786`` and the worker binds to a |
| 49 |
random open port. If you are behind a firewall then you may have to open |
| 50 |
particular ports or tell Dask to listen on particular ports with the ``--port`` |
| 51 |
and ``--worker-port`` keywords.:: |
| 52 |
|
| 53 |
dask scheduler --port 8000 |
| 54 |
dask worker --dashboard-address 8000 --nanny-port 8001 |
| 55 |
|
| 56 |
|
| 57 |
Nanny Processes |
| 58 |
--------------- |
| 59 |
|
| 60 |
Dask workers are run within a nanny process that monitors the worker process |
| 61 |
and restarts it if necessary. |
| 62 |
|
| 63 |
|
| 64 |
Diagnostic Web Servers |
| 65 |
---------------------- |
| 66 |
|
| 67 |
Additionally, Dask schedulers and workers host interactive diagnostic web |
| 68 |
servers using `Bokeh <https://docs.bokeh.org>`_. These are optional, but |
| 69 |
generally useful to users. The diagnostic server on the scheduler is |
| 70 |
particularly valuable, and is served on port ``8787`` by default (configurable |
| 71 |
with the ``--dashboard-address`` keyword). |
| 72 |
|
| 73 |
For more information about relevant ports, please take a look at the available |
| 74 |
:ref:`command line options <worker-scheduler-cli-options>`. |
| 75 |
|
| 76 |
Automated Tools |
| 77 |
--------------- |
| 78 |
|
| 79 |
There are various mechanisms to deploy these executables on a cluster, ranging |
| 80 |
from manually SSH-ing into all of the machines to more automated systems like |
| 81 |
SGE/SLURM/Torque or Yarn/Mesos. Additionally, cluster SSH tools exist to send |
| 82 |
the same commands to many machines. We recommend searching online for "cluster |
| 83 |
ssh" or "cssh". |
| 84 |
|
| 85 |
|
| 86 |
.. _worker-scheduler-cli-options: |
| 87 |
|
| 88 |
CLI Options |
| 89 |
----------- |
| 90 |
|
| 91 |
.. note:: |
| 92 |
|
| 93 |
The command line documentation here may differ depending on your installed |
| 94 |
version. We recommend referring to the output of ``dask scheduler --help`` |
| 95 |
and ``dask worker --help``. |
| 96 |
|
| 97 |
.. click:: distributed.cli.dask_scheduler:main |
| 98 |
:prog: dask scheduler |
| 99 |
:show-nested: |
| 100 |
|
| 101 |
.. click:: distributed.cli.dask_worker:main |
| 102 |
:prog: dask worker |
| 103 |
:show-nested: |