class_docstr: TrialController is the legacy class that represented the Determined-owned logic to interact with
  a user-owned Trial class.
class_docstr_tok: ["TrialController","is","the","legacy","class","that","represented","the","Determined-owned","logic","to","interact","with","a","user-owned","Trial","class","."]
code: def __init__(
      self,
      context: Any,
      env: det.EnvContext,
      workloads: Optional[workload.Stream] = None,
  ) -> None:
      self.context = context
      self.env = env
      # The only time that workloads should be non-None here is unit tests or test mode.
      self.workloads = workloads
  
      self.prof = profiler.ProfilerAgent.from_env(
          env,
          global_rank=context.distributed.rank,
          local_rank=context.distributed.local_rank,
      )
  
      distributed_backend = _DistributedBackend()
      self.use_horovod = distributed_backend.use_horovod()
      self.use_torch = distributed_backend.use_torch()
  
      self.scheduling_unit = (
          self.env.experiment_config.scheduling_unit()
      )
  
      self.is_chief = context.distributed.rank == 0
  
      if context.distributed.size > 1 and not self.is_chief:
          log_level = (
              logging.DEBUG
              if self.env.experiment_config.debug_enabled()
              else logging.WARNING
          )
          logging.getLogger().setLevel(log_level)
  
file_path: determined/harness/determined/_trial_controller.py
imports: import abc
  import logging
  import os
  from typing import Any, Optional, Type
  import determined
  from determined import profiler, tensorboard, workload
label_desc: Use image node_id 1 to create a new TrialController object  with example: obj = TrialController(context, env, workloads)