class_docstr: Visualizes a policy in an environment.
class_docstr_tok: ["Visualizes","a","policy","in","an","environment","."]
code: def _worker_start(self):
      env = None
      policy = None
      max_length = None
      initial_rollout = True
      try:
          # Each iteration will process ALL messages currently in the
          # queue
          while True:
              msgs = {}
              # If true, block and yield processor
              if initial_rollout:
                  msg = self._queue.get()
                  msgs[msg.op] = msg
                  # Only fetch the last message of each type
                  while not self._queue.empty():
                      msg = self._queue.get()
                      msgs[msg.op] = msg
              else:
                  # Only fetch the last message of each type
                  while not self._queue.empty():
                      msg = self._queue.get_nowait()
                      msgs[msg.op] = msg
  
              if Op.STOP in msgs:
                  break
  
              if Op.UPDATE in msgs:
                  env, policy = msgs[Op.UPDATE].args
              elif Op.DEMO in msgs:
                  param_values, max_length = msgs[Op.DEMO].args
                  policy.set_param_values(param_values)
                  initial_rollout = False
                  rollout(
                      env,
                      policy,
                      max_episode_length=max_length,
                      animated=True,
                  )
              else:
                  if max_length:
                      rollout(
                          env,
                          policy,
                          max_episode_length=max_length,
                          animated=True,
                      )
      except KeyboardInterrupt:
          pass
  
file_path: garage/src/garage/plotter/plotter.py
imports: import atexit
  from collections import namedtuple
  from enum import Enum
  from multiprocessing import JoinableQueue, Process
  import platform
  from threading import Thread
  import numpy
  from garage import rollout
label_desc: Use image node_id 2 for calling the Plotter obj's underlying member method code with example usage: obj._worker_start() without return types