code: def test_mxnet_with_custom_rule_and_debugger_hook_config(
      sagemaker_session,
      mxnet_training_latest_version,
      mxnet_training_latest_py_version,
      cpu_instance_type,
  ):
      with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
          rules = [_get_custom_rule(sagemaker_session)]
          debugger_hook_config = DebuggerHookConfig(
              s3_output_path=os.path.join(
                  "s3://",
                  sagemaker_session.default_bucket(),
                  str(uuid.uuid4()),
                  "tensors",
              )
          )
  
          script_path = os.path.join(
              DATA_DIR, "mxnet_mnist", "mnist_gluon.py"
          )
          data_path = os.path.join(DATA_DIR, "mxnet_mnist")
  
          mx = MXNet(
              entry_point=script_path,
              role="SageMakerRole",
              framework_version=mxnet_training_latest_version,
              py_version=mxnet_training_latest_py_version,
              instance_count=1,
              instance_type=cpu_instance_type,
              sagemaker_session=sagemaker_session,
              rules=rules,
              debugger_hook_config=debugger_hook_config,
          )
  
          train_input = mx.sagemaker_session.upload_data(
              path=os.path.join(data_path, "train"),
              key_prefix="integ-test-data/mxnet_mnist/train",
          )
          test_input = mx.sagemaker_session.upload_data(
              path=os.path.join(data_path, "test"),
              key_prefix="integ-test-data/mxnet_mnist/test",
          )
  
          mx.fit({"train": train_input, "test": test_input})
  
          job_description = mx.latest_training_job.describe()
  
          for index, rule in enumerate(rules):
              assert (
                  job_description["DebugRuleConfigurations"][index][
                      "RuleConfigurationName"
                  ]
                  == rule.name
              )
              assert (
                  job_description["DebugRuleConfigurations"][index][
                      "RuleEvaluatorImage"
                  ]
                  == rule.image_uri
              )
              assert (
                  job_description["DebugRuleConfigurations"][index][
                      "VolumeSizeInGB"
                  ]
                  == 30
              )
          assert (
              job_description["DebugHookConfig"]
              == debugger_hook_config._to_request_dict()
          )
  
          assert (
              _get_rule_evaluation_statuses(job_description)
              == mx.latest_training_job.rule_job_summary()
          )
  
          _wait_and_assert_that_no_rule_jobs_errored(
              training_job=mx.latest_training_job
          )
  
imports: from __future__ import absolute_import
  import os
  import uuid
  import pytest
  from sagemaker.debugger.debugger import DebuggerHookConfig, Rule, rule_configs, TensorBoardOutputConfig
  from sagemaker.mxnet.estimator import MXNet
  from sagemaker.pytorch.estimator import PyTorch
  from sagemaker.tensorflow.estimator import TensorFlow
  from sagemaker.xgboost.estimator import XGBoost
  from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.retry import retries
  from tests.integ.timeout import timeout
label_desc: Use image node_id 9 for calling a global function with example usage: test_mxnet_with_custom_rule_and_debugger_hook_config(sagemaker_session, mxnet_training_latest_version, mxnet_training_latest_py_version, cpu_instance_type) without return types