Skip to content

Commit

Permalink
Add section about futures and variables (dask#11164)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Hoefler <[email protected]>
  • Loading branch information
fjetter and phofl authored Jun 10, 2024
1 parent a291fd2 commit 05b8d66
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/source/futures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,30 @@ part of a function:
process(filename)
Submit task and retrieve results from a different process
---------------------------------------------------------

Sometimes we care about retrieving a result but not necessarily from the same process.

.. code-block:: python
from distributed import Variable
var = Variable("my-result")
fut = client.submit(...)
var.set(fut)
Using a ``Variable`` instructs dask to remember the result of this task under
the given name so that it can be retrieved later without having to keep the
Client alive in the meantime.

.. code-block:: python
var = Variable("my-result")
fut = var.get()
result = fut.result()
Submit Tasks from Tasks
-----------------------

Expand Down

0 comments on commit 05b8d66

Please sign in to comment.