class_docstr: Sets up the profiling configuration for framework metrics.
  
  Validates user inputs and fills in default values if no input is provided.
  There are three main profiling options to choose from:
  :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig`,
  :class:`~sagemaker.debugger.metrics_config.DataloaderProfilingConfig`, and
  :class:`~sagemaker.debugger.metrics_config.PythonProfilingConfig`.
  
  The following list shows available scenarios of configuring the profiling options.
  
  1. None of the profiling configuration, step range, or time range is specified.
  SageMaker Debugger activates framework profiling based on the default settings
  of each profiling option.
  
  .. code-block:: python
  
      from sagemaker.debugger import ProfilerConfig, FrameworkProfile
  
      profiler_config=ProfilerConfig(
          framework_profile_params=FrameworkProfile()
      )
  
  2. Target step or time range is specified to
  this :class:`~sagemaker.debugger.metrics_config.FrameworkProfile` class.
  The requested target step or time range setting propagates to all of
  the framework profiling options.
  For example, if you configure this class as following, all of the profiling options
  profiles the 6th step:
  
  .. code-block:: python
  
      from sagemaker.debugger import ProfilerConfig, FrameworkProfile
  
      profiler_config=ProfilerConfig(
          framework_profile_params=FrameworkProfile(start_step=6, num_steps=1)
      )
  
  3. Individual profiling configurations are specified through
  the ``*_profiling_config`` parameters.
  SageMaker Debugger profiles framework metrics only for the specified profiling configurations.
  For example, if the :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig` class
  is configured but not the other profiling options, Debugger only profiles based on the settings
  specified to the
  :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig` class.
  For example, the following example shows a profiling configuration to perform
  detailed profiling at step 10, data loader profiling at step 9 and 10,
  and Python profiling at step 12.
  
  .. code-block:: python
  
      from sagemaker.debugger import ProfilerConfig, FrameworkProfile
  
      profiler_config=ProfilerConfig(
          framework_profile_params=FrameworkProfile(
              detailed_profiling_config=DetailedProfilingConfig(start_step=10, num_steps=1),
              dataloader_profiling_config=DataloaderProfilingConfig(start_step=9, num_steps=2),
              python_profiling_config=PythonProfilingConfig(start_step=12, num_steps=1),
          )
      )
  
  If the individual profiling configurations are specified in addition to
  the step or time range,
  SageMaker Debugger prioritizes the individual profiling configurations and ignores
  the step or time range. For example, in the following code,
  the ``start_step=1`` and ``num_steps=10`` will be ignored.
  
  .. code-block:: python
  
      from sagemaker.debugger import ProfilerConfig, FrameworkProfile
  
      profiler_config=ProfilerConfig(
          framework_profile_params=FrameworkProfile(
              start_step=1,
              num_steps=10,
              detailed_profiling_config=DetailedProfilingConfig(start_step=10, num_steps=1),
              dataloader_profiling_config=DataloaderProfilingConfig(start_step=9, num_steps=2),
              python_profiling_config=PythonProfilingConfig(start_step=12, num_steps=1)
          )
      )
docstr: Initialize the FrameworkProfile class object.
  
  Args:
      detailed_profiling_config (DetailedProfilingConfig): The configuration for detailed
          profiling. Configure it using the
          :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig` class.
          Pass ``DetailedProfilingConfig()`` to use the default configuration.
  
          .. warning::
              This detailed framework profiling feature discontinues support for TensorFlow v2.11
              and later. To use the detailed profiling feature, use previous versions of
              TensorFlow between v2.3.1 and v2.10.0.
  
      dataloader_profiling_config (DataloaderProfilingConfig): The configuration for
          dataloader metrics profiling. Configure it using the
          :class:`~sagemaker.debugger.metrics_config.DataloaderProfilingConfig` class.
          Pass ``DataloaderProfilingConfig()`` to use the default configuration.
      python_profiling_config (PythonProfilingConfig): The configuration for stats
          collected by the Python profiler (cProfile or Pyinstrument).
          Configure it using the
          :class:`~sagemaker.debugger.metrics_config.PythonProfilingConfig` class.
          Pass ``PythonProfilingConfig()`` to use the default configuration.
      start_step (int): The step at which to start profiling.
      num_steps (int): The number of steps to profile.
      start_unix_time (int): The Unix time at which to start profiling.
      duration (float): The duration in seconds to profile.
  
  .. tip::
      Available profiling range parameter pairs are
      (**start_step** and **num_steps**) and (**start_unix_time** and **duration**).
      The two parameter pairs are mutually exclusive, and this class validates
      if one of the two pairs is used. If both pairs are specified, a
      conflict error occurs.
