docstr: Arguments:
      params: A dictionary of arguments to be be added to script_args.
      restart_count: Passes an incrementing counter to enable the re-execution of LightningWorks.
      code_dir: A path string determining where the source is extracted, default is current directory.
docstr_tok: ["Arguments",":","params",":","A","dictionary","of","arguments","to","be","be","added","to","script_args",".","restart_count",":","Passes","an","incrementing","counter","to","enable","the","re-execution","of","LightningWorks",".","code_dir",":","A","path","string","determining","where","the","source","is","extracted",",","default","is","current","directory","."]
code: def run(
      self,
      params: Optional[Dict[str, Any]] = None,
      restart_count: Optional[int] = None,
      code_dir: Optional[str] = ".",
      **kwargs: Any,
  ):
      """
      Arguments:
          params: A dictionary of arguments to be be added to script_args.
          restart_count: Passes an incrementing counter to enable the re-execution of LightningWorks.
          code_dir: A path string determining where the source is extracted, default is current directory.
      """
      if restart_count:
          self.restart_count = restart_count
  
      if params:
          self.params = params
          self.script_args = self.original_args + [
              self._to_script_args(k, v) for k, v in params.items()
          ]
  
      if self.drive:
          assert self.code_name
          if os.path.exists(self.code_name):
              clean_tarfile(self.code_name, "r:gz")
  
          if self.code_name in self.drive.list():
              self.drive.get(self.code_name)
              extract_tarfile(self.code_name, code_dir, "r:gz")
  
      prev_cwd = os.getcwd()
      os.chdir(code_dir)
  
      if not os.path.exists(self.script_path):
          raise FileNotFoundError(
              f"The provided `script_path` {self.script_path}` wasn't found."
          )
  
      kwargs = {
          k: v.value if isinstance(v, Payload) else v
          for k, v in kwargs.items()
      }
  
      init_globals = globals()
      init_globals.update(kwargs)
  
      self.on_before_run()
      env_copy = os.environ.copy()
      if self.env:
          os.environ.update(self.env)
      res = self._run_tracer(init_globals)
      os.chdir(prev_cwd)
      os.environ = env_copy
      return self.on_after_run(res)
  
imports: import os
  import signal
  import sys
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Union
  from typing_extensions import TypedDict
  from lightning.app.core.work import LightningWork
  from lightning.app.storage.drive import Drive
  from lightning.app.storage.payload import Payload
  from lightning.app.utilities.app_helpers import Logger, _collect_child_process_pids
  from lightning.app.utilities.packaging.tarfile import clean_tarfile, extract_tarfile
  from lightning.app.utilities.tracer import Tracer
label_desc: Use image node_id 5 for calling the TracerPythonScript obj's underlying member method code with example usage: obj.run(params, restart_count, code_dir) and returns: self