File: api.rst

package info (click to toggle)
dask.distributed 2022.12.1%2Bds.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,164 kB
  • sloc: python: 81,938; javascript: 1,549; makefile: 228; sh: 100
file content (209 lines) | stat: -rw-r--r-- 4,113 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
.. _api:

API
===

.. currentmodule:: distributed

**Client**

The client connects to and submits computation to a Dask cluster (such as a :class:`distributed.LocalCluster`)

.. autosummary::
   Client

.. autoautosummary:: distributed.Client
   :methods:

.. currentmodule:: distributed

.. autosummary::
   worker_client
   get_worker
   get_client
   secede
   rejoin
   print
   warn
   Reschedule

.. currentmodule:: distributed.recreate_tasks

.. autosummary::
   ReplayTaskClient.recreate_task_locally
   ReplayTaskClient.recreate_error_locally

.. currentmodule:: distributed


**Future**

.. autosummary::
   Future

.. autoautosummary:: distributed.Future
   :methods:

**Synchronization**

.. currentmodule:: distributed

.. autosummary::
   Event
   Lock
   MultiLock
   Semaphore
   Queue
   Variable


**Other**

.. autosummary::
   as_completed
   distributed.diagnostics.progressbar.progress
   wait
   fire_and_forget
   futures_of
   get_task_stream
   get_task_metadata
   performance_report


**Utilities**

.. autosummary::
   distributed.utils.Log
   distributed.utils.Logs


Asynchronous methods
--------------------

Most methods and functions can be used equally well within a blocking or
asynchronous environment using Tornado coroutines.  If used within a Tornado
IOLoop then you should yield or await otherwise blocking operations
appropriately.

You must tell the client that you intend to use it within an asynchronous
environment by passing the ``asynchronous=True`` keyword

.. code-block:: python

   # blocking
   client = Client()
   future = client.submit(func, *args)  # immediate, no blocking/async difference
   result = client.gather(future)  # blocking

   # asynchronous Python 2/3
   client = yield Client(asynchronous=True)
   future = client.submit(func, *args)  # immediate, no blocking/async difference
   result = yield client.gather(future)  # non-blocking/asynchronous

   # asynchronous Python 3
   client = await Client(asynchronous=True)
   future = client.submit(func, *args)  # immediate, no blocking/async difference
   result = await client.gather(future)  # non-blocking/asynchronous

The asynchronous variants must be run within a Tornado coroutine.  See the
:doc:`Asynchronous <asynchronous>` documentation for more information.


Client
------

.. currentmodule:: distributed

.. autoclass:: Client
   :members:

.. autoclass:: distributed.recreate_tasks.ReplayTaskClient
   :members:


Future
------

.. autoclass:: Future
   :members:


Synchronization
---------------

.. autoclass:: Event
   :members:
.. autoclass:: Lock
   :members:
.. autoclass:: MultiLock
   :members:
.. autoclass:: Semaphore
   :members:
.. autoclass:: Queue
   :members:
.. autoclass:: Variable
   :members:


Cluster
-------

Classes relevant for cluster creation and management. Other libraries
(like `dask-jobqueue`_, `dask-gateway`_, `dask-kubernetes`_, `dask-yarn`_ etc.)
provide additional cluster objects.

.. _dask-jobqueue: https://jobqueue.dask.org/
.. _dask-gateway: https://gateway.dask.org/
.. _dask-kubernetes: https://kubernetes.dask.org/
.. _dask-yarn: https://yarn.dask.org/en/latest/

.. autosummary::
   LocalCluster
   SpecCluster

.. autoclass:: LocalCluster
   :members:

.. autoclass:: SpecCluster
   :members:


Other
-----

.. autoclass:: as_completed
   :members:

.. autofunction:: distributed.diagnostics.progressbar.progress
.. autofunction:: wait
.. autofunction:: fire_and_forget
.. autofunction:: futures_of

.. currentmodule:: distributed

.. autofunction:: distributed.worker_client
.. autofunction:: distributed.get_worker
.. autofunction:: distributed.get_client
.. autofunction:: distributed.secede
.. autofunction:: distributed.rejoin
.. autofunction:: distributed.print
.. autofunction:: distributed.warn
.. autoclass:: distributed.Reschedule
.. autoclass:: get_task_stream
.. autoclass:: get_task_metadata
.. autoclass:: performance_report


Utilities
---------

.. autoclass:: distributed.utils.Log
.. autoclass:: distributed.utils.Logs


Adaptive
--------

.. currentmodule:: distributed.deploy
.. autoclass:: Adaptive
   :members: