code: def rollout_worker(
      graph_manager, data_store, num_workers, task_parameters
  ):
      """
      wait for first checkpoint then perform rollouts using the model
      """
      if (
          graph_manager.agent_params.algorithm.distributed_coach_synchronization_type
          == DistributedCoachSynchronizationType.SYNC
      ):
          timeout = float("inf")
      else:
          timeout = None
  
      # this could probably be moved up into coach.py
      graph_manager.create_graph(task_parameters)
  
      data_store.load_policy(
          graph_manager, require_new_policy=False, timeout=60
      )
  
      with graph_manager.phase_context(RunPhase.TRAIN):
          # this worker should play a fraction of the total playing steps per rollout
          graph_manager.reset_internal_state(
              force_environment_reset=True
          )
  
          act_steps = (
              graph_manager.agent_params.algorithm.num_consecutive_playing_steps
              / num_workers
          )
          for i in range(graph_manager.improve_steps / act_steps):
              if data_store.end_of_policies():
                  break
  
              graph_manager.act(
                  act_steps,
                  wait_for_full_episodes=graph_manager.agent_params.algorithm.act_for_full_episodes,
              )
  
              data_store.load_policy(
                  graph_manager,
                  require_new_policy=True,
                  timeout=timeout,
              )
  
file_path: coach/rl_coach/rollout_worker.py
imports: import time
  import os
  from rl_coach.base_parameters import TaskParameters, DistributedCoachSynchronizationType
  from rl_coach.checkpoint import CheckpointStateFile, CheckpointStateReader
  from rl_coach.data_stores.data_store import SyncFiles
  from rl_coach.core_types import RunPhase
label_desc: Use image node_id 3 for calling a global function with example usage: rollout_worker(graph_manager, data_store, num_workers, task_parameters) without return types