class_docstr: A variable client for updating variables from a remote source.
class_docstr_tok: ["A","variable","client","for","updating","variables","from","a","remote","source","."]
docstr: Initializes the variable client.
  
  Args:
    client: A variable source from which we fetch variables.
    key: Which variables to request. When multiple keys are used, params
      property will return a list of params.
    update_period: Interval between fetches, specified as either (int) a
      number of calls to update() between actual fetches or (timedelta) a time
      interval that has to pass since the last fetch.
    device: The name of a JAX device to put variables on. If None (default),
      VariableClient won't put params on any device.
docstr_tok: ["Initializes","the","variable","client",".","Args",":","client",":","A","variable","source","from","which","we","fetch","variables",".","key",":","Which","variables","to","request",".","When","multiple","keys","are","used",",","params","property","will","return","a","list","of","params",".","update_period",":","Interval","between","fetches",",","specified","as","either","(","int",")","a","number","of","calls","to","update","(",")","between","actual","fetches","or","(","timedelta",")","a","time","interval","that","has","to","pass","since","the","last","fetch",".","device",":","The","name","of","a","JAX","device","to","put","variables","on",".","If","None","(","default",")",",","VariableClient","wo","n't","put","params","on","any","device","."]
code: def __init__(
      self,
      client: core.VariableSource,
      key: Union[str, Sequence[str]],
      update_period: Union[int, datetime.timedelta] = 1,
      device: Optional[Union[str, jax.Device]] = None,
  ):
      """Initializes the variable client.
  
      Args:
        client: A variable source from which we fetch variables.
        key: Which variables to request. When multiple keys are used, params
          property will return a list of params.
        update_period: Interval between fetches, specified as either (int) a
          number of calls to update() between actual fetches or (timedelta) a time
          interval that has to pass since the last fetch.
        device: The name of a JAX device to put variables on. If None (default),
          VariableClient won't put params on any device.
      """
      self._update_period = update_period
      self._call_counter = 0
      self._last_call = time.time()
      self._client = client
      self._params: Sequence[network_types.Params] = None
  
      self._device = device
      if isinstance(self._device, str):
          self._device = jax.devices(device)[0]
  
      self._executor = futures.ThreadPoolExecutor(max_workers=1)
  
      if isinstance(key, str):
          key = [key]
  
      self._key = key
      self._request = lambda k=key: client.get_variables(k)
      self._future: Optional[
          futures.Future
      ] = None  # pylint: disable=g-bare-generic
      self._async_request = lambda: self._executor.submit(self._request)
  
file_path: acme/acme/jax/variable_utils.py
imports: from concurrent import futures
  import datetime
  import time
  from typing import List, NamedTuple, Optional, Sequence, Union
  from acme import core
  from acme.jax import networks
  import jax
label_desc: Use image node_id 1 to create a new VariableClient object  with example: obj = VariableClient(client, key, update_period, device)