class_docstr: Distributed Global Variable
  
  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.
  
  Parameters
  ----------
  name: string (optional)
      Name used by other clients and the scheduler to identify the variable.
      If not given, a random name will be generated.
  client: Client (optional)
      Client used for communication with the scheduler.
      If not given, the default global client will be used.
  
  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
class_docstr_tok: ["Distributed","Global","Variable","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",".","Parameters","--","--","--","--","--","name",":","string","(","optional",")","Name","used","by","other","clients","and","the","scheduler","to","identify","the","variable",".","If","not","given",",","a","random","name","will","be","generated",".","client",":","Client","(","optional",")","Client","used","for","communication","with","the","scheduler",".","If","not","given",",","the","default","global","client","will","be","used",".","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"]
code: def client(self):
      if not self._client:
          try:
              self._client = get_client()
          except ValueError:
              pass
      return self._client
  
imports: from __future__ import annotations
  import asyncio
  import logging
  import uuid
  from collections import defaultdict
  from contextlib import suppress
  from tlz import merge
  from dask.utils import parse_timedelta
  from distributed.client import Future
  from distributed.metrics import time
  from distributed.utils import TimeoutError, log_errors, wait_for
  from distributed.worker import get_client
label_desc: Use image node_id 2 for calling the Variable obj's underlying member method code with example usage: obj.client() and returns: self