code: def test_model_registration_with_drift_check_baselines(
      sagemaker_session,
      role,
      pipeline_name,
  ):
      instance_count = ParameterInteger(
          name="InstanceCount", default_value=1
      )
      instance_type = "ml.m5.xlarge"
  
      # upload model data to s3
      model_local_path = os.path.join(
          DATA_DIR, "mxnet_mnist/model.tar.gz"
      )
      model_base_uri = "s3://{}/{}/input/model/{}".format(
          sagemaker_session.default_bucket(),
          "register_model_test_with_drift_baseline",
          utils.unique_name_from_base("model"),
      )
      model_uri = S3Uploader.upload(
          model_local_path,
          model_base_uri,
          sagemaker_session=sagemaker_session,
      )
      model_uri_param = ParameterString(
          name="model_uri", default_value=model_uri
      )
  
      # upload metrics to s3
      metrics_data = (
          '{"regression_metrics": {"mse": {"value": 4.925353410353891, '
          '"standard_deviation": 2.219186917819692}}}'
      )
      metrics_base_uri = "s3://{}/{}/input/metrics/{}".format(
          sagemaker_session.default_bucket(),
          "register_model_test_with_drift_baseline",
          utils.unique_name_from_base("metrics"),
      )
      metrics_uri = S3Uploader.upload_string_as_file_body(
          body=metrics_data,
          desired_s3_uri=metrics_base_uri,
          sagemaker_session=sagemaker_session,
      )
      metrics_uri_param = ParameterString(
          name="metrics_uri", default_value=metrics_uri
      )
  
      model_metrics = ModelMetrics(
          bias=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          explainability=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          bias_pre_training=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          bias_post_training=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
      )
      drift_check_baselines = DriftCheckBaselines(
          model_statistics=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          model_constraints=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          model_data_statistics=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          model_data_constraints=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          bias_config_file=FileSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          bias_pre_training_constraints=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          bias_post_training_constraints=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          explainability_constraints=MetricsSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
          explainability_config_file=FileSource(
              s3_uri=metrics_uri_param,
              content_type="application/json",
          ),
      )
      customer_metadata_properties = {"key1": "value1"}
      domain = "COMPUTER_VISION"
      task = "IMAGE_CLASSIFICATION"
      sample_payload_url = "s3://test-bucket/model"
      framework = "TENSORFLOW"
      framework_version = "2.9"
      nearest_model_name = "resnet50"
      data_input_configuration = '{"input_1":[1,224,224,3]}'
      skip_model_validation = "All"
  
      # If image_uri is not provided, the instance_type should not be a pipeline variable
      # since instance_type is used to retrieve image_uri in compile time (PySDK)
      estimator = XGBoost(
          entry_point="training.py",
          source_dir=os.path.join(DATA_DIR, "sip"),
          instance_type=instance_type,
          instance_count=instance_count,
          framework_version="0.90-2",
          sagemaker_session=sagemaker_session,
          py_version="py3",
          role=role,
      )
  
      step_register = RegisterModel(
          name="MyRegisterModelStep",
          estimator=estimator,
          model_data=model_uri_param,
          content_types=["application/json"],
          response_types=["application/json"],
          inference_instances=["ml.t2.medium", "ml.m5.xlarge"],
          transform_instances=["ml.m5.xlarge"],
          model_package_group_name="testModelPackageGroup",
          model_metrics=model_metrics,
          drift_check_baselines=drift_check_baselines,
          customer_metadata_properties=customer_metadata_properties,
          domain=domain,
          sample_payload_url=sample_payload_url,
          task=task,
          framework=framework,
          framework_version=framework_version,
          nearest_model_name=nearest_model_name,
          data_input_configuration=data_input_configuration,
          skip_model_validation=skip_model_validation,
      )
  
      pipeline = Pipeline(
          name=pipeline_name,
          parameters=[
              model_uri_param,
              metrics_uri_param,
              instance_count,
          ],
          steps=[step_register],
          sagemaker_session=sagemaker_session,
      )
  
      try:
          response = pipeline.create(role)
          create_arn = response["PipelineArn"]
  
          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={
                      "model_uri": model_uri,
                      "metrics_uri": metrics_uri,
                  }
              )
              response = execution.describe()
  
              assert response["PipelineArn"] == create_arn
  
              wait_pipeline_execution(execution=execution)
              execution_steps = execution.list_steps()
  
              assert len(execution_steps) == 1
              failure_reason = execution_steps[0].get(
                  "FailureReason", ""
              )
              if failure_reason != "":
                  logging.error(
                      f"Pipeline execution failed with error: {failure_reason}."
                      " Retrying.."
                  )
                  continue
              assert execution_steps[0]["StepStatus"] == "Succeeded"
              assert (
                  execution_steps[0]["StepName"]
                  == "MyRegisterModelStep-RegisterModel"
              )
  
              response = sagemaker_session.sagemaker_client.describe_model_package(
                  ModelPackageName=execution_steps[0]["Metadata"][
                      "RegisterModel"
                  ]["Arn"]
              )
  
              assert (
                  response["ModelMetrics"]["Explainability"]["Report"][
                      "ContentType"
                  ]
                  == "application/json"
              )
              assert (
                  response["DriftCheckBaselines"]["Bias"][
                      "PreTrainingConstraints"
                  ]["ContentType"]
                  == "application/json"
              )
              assert (
                  response["DriftCheckBaselines"]["Explainability"][
                      "Constraints"
                  ]["ContentType"]
                  == "application/json"
              )
              assert (
                  response["DriftCheckBaselines"]["ModelQuality"][
                      "Statistics"
                  ]["ContentType"]
                  == "application/json"
              )
              assert (
                  response["DriftCheckBaselines"]["ModelDataQuality"][
                      "Statistics"
                  ]["ContentType"]
                  == "application/json"
              )
              assert (
                  response["CustomerMetadataProperties"]
                  == customer_metadata_properties
              )
              assert response["Domain"] == domain
              assert response["Task"] == task
              assert response["SamplePayloadUrl"] == sample_payload_url
              assert (
                  response["SkipModelValidation"]
                  == skip_model_validation
              )
              break
      finally:
          try:
              pipeline.delete()
          except Exception:
              pass
  
