Class Variable

Distributed Global Variable

Declaration

class Variable
source link

Documentation

This allows multiple clients to share futures and data between each other
with a single mutable variable.  All metadata is sequentialized through the
scheduler.  Race conditions can occur.

Values must be either Futures or msgpack-encodable data (ints, lists,
strings, etc..)  All data will be kept and sent through the scheduler, so
it is wise not to send too much.  If you want to share a large amount of
data then ``scatter`` it and share the future instead.

.. warning::

   This object is experimental and has known issues in Python 2

Attributes

Examples

>>> from dask.distributed import Client, Variable # doctest: +SKIP
>>> client = Client()  # doctest: +SKIP
>>> x = Variable('x')  # doctest: +SKIP
>>> x.set(123)  # docttest: +SKIP
>>> x.get()  # docttest: +SKIP
123
>>> future = client.submit(f, x)  # doctest: +SKIP
>>> x.set(future)  # doctest: +SKIP

See also

Queue: shared multi-producer/multi-consumer queue between clients

Methods

Reexports