class_docstr: Class encapsulating functionality performed in worker processes.
docstr: Build the environment and run the rollout for the specified number of episodes.
  
  :param env_config: Hydra configuration of the environment to instantiate.
  :param wrapper_config: Hydra configuration of environment wrappers.
  :param agent_config: Hydra configuration of agent's policies.
  :param deterministic: Deterministic or stochastic action sampling.
  :param max_episode_steps: Max number of steps per episode to perform
                              (episode might end earlier if env returns done).
  :param record_trajectory: Whether to record trajectory data.
  :param input_directory: Directory to load the model from.
  :param reporting_queue: Queue for passing the stats and event logs back to the main process after each episode.
  :param seeding_queue: Queue for retrieving seeds.
docstr_tok: ["Build","the","environment","and","run","the","rollout","for","the","specified","number","of","episodes",".",":","param","env_config",":","Hydra","configuration","of","the","environment","to","instantiate",".",":","param","wrapper_config",":","Hydra","configuration","of","environment","wrappers",".",":","param","agent_config",":","Hydra","configuration","of","agent","'s","policies",".",":","param","deterministic",":","Deterministic","or","stochastic","action","sampling",".",":","param","max_episode_steps",":","Max","number","of","steps","per","episode","to","perform","(","episode","might","end","earlier","if","env","returns","done",")",".",":","param","record_trajectory",":","Whether","to","record","trajectory","data",".",":","param","input_directory",":","Directory","to","load","the","model","from",".",":","param","reporting_queue",":","Queue","for","passing","the","stats","and","event","logs","back","to","the","main","process","after","each","episode",".",":","param","seeding_queue",":","Queue","for","retrieving","seeds","."]
code: def run(
      env_config: DictConfig,
      wrapper_config: DictConfig,
      agent_config: DictConfig,
      deterministic: bool,
      max_episode_steps: int,
      record_trajectory: bool,
      input_directory: str,
      reporting_queue: Queue,
      seeding_queue: Queue,
  ) -> None:
      """Build the environment and run the rollout for the specified number of episodes.
  
      :param env_config: Hydra configuration of the environment to instantiate.
      :param wrapper_config: Hydra configuration of environment wrappers.
      :param agent_config: Hydra configuration of agent's policies.
      :param deterministic: Deterministic or stochastic action sampling.
      :param max_episode_steps: Max number of steps per episode to perform
                                  (episode might end earlier if env returns done).
      :param record_trajectory: Whether to record trajectory data.
      :param input_directory: Directory to load the model from.
      :param reporting_queue: Queue for passing the stats and event logs back to the main process after each episode.
      :param seeding_queue: Queue for retrieving seeds.
      """
      env_seed, agent_seed = None, None
      try:
          env, agent = RolloutRunner.init_env_and_agent(
              env_config,
              wrapper_config,
              max_episode_steps,
              agent_config,
              input_directory,
          )
          assert isinstance(agent, ReplayRecordedActionsPolicy)
  
          # Set up the wrappers
          if not isinstance(env, SpacesRecordingWrapper):
              BColors.print_colored(
                  "Adding SpacesRecordingWrapper on top of wrapper stack!",
                  color=BColors.WARNING,
              )
              env = SpacesRecordingWrapper.wrap(env)
  
          (
              env,
              episode_recorder,
          ) = ParallelRolloutWorker._setup_monitoring(
              env, record_trajectory
          )
  
          first_episode = True
          while True:
              if seeding_queue.empty():
                  if first_episode:
                      break
  
                  # after we finished the last seed, we need to reset env and agent to collect the
                  # statistics of the last rollout
                  try:
                      env.reset()
                      agent.reset()
                  except Exception as e:
                      logger.warning(
                          f"\nException in event collection reset() encountered: {e}"
                          f"\n{traceback.format_exc()}"
                      )
  
                  reporting_queue.put(
                      episode_recorder.get_last_episode_data()
                  )
                  break
  
              # initialize replay action policy
              action_record_path = seeding_queue.get()
              agent.load_action_record(action_record_path)
  
              # request env seed
              env_seed = agent.action_record.seed
              env.seed(env_seed)
  
              try:
                  obs = env.reset()
                  agent.reset()
  
                  RolloutRunner.run_episode(
                      env=env,
                      agent=agent,
                      obs=obs,
                      deterministic=deterministic,
                      render=False,
                  )
  
                  out_txt = (
                      f"agent_seed: {agent_seed}"
                      f" | {str(env.core_env if isinstance(env, MazeEnv) else env)}"
                  )
                  logger.info(out_txt)
              except Exception as e:
                  out_txt = (
                      f"agent_seed: {agent_seed}"
                      f" | {str(env.core_env if isinstance(env, MazeEnv) else env)}"
                      f"\nException encountered: {e}"
                      f"\n{traceback.format_exc()}"
                  )
                  logger.warning(out_txt)
              finally:
                  if not first_episode:
                      reporting_queue.put(
                          episode_recorder.get_last_episode_data()
                      )
                  first_episode = False
  
      except Exception as exception:
          # Ship exception along with a traceback to the main process
          exception_report = ExceptionReport(
              exception, traceback.format_exc(), env_seed, agent_seed
          )
          reporting_queue.put(exception_report)
          raise
  
imports: import glob
  import logging
  import os
  import traceback
  from multiprocessing import Queue, Process
  from typing import Iterable
  from omegaconf import DictConfig
  from maze.core.agent.replay_recorded_actions_policy import ReplayRecordedActionsPolicy
  from maze.core.annotations import override
  from maze.core.env.maze_env import MazeEnv
  from maze.core.rollout.parallel_rollout_runner import ParallelRolloutRunner, ParallelRolloutWorker, ExceptionReport
  from maze.core.rollout.rollout_runner import RolloutRunner
  from maze.core.utils.factory import ConfigType, CollectionOfConfigType
  from maze.core.wrappers.observation_normalization.observation_normalization_utils import obtain_normalization_statistics
  from maze.core.wrappers.observation_normalization.observation_normalization_wrapper import ObservationNormalizationWrapper
  from maze.core.wrappers.spaces_recording_wrapper import SpacesRecordingWrapper
  from maze.utils.bcolors import BColors
label_desc: Use image node_id 1 for calling the ActionRecordWorker obj's underlying member method code with example usage: obj.run(env_config, wrapper_config, agent_config, deterministic, max_episode_steps, record_trajectory, input_directory, reporting_queue, seeding_queue) without return types