class_docstr: Constructs a single sampler worker.
  
  Args:
      worker_id (int): The ID of this worker.
      env (Environment): Environment to sample form.
      agent_pkl (bytes): Pickled :class:`Policy` to sample with.
      worker_factory (WorkerFactory): Factory to construct this worker's
          behavior.
class_docstr_tok: ["Constructs","a","single","sampler","worker",".","Args",":","worker_id","(","int",")",":","The","ID","of","this","worker",".","env","(","Environment",")",":","Environment","to","sample","form",".","agent_pkl","(","bytes",")",":","Pickled",":","class",":","`","Policy","`","to","sample","with",".","worker_factory","(","WorkerFactory",")",":","Factory","to","construct","this","worker's","behavior","."]
docstr: Update the agent and environment.
  
  Args:
      agent_update (object): Agent update.
      env_update (object): Environment update.
  
  Returns:
      int: The worker id.
docstr_tok: ["Update","the","agent","and","environment",".","Args",":","agent_update","(","object",")",":","Agent","update",".","env_update","(","object",")",":","Environment","update",".","Returns",":","int",":","The","worker","id","."]
code: def update(self, agent_update, env_update):
      """Update the agent and environment.
  
      Args:
          agent_update (object): Agent update.
          env_update (object): Environment update.
  
      Returns:
          int: The worker id.
  
      """
      self.inner_worker.update_agent(agent_update)
      self.inner_worker.update_env(env_update)
      return self.worker_id
  
imports: from collections import defaultdict
  import itertools
  import click
  import cloudpickle
  import psutil
  import ray
  from garage import EpisodeBatch
  from garage.experiment.deterministic import get_seed
  from garage.sampler.default_worker import DefaultWorker
  from garage.sampler.sampler import Sampler
  from garage.sampler.worker_factory import WorkerFactory
label_desc: Use image node_id 2 for calling the SamplerWorker obj's underlying member method code with example usage: obj.update(agent_update, env_update) and returns: self