class_docstr: An In process Phoenix controller.
  
  This controller assumes search, ensembling, distillation and replay all run
  in the same binary.
  
  It will allocate trials for the various functionalities based on trial id.
class_docstr_tok: ["An","In","process","Phoenix","controller",".","This","controller","assumes","search",",","ensembling",",","distillation","and","replay","all","run","in","the","same","binary",".","It","will","allocate","trials","for","the","various","functionalities","based","on","trial","id","."]
docstr: Determines which generators to run.
docstr_tok: ["Determines","which","generators","to","run","."]
code: def get_generators(self, my_id, all_trials):
      """Determines which generators to run."""
      output = {}
      ensemble_spec = self._phoenix_spec.ensemble_spec
      distillation_spec = self._phoenix_spec.distillation_spec
      logging.info("trial id: %d", my_id)
  
      # Handling replay
      if self._replay_state.is_replay():
          if self._replay_state.replay_is_training_a_tower(my_id):
              output.update(
                  {
                      base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                          self._search_candidate_generator, []
                      )
                  }
              )
          if self._replay_state.replay_is_importing_towers(my_id):
              output.update(
                  {
                      base_tower_generator.REPLAY_GENERATOR: GeneratorWithTrials(
                          self._replay_generator, []
                      )
                  }
              )
  
          return _return_generators(output)
  
      # Real Search from here on.
      # First: User suggestions first! No ensembling in suggestions.
      if my_id <= len(self._phoenix_spec.user_suggestions):
          logging.info("user suggestions mode")
          output.update(
              {
                  base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                      self._search_candidate_generator, []
                  )
              }
          )
          return _return_generators(output)
  
      # Second: Handle non-adaptive search
      if trial_utils.is_nonadaptive_ensemble_search(ensemble_spec):
          logging.info("non adaptive ensembling mode")
          pool_size = ensemble_spec.nonadaptive_search.minimal_pool_size
          search_trials = [t for t in all_trials if t.id <= pool_size]
          # Pool too small, continue searching
          if my_id <= pool_size:
              output.update(
                  {
                      base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                          self._search_candidate_generator,
                          search_trials,
                      )
                  }
              )
              return _return_generators(output)
          # Pool hit critical mass, start ensembling.
          else:
              output.update(
                  {
                      base_tower_generator.PRIOR_GENERATOR: GeneratorWithTrials(
                          self._prior_candidate_generator, search_trials
                      )
                  }
              )
              return _return_generators(output)
  
      # Third: Adaptive / Residual ensemble search
      if trial_utils.is_adaptive_ensemble_search(
          ensemble_spec
      ) or trial_utils.is_residual_ensemble_search(ensemble_spec):
          logging.info("adaptive/residual ensembling mode")
          increase_every = (
              ensemble_spec.adaptive_search.increase_width_every
          )
          pool_size = my_id // increase_every * increase_every
          ensembling_trials = [
              trial for trial in all_trials if trial.id <= pool_size
          ]
          search_trials = [
              trial for trial in all_trials if trial.id > pool_size
          ]
          if ensembling_trials:
              output.update(
                  {
                      base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                          self._search_candidate_generator,
                          search_trials,
                      ),
                      base_tower_generator.PRIOR_GENERATOR: GeneratorWithTrials(
                          self._prior_candidate_generator,
                          ensembling_trials,
                      ),
                  }
              )
              return _return_generators(output)
          else:
              output.update(
                  {
                      base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                          self._search_candidate_generator,
                          search_trials,
                      )
                  }
              )
              return _return_generators(output)
  
      # Fourth: Intermixed Search.
      if trial_utils.is_intermixed_ensemble_search(ensemble_spec):
          logging.info("intermix ensemble search mode")
          n = ensemble_spec.intermixed_search.try_ensembling_every
          search_trials = [t for t in all_trials if t.id % n != 0]
          if my_id % n != 0:
              output.update(
                  {
                      base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                          self._search_candidate_generator,
                          search_trials,
                      )
                  }
              )
              if (
                  trial_utils.get_trial_mode(
                      ensemble_spec, distillation_spec, my_id
                  )
                  == trial_utils.TrialMode.DISTILLATION
              ):
                  output.update(
                      {
                          base_tower_generator.PRIOR_GENERATOR: GeneratorWithTrials(
                              self._prior_candidate_generator,
                              all_trials,
                          )
                      }
                  )
              return _return_generators(output)
          else:
              output.update(
                  {
                      base_tower_generator.PRIOR_GENERATOR: GeneratorWithTrials(
                          self._prior_candidate_generator, search_trials
                      )
                  }
              )
              return _return_generators(output)
  
      # No ensembling
      output.update(
          {
              base_tower_generator.SEARCH_GENERATOR: GeneratorWithTrials(
                  self._search_candidate_generator, all_trials
              )
          }
      )
      return _return_generators(output)
  
imports: import abc
  import collections
  from absl import logging
  from model_search.architecture import architecture_utils
  from model_search.generators import base_tower_generator
  from model_search.generators import trial_utils
  from model_search.generators.prior_generator import PriorGenerator
  from model_search.generators.replay_generator import ReplayGenerator
  from model_search.generators.search_candidate_generator import SearchCandidateGenerator
label_desc: Use image node_id 2 for calling the InProcessController obj's underlying member method code with example usage: obj.get_generators(my_id, all_trials) and returns: _return_generators, _return_generators, _return_generators, _return_generators, _return_generators, _return_generators, _return_generators, _return_generators, _return_generators