code: def test_xgboost_model_register_and_deploy_with_runtime_repack(
      pipeline_session, sagemaker_session, role, pipeline_name
  ):
      # Assign entry_point and enable_network_isolation to the model
      # which will trigger a model runtime repacking and update the container env with
      # SAGEMAKER_SUBMIT_DIRECTORY=/opt/ml/model/code
      endpoint_name = unique_name_from_base("model-xgboost-integ")
      model_package_group_name = f"{pipeline_name}TestModelPackageGroup"
      xgb_model_data_s3 = pipeline_session.upload_data(
          path=os.path.join(_XGBOOST_PATH, "xgb_model.tar.gz"),
          key_prefix="integ-test-data/xgboost/model",
      )
      xgb_model_data_param = ParameterString(
          name="ModelData", default_value=xgb_model_data_s3
      )
      xgb_model = XGBoostModel(
          model_data=xgb_model_data_param,
          framework_version="1.3-1",
          role=role,
          sagemaker_session=pipeline_session,
          entry_point=os.path.join(_XGBOOST_PATH, "inference.py"),
          enable_network_isolation=True,
      )
      step_args = xgb_model.register(
          content_types=["application/json"],
          response_types=["application/json"],
          inference_instances=["ml.m5.large"],
          transform_instances=["ml.m5.large"],
          model_package_group_name=model_package_group_name,
          approval_status="Approved",
      )
      step_model = ModelStep(
          name="MyModelStep",
          step_args=step_args,
      )
      pipeline = Pipeline(
          name=pipeline_name,
          parameters=[xgb_model_data_param],
          steps=[step_model],
          sagemaker_session=pipeline_session,
      )
      try:
          pipeline.create(role)
  
          for _ in retries(
              max_retry_count=5,
              exception_message_prefix="Waiting for a successful execution of pipeline",
              seconds_to_sleep=10,
          ):
              execution = pipeline.start(parameters={})
              wait_pipeline_execution(execution=execution)
  
              # Verify the pipeline execution succeeded
              step_register_model = None
              execution_steps = execution.list_steps()
              is_execution_fail = False
              for step in execution_steps:
                  failure_reason = step.get("FailureReason", "")
                  if failure_reason != "":
                      logging.error(
                          f"Pipeline execution failed with error: {failure_reason}."
                          " Retrying.."
                      )
                      is_execution_fail = True
                      break
                  assert step["StepStatus"] == "Succeeded"
                  if _REGISTER_MODEL_NAME_BASE in step["StepName"]:
                      step_register_model = step
              if is_execution_fail:
                  continue
              assert len(execution_steps) == 2
              assert step_register_model
              break
  
          # Verify the registered model can work as expected
          with timeout_and_delete_endpoint_by_name(
              endpoint_name=endpoint_name,
              sagemaker_session=pipeline_session,
          ):
              model_pkg_arn = step_register_model["Metadata"][
                  _REGISTER_MODEL_TYPE
              ]["Arn"]
              response = pipeline_session.sagemaker_client.describe_model_package(
                  ModelPackageName=model_pkg_arn
              )
              model_package = ModelPackage(
                  role=role,
                  model_data=response["InferenceSpecification"][
                      "Containers"
                  ][0]["ModelDataUrl"],
                  model_package_arn=model_pkg_arn,
                  sagemaker_session=sagemaker_session,
              )
              model_package.deploy(
                  initial_instance_count=1,
                  instance_type="ml.m5.large",
                  endpoint_name=endpoint_name,
              )
              predictor = XGBoostPredictor(
                  endpoint_name=endpoint_name,
                  sagemaker_session=pipeline_session,
              )
              _, *features = _XGBOOST_TEST_DATA.strip().split()
              test_data = " ".join(["-99"] + features)
              response = predictor.predict(test_data)
              assert len(response) == 1
              # extra data are appended by the inference.py
              assert len(response[0]) > 1
      finally:
          try:
              pipeline.delete()
              pipeline_session.sagemaker_client.delete_model_package(
                  ModelPackageName=model_package.model_package_arn
              )
              pipeline_session.sagemaker_client.delete_model_package_group(
                  ModelPackageGroupName=model_package_group_name
              )
          except Exception as error:
              logging.error(error)
  
imports: from __future__ import absolute_import
  import logging
  import os
  import pytest
  from tests.integ.sagemaker.workflow.helpers import wait_pipeline_execution
  from sagemaker.workflow.fail_step import FailStep
  from sagemaker.workflow.functions import Join
  from tests.integ.timeout import timeout_and_delete_endpoint_by_name
  from sagemaker.tensorflow import TensorFlow, TensorFlowModel, TensorFlowPredictor
  from sagemaker.utils import unique_name_from_base
  from sagemaker.workflow.model_step import ModelStep, _REGISTER_MODEL_NAME_BASE, _CREATE_MODEL_NAME_BASE
  from tests.integ.retry import retries
  from sagemaker.drift_check_baselines import DriftCheckBaselines
  from sagemaker import PipelineModel, TrainingInput, Model, ModelMetrics, MetricsSource, get_execution_role, ModelPackage
  from sagemaker import FileSource, utils
  from sagemaker.pytorch import PyTorch
  from sagemaker.s3 import S3Uploader
  from sagemaker.mxnet.model import MXNetModel
  from sagemaker.workflow.parameters import ParameterInteger, ParameterString
  from sagemaker.workflow.pipeline import Pipeline
  from sagemaker.workflow.steps import TrainingStep
  from sagemaker.xgboost import XGBoost, XGBoostModel, XGBoostPredictor
  from tests.integ.kms_utils import get_or_create_kms_key
  from tests.integ import DATA_DIR
label_desc: Use image node_id 8 for calling a global function with example usage: test_xgboost_model_register_and_deploy_with_runtime_repack(pipeline_session, sagemaker_session, role, pipeline_name) without return types