code: def set_custom_handler(handler_name):
      """
      This method downloads resnet serialized file, creates mar file and sets up a custom handler
      for running tests
      """
      os.environ["ENABLE_TORCH_PROFILER"] = "true"
  
      if os.path.exists(DEFAULT_OUTPUT_DIR):
          shutil.rmtree(DEFAULT_OUTPUT_DIR)
  
      ## Download resnet 152 serialized file
      pathlib.Path(test_utils.MODEL_STORE).mkdir(
          parents=True, exist_ok=True
      )
      serialized_file = os.path.join(
          test_utils.MODEL_STORE, "resnet152-394f9c45.pth"
      )
      if not os.path.exists(serialized_file):
          response = requests.get(
              "https://download.pytorch.org/models/resnet152-394f9c45.pth",
              allow_redirects=True,
          )
          assert response.status_code == 200
          with open(serialized_file, "wb") as f:
              f.write(response.content)
  
      ## Generate mar file
      cmd = test_utils.model_archiver_command_builder(
          model_name="resnet-152-batch",
          version="1.0",
          model_file=os.path.join(
              test_utils.CODEBUILD_WD,
              "examples",
              "image_classifier",
              "resnet_152_batch",
              "model.py",
          ),
          serialized_file=serialized_file,
          handler=handler_name,
          extra_files=os.path.join(
              test_utils.CODEBUILD_WD,
              "examples",
              "image_classifier",
              "index_to_name.json",
          ),
          force=True,
      )
      print(cmd)
      cmd = cmd.split(" ")
  
      subprocess.run(cmd, check=True, timeout=1000)
  
      # Create config properties to enable env vars
      config_properties = os.path.join(
          test_utils.MODEL_STORE, "config.properties"
      )
      with open(config_properties, "w") as fp:
          fp.write("enable_envvars_config=true")
  
      test_utils.start_torchserve(
          no_config_snapshots=True,
          gen_mar=False,
          snapshot_file=config_properties,
      )
  
      # Register resnet model
      params = {
          "model_name": "resnet152",
          "url": "resnet-152-batch.mar",
          "batch_size": 4,
          "max_batch_delay": 5000,
          "initial_workers": 3,
          "synchronous": "true",
      }
      test_utils.register_model_with_params(params)
  
file_path: serve/test/pytest/test_pytorch_profiler.py
imports: import glob
  import json
  import os
  import pathlib
  import shutil
  import subprocess
  import pytest
  import requests
  import test_utils
  from concurrent import futures
label_desc: Use image node_id 1 for calling a global function with example usage: set_custom_handler(handler_name) without return types