class_docstr: This class keeps track of different profilers on a per
  stage/UDF basis. Also this is used to create new profilers for
  the different stages/UDFs.
class_docstr_tok: ["This","class","keeps","track","of","different","profilers","on","a","per","stage\/UDF","basis",".","Also","this","is","used","to","create","new","profilers","for","the","different","stages\/UDFs","."]
docstr: Add a profiler for RDD/UDF `id`
docstr_tok: ["Add","a","profiler","for","RDD\/UDF","`","id","`"]
code: def add_profiler(self, id: int, profiler: "Profiler") -> None:
      """Add a profiler for RDD/UDF `id`"""
      if not self.profilers:
          if self.profile_dump_path:
              atexit.register(
                  self.dump_profiles, self.profile_dump_path
              )
          else:
              atexit.register(self.show_profiles)
  
      self.profilers.append([id, profiler, False])
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TYPE_CHECKING, Union, cast
  import cProfile
  import inspect
  import pstats
  import linecache
  import os
  import atexit
  import sys
  import warnings
  from pyspark.accumulators import AccumulatorParam
  from pyspark.errors import PySparkRuntimeError
label_desc: Use image node_id 5 for calling the ProfilerCollector obj's underlying member method code with example usage: obj.add_profiler(id, profiler) without return types