class_docstr: ClusterInfo exposes various properties that are set for tasks while running on the cluster.
  
  Examples:
  
  .. code:: python
  
      info = det.get_cluster_info()
      assert info is not None, "this code only runs on-cluster!"
  
      print("master_url", info.master_url)
      print("task_id", info.task_id)
      print("allocation_id", info.allocation_id)
      print("session_token", info.session_token)
  
      print("container_addrs", info.container_addrs)
      print("container_rank", info.container_rank)
  
      if info.task_type == "TRIAL":
          print("trial.id", info.trial.trial_id)
          print("trial.hparams", info.trial.hparams)
  
  .. warning::
  
     Be careful with this object!  If you depend on a ClusterInfo object during training for
     anything more than e.g.  informational logging, you run the risk of making your training code
     unable to run outside of Determined.  ClusterInfo is meant to be most useful to custom launch
     layers, which likely are not able to run outside of Determined anyway.
class_docstr_tok: ["ClusterInfo","exposes","various","properties","that","are","set","for","tasks","while","running","on","the","cluster",".","Examples",":","..","code",":",":","python","info","=","det.get_cluster_info","(",")","assert","info","is","not","None",",","``","this","code","only","runs","on-cluster","!","''","print","(","``","master_url","''",",","info.master_url",")","print","(","``","task_id","''",",","info.task_id",")","print","(","``","allocation_id","''",",","info.allocation_id",")","print","(","``","session_token","''",",","info.session_token",")","print","(","``","container_addrs","''",",","info.container_addrs",")","print","(","``","container_rank","''",",","info.container_rank",")","if","info.task_type","==","``","TRIAL","''",":","print","(","``","trial.id","''",",","info.trial.trial_id",")","print","(","``","trial.hparams","''",",","info.trial.hparams",")","..","warning",":",":","Be","careful","with","this","object","!","If","you","depend","on","a","ClusterInfo","object","during","training","for","anything","more","than","e.g",".","informational","logging",",","you","run","the","risk","of","making","your","training","code","unable","to","run","outside","of","Determined",".","ClusterInfo","is","meant","to","be","most","useful","to","custom","launch","layers",",","which","likely","are","not","able","to","run","outside","of","Determined","anyway","."]
code: def __init__(
      self,
      master_url: str,
      cluster_id: str,
      agent_id: str,
      slot_ids: List[int],
      task_id: str,
      allocation_id: str,
      session_token: str,
      task_type: str,
      # Optional information from the master:
      master_cert_name: Optional[str] = None,
      master_cert_file: Optional[str] = None,
      latest_checkpoint: Optional[str] = None,
      # Information which is generated within a container at runtime.
      trial_info: Optional[TrialInfo] = None,
      rendezvous_info: Optional[RendezvousInfo] = None,
      resources_info: Optional[ResourcesInfo] = None,
  ):
      #: The url for reaching the master.
      self.master_url = master_url
  
      #: The unique identifier for this cluster.
      self.cluster_id = cluster_id
  
      #: The identifier of the Determined agent this container is running on.
      self.agent_id = agent_id
  
      #: The slot ids assigned to this container.
      self.slot_ids = slot_ids
  
      #: The unique identifier for the current task.
      self.task_id = task_id
  
      #: The unique identifier for the current allocation.
      self.allocation_id = allocation_id
  
      #: The Determined login session token created for the current task.
      self.session_token = session_token
  
      #: The type of task.  Currently one of the following string literals:
      #:    - ``"TRIAL"``
      #:    - ``"NOTEBOOK"``
      #:    - ``"SHELL"``
      #:    - ``"COMMAND"``
      #:    - ``"TENSORBOARD"``
      #:    - ``"CHECKPOINT_GC"``
      #:
      #: Additional values may be added in the future.
      self.task_type = task_type
  
      #: The name on the master certificate, when using TLS.
      self.master_cert_name = master_cert_name
  
      #: The file location for the master certificate, if present, or "noverify" if it has been
      #: configured not to verify the master cert.
      self.master_cert_file = master_cert_file
  
      self._latest_checkpoint = latest_checkpoint
  
      self._trial_info = trial_info
      self._rendezvous_info = rendezvous_info
      self._resources_info = resources_info
  
imports: import json
  import os
  from typing import Any, Dict, Iterable, List, Optional, Union
  from determined import gpu
label_desc: Use image node_id 1 to create a new ClusterInfo object  with example: obj = ClusterInfo(master_url, cluster_id, agent_id, slot_ids, task_id, allocation_id, session_token, task_type, master_cert_name, master_cert_file, latest_checkpoint, trial_info, rendezvous_info, resources_info)