class_docstr: The SageMaker Debugger ProfilerRule class configures *profiling* rules.
  
  SageMaker Debugger profiling rules automatically analyze
  hardware system resource utilization and framework metrics of a
  training job to identify performance bottlenecks.
  
  SageMaker Debugger comes pre-packaged with built-in *profiling* rules.
  For example, the profiling rules can detect if GPUs are underutilized due to CPU bottlenecks or
  IO bottlenecks.
  For a full list of built-in rules for debugging, see
  `List of Debugger Built-in Rules <https://docs.aws.amazon.com/sagemaker/latest/dg/debugger-built-in-rules.html>`_.
  You can also write your own profiling rules using the Amazon SageMaker
  Debugger APIs.
  
  .. tip::
      Use the following ``ProfilerRule.sagemaker`` class method for built-in profiling rules
      or the ``ProfilerRule.custom`` class method for custom profiling rules.
      Do not directly use the `Rule` initialization method.
class_docstr_tok: ["The","SageMaker","Debugger","ProfilerRule","class","configures","*","profiling","*","rules",".","SageMaker","Debugger","profiling","rules","automatically","analyze","hardware","system","resource","utilization","and","framework","metrics","of","a","training","job","to","identify","performance","bottlenecks",".","SageMaker","Debugger","comes","pre-packaged","with","built-in","*","profiling","*","rules",".","For","example",",","the","profiling","rules","can","detect","if","GPUs","are","underutilized","due","to","CPU","bottlenecks","or","IO","bottlenecks",".","For","a","full","list","of","built-in","rules","for","debugging",",","see","`","List","of","Debugger","Built-in","Rules","<","https",":","\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/debugger-built-in-rules.html",">","`","_",".","You","can","also","write","your","own","profiling","rules","using","the","Amazon","SageMaker","Debugger","APIs",".","..","tip",":",":","Use","the","following","``","ProfilerRule.sagemaker","``","class","method","for","built-in","profiling","rules","or","the","``","ProfilerRule.custom","``","class","method","for","custom","profiling","rules",".","Do","not","directly","use","the","`","Rule","`","initialization","method","."]
docstr: Initialize a ``ProfilerRule`` object for a *custom* profiling rule.
  
  You can create a rule that
  analyzes system and framework metrics emitted during the training of a model and
  monitors conditions that are critical for the success of a
  training job.
  
  Args:
      name (str): The name of the profiler rule.
      image_uri (str): The URI of the image to be used by the proflier rule.
      instance_type (str): Type of EC2 instance to use, for example,
          'ml.c4.xlarge'.
      volume_size_in_gb (int): Size in GB of the EBS volume
          to use for storing data.
      source (str): A source file containing a rule to invoke. If provided,
          you must also provide rule_to_invoke. This can either be an S3 uri or
          a local path.
      rule_to_invoke (str): The name of the rule to invoke within the source.
          If provided, you must also provide the source.
      container_local_output_path (str): The path in the container.
      s3_output_path (str): The location in Amazon S3 to store the output.
          The default Debugger output path for profiling data is created under the
          default output path of the :class:`~sagemaker.estimator.Estimator` class.
          For example,
          s3://sagemaker-<region>-<12digit_account_id>/<training-job-name>/profiler-output/.
      rule_parameters (dict): A dictionary of parameters for the rule.
  
  Returns:
      :class:`~sagemaker.debugger.ProfilerRule`:
      The instance of the custom ProfilerRule.
code: def custom(
      cls,
      name,
      image_uri,
      instance_type,
      volume_size_in_gb,
      source=None,
      rule_to_invoke=None,
      container_local_output_path=None,
      s3_output_path=None,
      rule_parameters=None,
  ):
      """Initialize a ``ProfilerRule`` object for a *custom* profiling rule.
  
      You can create a rule that
      analyzes system and framework metrics emitted during the training of a model and
      monitors conditions that are critical for the success of a
      training job.
  
      Args:
          name (str): The name of the profiler rule.
          image_uri (str): The URI of the image to be used by the proflier rule.
          instance_type (str): Type of EC2 instance to use, for example,
              'ml.c4.xlarge'.
          volume_size_in_gb (int): Size in GB of the EBS volume
              to use for storing data.
          source (str): A source file containing a rule to invoke. If provided,
              you must also provide rule_to_invoke. This can either be an S3 uri or
              a local path.
          rule_to_invoke (str): The name of the rule to invoke within the source.
              If provided, you must also provide the source.
          container_local_output_path (str): The path in the container.
          s3_output_path (str): The location in Amazon S3 to store the output.
              The default Debugger output path for profiling data is created under the
              default output path of the :class:`~sagemaker.estimator.Estimator` class.
              For example,
              s3://sagemaker-<region>-<12digit_account_id>/<training-job-name>/profiler-output/.
          rule_parameters (dict): A dictionary of parameters for the rule.
  
      Returns:
          :class:`~sagemaker.debugger.ProfilerRule`:
          The instance of the custom ProfilerRule.
  
      """
      merged_rule_params = super()._set_rule_parameters(
          source, rule_to_invoke, rule_parameters
      )
  
      return cls(
          name=name,
          image_uri=image_uri,
          instance_type=instance_type,
          container_local_output_path=container_local_output_path,
          s3_output_path=s3_output_path,
          volume_size_in_gb=volume_size_in_gb,
          rule_parameters=merged_rule_params,
      )
  
imports: from __future__ import absolute_import
  from abc import ABC
  from typing import Union, Optional, List, Dict
  import attr
  import smdebug_rulesconfig
  from sagemaker import image_uris
  from sagemaker.utils import build_dict, name_from_base
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.debugger.profiler_constants import DETAIL_PROF_PROCESSING_DEFAULT_INSTANCE_TYPE, DETAIL_PROF_PROCESSING_DEFAULT_VOLUME_SIZE
label_desc: Use image node_id 2 for calling the ProfilerRule obj's underlying member method code with example usage: obj.custom(cls, name, image_uri, instance_type, volume_size_in_gb, source, rule_to_invoke, container_local_output_path, s3_output_path, rule_parameters) and returns: cls