def _prepare_profiler_for_training()

in src/sagemaker/estimator.py [0:0]


    def _prepare_profiler_for_training(self):
        """Set necessary values and do basic validations in profiler config and profiler rules.

        No default profiler rule will be used. The user needs to specify rules explicitly
        """
        if self.disable_profiler:
            if self.profiler_config and not self.profiler_config.disable_profiler:
                raise RuntimeError(
                    "profiler_config.disable_profiler cannot be False"
                    + " when disable_profiler is True."
                )
            if self.profiler_rules:
                raise RuntimeError("ProfilerRule cannot be set when disable_profiler is True.")
        elif _region_supports_profiler(self.sagemaker_session.boto_region_name):
            if self.profiler_config is None:
                self.profiler_config = ProfilerConfig(s3_output_path=self.output_path)
            if self.rules is None or (self.rules and not self.profiler_rules):
                self.profiler_rules = []
                if self.profiler_config.profile_params:
                    self.profiler_rules.append(
                        get_default_profiler_processing_job(
                            instance_type=self.profiler_config.profile_params.instanceType,
                            volume_size_in_gb=self.profiler_config.profile_params.volumeSizeInGB,
                        )
                    )  # Rule specifying processing options for detail prof

        if self.profiler_config and not self.profiler_config.s3_output_path:
            self.profiler_config.s3_output_path = self.output_path

        self.profiler_rule_configs = self._prepare_profiler_rules()
        # if profiler_config is still None, it means the job has profiler disabled
        if self.profiler_config is None:
            self.profiler_config = ProfilerConfig(disable_profiler=True)