imports: from __future__ import absolute_import
  import logging
  import os
  import re
  import pytest
  import tests
  from tests.integ.sagemaker.workflow.helpers import wait_pipeline_execution
  from sagemaker.tensorflow import TensorFlow, TensorFlowModel
  from tests.integ.retry import retries
  from sagemaker.drift_check_baselines import DriftCheckBaselines
  from sagemaker import PipelineModel, TrainingInput, Model, ModelMetrics, MetricsSource, get_execution_role
  from sagemaker import FileSource, utils
  from sagemaker.inputs import CreateModelInput
  from sagemaker.processing import ProcessingInput, ProcessingOutput
  from sagemaker.pytorch import PyTorch
  from sagemaker.s3 import S3Uploader
  from sagemaker.sklearn import SKLearnModel, SKLearnProcessor
  from sagemaker.mxnet.model import MXNetModel
  from sagemaker.workflow.condition_step import ConditionStep
  from sagemaker.workflow.parameters import ParameterInteger, ParameterString
  from sagemaker.workflow.pipeline import Pipeline
  from sagemaker.workflow.step_collections import RegisterModel
  from sagemaker.workflow.steps import CreateModelStep, ProcessingStep, TrainingStep
  from sagemaker.xgboost import XGBoostModel
  from sagemaker.xgboost import XGBoost
  from sagemaker.workflow.conditions import ConditionGreaterThanOrEqualTo, ConditionIn
  from tests.integ.kms_utils import get_or_create_kms_key
  from tests.integ import DATA_DIR
label_desc: Use image node_id 7 for calling a global function with example usage: test_model_registration_with_drift_check_baselines(sagemaker_session, role, pipeline_name) without return types