docstr_tok: ["Initialize","the","FrameworkProfile","class","object",".","Args",":","detailed_profiling_config","(","DetailedProfilingConfig",")",":","The","configuration","for","detailed","profiling",".","Configure","it","using","the",":","class",":","`","~sagemaker.debugger.metrics_config.DetailedProfilingConfig","`","class",".","Pass","``","DetailedProfilingConfig","(",")","``","to","use","the","default","configuration",".","..","warning",":",":","This","detailed","framework","profiling","feature","discontinues","support","for","TensorFlow","v2.11","and","later",".","To","use","the","detailed","profiling","feature",",","use","previous","versions","of","TensorFlow","between","v2.3.1","and","v2.10.0",".","dataloader_profiling_config","(","DataloaderProfilingConfig",")",":","The","configuration","for","dataloader","metrics","profiling",".","Configure","it","using","the",":","class",":","`","~sagemaker.debugger.metrics_config.DataloaderProfilingConfig","`","class",".","Pass","``","DataloaderProfilingConfig","(",")","``","to","use","the","default","configuration",".","python_profiling_config","(","PythonProfilingConfig",")",":","The","configuration","for","stats","collected","by","the","Python","profiler","(","cProfile","or","Pyinstrument",")",".","Configure","it","using","the",":","class",":","`","~sagemaker.debugger.metrics_config.PythonProfilingConfig","`","class",".","Pass","``","PythonProfilingConfig","(",")","``","to","use","the","default","configuration",".","start_step","(","int",")",":","The","step","at","which","to","start","profiling",".","num_steps","(","int",")",":","The","number","of","steps","to","profile",".","start_unix_time","(","int",")",":","The","Unix","time","at","which","to","start","profiling",".","duration","(","float",")",":","The","duration","in","seconds","to","profile",".","..","tip",":",":","Available","profiling","range","parameter","pairs","are","(","*","*","start_step","*","*","and","*","*","num_steps","*","*",")","and","(","*","*","start_unix_time","*","*","and","*","*","duration","*","*",")",".","The","two","parameter","pairs","are","mutually","exclusive",",","and","this","class","validates","if","one","of","the","two","pairs","is","used",".","If","both","pairs","are","specified",",","a","conflict","error","occurs","."]
code: def __init__(
      self,
      local_path=BASE_FOLDER_DEFAULT,
      file_max_size=MAX_FILE_SIZE_DEFAULT,
      file_close_interval=CLOSE_FILE_INTERVAL_DEFAULT,
      file_open_fail_threshold=FILE_OPEN_FAIL_THRESHOLD_DEFAULT,
      detailed_profiling_config=None,
      dataloader_profiling_config=None,
      python_profiling_config=None,
      horovod_profiling_config=None,
      smdataparallel_profiling_config=None,
      start_step=None,
      num_steps=None,
      start_unix_time=None,
      duration=None,
  ):
      """Initialize the FrameworkProfile class object.
  
      Args:
          detailed_profiling_config (DetailedProfilingConfig): The configuration for detailed
              profiling. Configure it using the
              :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig` class.
              Pass ``DetailedProfilingConfig()`` to use the default configuration.
  
              .. warning::
                  This detailed framework profiling feature discontinues support for TensorFlow v2.11
                  and later. To use the detailed profiling feature, use previous versions of
                  TensorFlow between v2.3.1 and v2.10.0.
  
          dataloader_profiling_config (DataloaderProfilingConfig): The configuration for
              dataloader metrics profiling. Configure it using the
              :class:`~sagemaker.debugger.metrics_config.DataloaderProfilingConfig` class.
              Pass ``DataloaderProfilingConfig()`` to use the default configuration.
          python_profiling_config (PythonProfilingConfig): The configuration for stats
              collected by the Python profiler (cProfile or Pyinstrument).
              Configure it using the
              :class:`~sagemaker.debugger.metrics_config.PythonProfilingConfig` class.
              Pass ``PythonProfilingConfig()`` to use the default configuration.
          start_step (int): The step at which to start profiling.
          num_steps (int): The number of steps to profile.
          start_unix_time (int): The Unix time at which to start profiling.
          duration (float): The duration in seconds to profile.
  
      .. tip::
          Available profiling range parameter pairs are
          (**start_step** and **num_steps**) and (**start_unix_time** and **duration**).
          The two parameter pairs are mutually exclusive, and this class validates
          if one of the two pairs is used. If both pairs are specified, a
          conflict error occurs.
  
      """
      self.profiling_parameters = {}
      self._use_default_metrics_configs = False
      self._use_one_config_for_all_metrics = False
      self._use_custom_metrics_configs = False
  
      self._process_trace_file_parameters(
          local_path,
          file_max_size,
          file_close_interval,
          file_open_fail_threshold,
      )
      use_custom_metrics_configs = self._process_metrics_configs(
          detailed_profiling_config,
          dataloader_profiling_config,
          python_profiling_config,
          horovod_profiling_config,
          smdataparallel_profiling_config,
      )
  
      use_one_config_for_all_metrics = (
          self._process_range_fields(
              start_step, num_steps, start_unix_time, duration
          )
          if not use_custom_metrics_configs
          else False
      )
  
      if (
          not use_custom_metrics_configs
          and not use_one_config_for_all_metrics
      ):
          self._create_default_metrics_configs()
  
file_path: sagemaker-python-sdk/src/sagemaker/debugger/framework_profile.py
imports: from __future__ import absolute_import
  from sagemaker.debugger.metrics_config import DetailedProfilingConfig, DataloaderProfilingConfig, SMDataParallelProfilingConfig, HorovodProfilingConfig, PythonProfilingConfig
  from sagemaker.debugger.profiler_constants import BASE_FOLDER_DEFAULT, CLOSE_FILE_INTERVAL_DEFAULT, FILE_OPEN_FAIL_THRESHOLD_DEFAULT, MAX_FILE_SIZE_DEFAULT
  from sagemaker.debugger.utils import ErrorMessages
label_desc: Use image node_id 1 to create a new FrameworkProfile object  with example: obj = FrameworkProfile(local_path, file_max_size, file_close_interval, file_open_fail_threshold, detailed_profiling_config, dataloader_profiling_config, python_profiling_config, horovod_profiling_config, smdataparallel_profiling_config, start_step, num_steps, start_unix_time, duration)