code: def test_pipeline_update(
      waiter_mock,
      deserializer_mock,
      s3_downloader_mock,
      sagemaker_session_mock,
      role_arn,
  ):
      sagemaker_session_mock.sagemaker_config = {}
      pipeline = Pipeline(
          name="MyPipeline",
          parameters=[],
          steps=[],
          sagemaker_session=sagemaker_session_mock,
      )
      assert not pipeline.steps
      pipeline.update(role_arn=role_arn)
      assert len(json.loads(pipeline.definition())["Steps"]) == 0
      assert sagemaker_session_mock.sagemaker_client.update_pipeline.called_with(
          PipelineName="MyPipeline",
          PipelineDefinition=pipeline.definition(),
          RoleArn=role_arn,
      )
  
      step1 = CustomStep(name="MyStep1")
      step2 = CustomStep(name="MyStep2", input_data=step1.properties)
      step_collection = StepCollection(
          name="MyStepCollection", steps=[step1, step2]
      )
      cond_step = ConditionStep(
          name="MyConditionStep",
          depends_on=[],
          conditions=[ConditionEquals(left=2, right=1)],
          if_steps=[step_collection],
          else_steps=[],
      )
      step3 = CustomStep(name="MyStep3", depends_on=[step_collection])
      dr_step_4 = DelayedReturn(
          function_step=CustomFunctionStep(
              func_args=(1, 2),
              func=lambda x, y: x + y + 3,
              job_settings=_JobSettings(
                  image_uri="image",
                  instance_type="ml.m4.xlarge",
                  sagemaker_session=sagemaker_session_mock,
              ),
              name="stepC",
              description="",
              display_name="",
              depends_on=[step3],
          )
      )
      pipeline = Pipeline(
          name="MyPipeline",
          parameters=[],
          steps=[
              cond_step,
              # step3, # this step is an upstream step, can be auto fetched
              dr_step_4,
          ],
          sagemaker_session=sagemaker_session_mock,
      )
      assert len(pipeline.steps) == 2
  
      pipeline.update(role_arn=role_arn)
      assert len(json.loads(pipeline.definition())["Steps"]) == 3
      assert sagemaker_session_mock.sagemaker_client.update_pipeline.called_with(
          PipelineName="MyPipeline",
          PipelineDefinition=pipeline.definition(),
          RoleArn=role_arn,
      )
  
      sagemaker_session_mock.sagemaker_client.start_pipeline_execution.return_value = {
          "PipelineExecutionArn": "arn:aws:sagemaker:us-west-2:111111111111:pipeline/mypipeline/execution/myexecution",
      }
      execution = pipeline.start()
  
      sagemaker_session_mock.sagemaker_client.list_pipeline_execution_steps.return_value = {
          "PipelineExecutionSteps": [
              {
                  "StepName": "stepC",
                  "Metadata": {
                      "TrainingJob": {
                          "Arn": "arn:aws:sagemaker:us-west-2:111111111111:training-job/foo"
                      }
                  },
              }
          ]
      }
  
      sagemaker_session_mock.describe_training_job.return_value = {
          "AlgorithmSpecification": {
              "ContainerEntrypoint": [
                  "/bin/bash",
                  "/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh",
              ]
          },
          "TrainingJobStatus": "Completed",
          "OutputDataConfig": {"S3OutputPath": "s3:/my-bucket/my-key"},
          "Environment": {"REMOTE_FUNCTION_SECRET_KEY": "abcdefg"},
      }
      execution.result("stepC")
      assert s3_downloader_mock.read_bytes(
          "s3:/my-bucket/my-key/myexecution/stepC/results/metadata.json"
      )
      assert s3_downloader_mock.read_bytes(
          "s3:/my-bucket/my-key/myexecution/stepC/results/payload.pkl"
      )
  
imports: from __future__ import absolute_import
  import copy
  import json
  import pytest
  from mock import Mock, call, patch
  from sagemaker import s3
  from sagemaker.remote_function.job import _JobSettings
  from sagemaker.session_settings import SessionSettings
  from sagemaker.workflow.condition_step import ConditionStep
  from sagemaker.workflow.conditions import ConditionEquals
  from sagemaker.workflow.execution_variables import ExecutionVariables
  from sagemaker.workflow.function_step import DelayedReturn, step
  from sagemaker.workflow.functions import JsonGet, Join
  from sagemaker.workflow.parameters import ParameterString
  from sagemaker.workflow.pipeline import Pipeline, PipelineGraph, _replace_pipeline_name_in_json_get_s3_uri
  from sagemaker.workflow.pipeline_context import _PipelineConfig
  from sagemaker.workflow.pipeline_definition_config import PipelineDefinitionConfig
  from sagemaker.workflow.pipeline_experiment_config import PipelineExperimentConfig, PipelineExperimentConfigProperties
  from sagemaker.workflow.step_collections import StepCollection
  from tests.unit.sagemaker.workflow.helpers import ordered, CustomStep, CustomFunctionStep
  from sagemaker.local.local_session import LocalSession
  from botocore.exceptions import ClientError
  from sagemaker.workflow.selective_execution_config import SelectiveExecutionConfig
label_desc: Use image node_id 8 for calling a global function with example usage: test_pipeline_update(waiter_mock, deserializer_mock, s3_downloader_mock, sagemaker_session_mock, role_arn) without return types