class_docstr: DistributedContext provides useful methods for effective distributed training.
  
  A DistributedContext has the following required args:
   - rank: the index of this worker in the entire job
   - size: the number of workers in the entire job
   - local_rank: the index of this worker on this machine
   - local_size: the number of workers on this machine
   - cross_rank: the index of this machine in the entire job
   - cross_size: the number of machines in the entire job
  
  Additionally, any time that cross_size > 1, you must also provide:
   - chief_ip: the ip address to reach the chief worker (where rank==0)
  
  .. note::
  
     DistributedContext has ``.allgather()``, ``.gather()``, and ``.broadcast()`` methods, which
     are easy to use and which can be useful for coordinating work across workers, but it is not a
     replacement for the allgather/gather/broadcast operations in your particular distributed
     training framework.
class_docstr_tok: ["DistributedContext","provides","useful","methods","for","effective","distributed","training",".","A","DistributedContext","has","the","following","required","args",":","-","rank",":","the","index","of","this","worker","in","the","entire","job","-","size",":","the","number","of","workers","in","the","entire","job","-","local_rank",":","the","index","of","this","worker","on","this","machine","-","local_size",":","the","number","of","workers","on","this","machine","-","cross_rank",":","the","index","of","this","machine","in","the","entire","job","-","cross_size",":","the","number","of","machines","in","the","entire","job","Additionally",",","any","time","that","cross_size",">","1",",","you","must","also","provide",":","-","chief_ip",":","the","ip","address","to","reach","the","chief","worker","(","where","rank==0",")","..","note",":",":","DistributedContext","has","``",".allgather","(",")","``",",","``",".gather","(",")","``",",","and","``",".broadcast","(",")","``","methods",",","which","are","easy","to","use","and","which","can","be","useful","for","coordinating","work","across","workers",",","but","it","is","not","a","replacement","for","the","allgather\/gather\/broadcast","operations","in","your","particular","distributed","training","framework","."]
docstr: Return the rank of the process on the agent. The local rank of a process
  is a unique ID within a given agent and trial; that is, no two processes
  in the same trial that are executing on the same agent are assigned the
  same rank.
docstr_tok: ["Return","the","rank","of","the","process","on","the","agent",".","The","local","rank","of","a","process","is","a","unique","ID","within","a","given","agent","and","trial",";","that","is",",","no","two","processes","in","the","same","trial","that","are","executing","on","the","same","agent","are","assigned","the","same","rank","."]
code: def get_local_rank(self) -> int:
      """
      Return the rank of the process on the agent. The local rank of a process
      is a unique ID within a given agent and trial; that is, no two processes
      in the same trial that are executing on the same agent are assigned the
      same rank.
      """
      return self.local_rank
  
imports: import logging
  import os
  import socket
  import tempfile
  from typing import Any, List, Optional
  from determined import constants, ipc, util
label_desc: Use image node_id 8 for calling the DistributedContext obj's underlying member method code with example usage: obj.get_local_rank() and returns: self