code: def test_get_best_auto_ml_model(pipeline_session):
      auto_ml = AutoML(
          role=ROLE,
          target_attribute_name="y",
          sagemaker_session=pipeline_session,
          volume_kms_key="volume-kms-key-id-string",
          vpc_config={
              "SecurityGroupIds": ["group"],
              "Subnets": ["subnet"],
          },
          encrypt_inter_container_traffic=False,
          compression_type="Gzip",
          output_kms_key="output-kms-key-id-string",
          output_path="s3://my_other_bucket/",
          problem_type="BinaryClassification",
          max_candidates=1,
          max_runtime_per_training_job_in_seconds=3600,
          total_job_runtime_in_seconds=36000,
          job_objective={"MetricName": "F1"},
          generate_candidate_definitions_only=False,
          tags=[{"Name": "some-tag", "Value": "value-for-tag"}],
          content_type="x-application/vnd.amazon+parquet",
          s3_data_type="ManifestFile",
          feature_specification_s3_uri="s3://bucket/features.json",
          validation_fraction=0.3,
          mode="ENSEMBLING",
          auto_generate_endpoint_name=False,
          endpoint_name="EndpointName",
      )
      input_training = AutoMLInput(
          inputs="s3://bucket/data",
          target_attribute_name="target",
          compression="Gzip",
          channel_type="training",
      )
      input_validation = AutoMLInput(
          inputs="s3://bucket/validation_data",
          target_attribute_name="target",
          compression="Gzip",
          channel_type="validation",
      )
      inputs = [input_training, input_validation]
  
      step_args = auto_ml.fit(
          inputs=inputs,
      )
  
      automl_step = AutoMLStep(
          name="MyAutoMLStep",
          step_args=step_args,
      )
  
      automl_model = automl_step.get_best_auto_ml_model(
          sagemaker_session=pipeline_session, role=ROLE
      )
  
      step_args_create_model = automl_model.create(
          instance_type="c4.4xlarge",
      )
  
      automl_model_step = ModelStep(
          name="MyAutoMLModelStep",
          step_args=step_args_create_model,
      )
  
      pipeline = Pipeline(
          name="MyPipeline",
          steps=[automl_step, automl_model_step],
          sagemaker_session=pipeline_session,
      )
  
      step_dsl_list = json.loads(pipeline.definition())["Steps"]
      assert len(step_dsl_list) == 2
      assert step_dsl_list[1] == {
          "Name": "MyAutoMLModelStep-CreateModel",
          "Type": "Model",
          "Arguments": {
              "ExecutionRoleArn": "DummyRole",
              "PrimaryContainer": {
                  "Environment": {
                      "MODEL_NAME": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['MODEL_NAME']"
                      },
                      "SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT']"
                      },
                      "SAGEMAKER_INFERENCE_OUTPUT": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['SAGEMAKER_INFERENCE_OUTPUT']"
                      },
                      "SAGEMAKER_INFERENCE_SUPPORTED": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['SAGEMAKER_INFERENCE_SUPPORTED']"
                      },
                      "SAGEMAKER_PROGRAM": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['SAGEMAKER_PROGRAM']"
                      },
                      "SAGEMAKER_SUBMIT_DIRECTORY": {
                          "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0]."
                          "Environment['SAGEMAKER_SUBMIT_DIRECTORY']"
                      },
                  },
                  "Image": {
                      "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0].Image"
                  },
                  "ModelDataUrl": {
                      "Get": "Steps.MyAutoMLStep.BestCandidate.InferenceContainers[0].ModelDataUrl"
                  },
              },
          },
      }
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/workflow/test_automl_step.py
imports: from __future__ import absolute_import
  import json
  import pytest
  from sagemaker.automl.automl import AutoML, AutoMLInput
  from sagemaker.exceptions import AutoMLStepInvalidModeError
  from sagemaker.workflow import ParameterString
  from sagemaker.workflow.automl_step import AutoMLStep
  from sagemaker.workflow.model_step import ModelStep
  from sagemaker.workflow.pipeline import Pipeline
  from sagemaker.workflow.pipeline_definition_config import PipelineDefinitionConfig
  from tests.unit.sagemaker.workflow.conftest import ROLE
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_best_auto_ml_model(pipeline_session) without return types