class_docstr: Basic Distributed-Actors-Module using python multiprocessing.Process
  
  :param queue_out_of_sync_factor: this factor multiplied by the actor_batch_size gives the size of the queue.
      Therefore if the all rollouts computed can be  at most
      (queue_out_of_sync_factor + num_agents/actor_batch_size) out of sync with learner policy.
  :param start_method: Method used to start the subprocesses.
     Must be one of the methods returned by multiprocessing.get_all_start_methods().
     Defaults to 'forkserver' on available platforms, and 'spawn' otherwise.
  :param actor_env_seeds: A list of seeds for each actors' env.
  :param actor_agent_seeds: A list of seed for each actors' policy.
class_docstr_tok: ["Basic","Distributed-Actors-Module","using","python","multiprocessing.Process",":","param","queue_out_of_sync_factor",":","this","factor","multiplied","by","the","actor_batch_size","gives","the","size","of","the","queue",".","Therefore","if","the","all","rollouts","computed","can","be","at","most","(","queue_out_of_sync_factor","+","num_agents\/actor_batch_size",")","out","of","sync","with","learner","policy",".",":","param","start_method",":","Method","used","to","start","the","subprocesses",".","Must","be","one","of","the","methods","returned","by","multiprocessing.get_all_start_methods","(",")",".","Defaults","to","'forkserver","'","on","available","platforms",",","and","'spawn","'","otherwise",".",":","param","actor_env_seeds",":","A","list","of","seeds","for","each","actors","'","env",".",":","param","actor_agent_seeds",":","A","list","of","seed","for","each","actors","'","policy","."]
docstr: Get the right context for the multiprocessing.
  
  Fork is the best option, but is only available on unix systems and does not support actors and learner
  on gpu. Forkserver is then the second choice, Spawn the third.
  :return:
docstr_tok: ["Get","the","right","context","for","the","multiprocessing",".","Fork","is","the","best","option",",","but","is","only","available","on","unix","systems","and","does","not","support","actors","and","learner","on","gpu",".","Forkserver","is","then","the","second","choice",",","Spawn","the","third",".",":","return",":"]
code: def get_multiprocessing_context(self, start_method: str):
      """Get the right context for the multiprocessing.
  
      Fork is the best option, but is only available on unix systems and does not support actors and learner
      on gpu. Forkserver is then the second choice, Spawn the third.
      :return:
      """
  
      fork_available = (
          "fork" in multiprocessing.get_all_start_methods()
          and self.policy.device == "cpu"
      )
      forkserver_available = (
          "forkserver" in multiprocessing.get_all_start_methods()
      )
      if fork_available and start_method == "fork":
          start_method_used = "fork"
      elif forkserver_available and start_method == "forkserver":
          start_method_used = "forkserver"
      elif start_method == "spawn":
          start_method_used = "spawn"
      else:
          raise Exception(
              "Please provide a valid start method. Options are for this system: {}".format(
                  multiprocessing.get_all_start_methods()
              )
          )
  
      return multiprocessing.get_context(start_method_used)
  
imports: import time
  from typing import Callable, Union, Tuple, Dict, List
  import cloudpickle
  from torch import multiprocessing
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.annotations import override
  from maze.core.env.structured_env import StructuredEnv
  from maze.core.env.structured_env_spaces_mixin import StructuredEnvSpacesMixin
  from maze.core.log_stats.log_stats_env import LogStatsEnv
  from maze.core.rollout.rollout_generator import RolloutGenerator
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.core.trajectory_recording.records.trajectory_record import SpacesTrajectoryRecord
  from maze.perception.perception_utils import convert_to_torch
  from maze.train.parallelization.broadcasting_container import BroadcastingContainer, BroadcastingManager
  from maze.train.parallelization.distributed_actors.distributed_actors import DistributedActors
  from maze.utils.exception_report import ExceptionReport
label_desc: Use image node_id 7 for calling the SubprocDistributedActors obj's underlying member method code with example usage: obj.get_multiprocessing_context(start_method) and returns: multiprocessing