class_docstr: Tracker client session.
  
  Parameters
  ----------
  addr : tuple
      The address tuple
class_docstr_tok: ["Tracker","client","session",".","Parameters","--","--","--","--","--","addr",":","tuple","The","address","tuple"]
docstr: Request a resource from tracker and run the func.
  
  This function safe-guard rare server node dropout during execution.
  In such case, a new resource will be requested and func will be ran again.
  
  Parameters
  ----------
  key : str
      The type key of the device.
  
  func : function of session -> value
      A stateless function
  
  priority : int, optional
      The priority of the request.
  
  session_timeout : float, optional
      The duration of the session, allows server to kill
      the connection when duration is longer than this value.
      When duration is zero, it means the request must always be kept alive.
  
  max_retry : int, optional
      Maximum number of times to retry the function before give up.
docstr_tok: ["Request","a","resource","from","tracker","and","run","the","func",".","This","function","safe-guard","rare","server","node","dropout","during","execution",".","In","such","case",",","a","new","resource","will","be","requested","and","func","will","be","ran","again",".","Parameters","--","--","--","--","--","key",":","str","The","type","key","of","the","device",".","func",":","function","of","session","-",">","value","A","stateless","function","priority",":","int",",","optional","The","priority","of","the","request",".","session_timeout",":","float",",","optional","The","duration","of","the","session",",","allows","server","to","kill","the","connection","when","duration","is","longer","than","this","value",".","When","duration","is","zero",",","it","means","the","request","must","always","be","kept","alive",".","max_retry",":","int",",","optional","Maximum","number","of","times","to","retry","the","function","before","give","up","."]
code: def request_and_run(
      self, key, func, priority=1, session_timeout=0, max_retry=2
  ):
      """Request a resource from tracker and run the func.
  
      This function safe-guard rare server node dropout during execution.
      In such case, a new resource will be requested and func will be ran again.
  
      Parameters
      ----------
      key : str
          The type key of the device.
  
      func : function of session -> value
          A stateless function
  
      priority : int, optional
          The priority of the request.
  
      session_timeout : float, optional
          The duration of the session, allows server to kill
          the connection when duration is longer than this value.
          When duration is zero, it means the request must always be kept alive.
  
      max_retry : int, optional
          Maximum number of times to retry the function before give up.
      """
      last_err = None
      for _ in range(max_retry):
          try:
              sess = self.request(
                  key,
                  priority=priority,
                  session_timeout=session_timeout,
              )
              tstart = time.time()
              return func(sess)
          except TVMError as err:
              duration = time.time() - tstart
              # roughly estimate if the error is due to timeout termination
              if session_timeout and duration >= session_timeout * 0.95:
                  raise RuntimeError(
                      f"Session timeout when running {func.__name__}"
                  )
              last_err = err
      raise RuntimeError(
          f"Failed to run on {key} after {max_retry} retry, last_error:{str(last_err)}"
      )
  
imports: import os
  import socket
  import stat
  import struct
  import time
  import tvm._ffi
  from tvm._ffi.base import TVMError
  from tvm.contrib import utils
  from tvm.runtime import ndarray
  from tvm._ffi.runtime_ctypes import Device
  from .None import _ffi_api, base, server
label_desc: Use image node_id 8 for calling the TrackerSession obj's underlying member method code with example usage: obj.request_and_run(key, func, priority, session_timeout, max_retry) and returns: func