code: def run_obj(sagemaker_session):
      client = sagemaker_session.sagemaker_client
      client.update_trial_component.return_value = {}
      client.associate_trial_component.return_value = {}
      with patch(
          "sagemaker.experiments.run.Experiment._load_or_create",
          MagicMock(
              return_value=Experiment(
                  experiment_name=TEST_EXP_NAME,
                  sagemaker_session=sagemaker_session,
              )
          ),
      ):
          with patch(
              "sagemaker.experiments.run._TrialComponent._load_or_create",
              MagicMock(side_effect=mock_tc_load_or_create_func),
          ):
              with patch(
                  "sagemaker.experiments.run._Trial._load_or_create",
                  MagicMock(side_effect=mock_trial_load_or_create_func),
              ):
                  sagemaker_session.sagemaker_client.search.return_value = {
                      "Results": []
                  }
                  run = Run(
                      experiment_name=TEST_EXP_NAME,
                      sagemaker_session=sagemaker_session,
                  )
                  run._artifact_uploader = Mock()
                  run._lineage_artifact_tracker = Mock()
                  run._metrics_manager = Mock()
  
                  assert run.run_name.startswith(RUN_NAME_BASE)
                  assert run.run_group_name == Run._generate_trial_name(
                      TEST_EXP_NAME
                  )
  
                  return run
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/experiments/conftest.py
imports: from __future__ import absolute_import
  import unittest
  from unittest.mock import patch, MagicMock, Mock
  import pytest
  from sagemaker import Session
  from sagemaker.experiments.experiment import Experiment
  from sagemaker.experiments.run import RUN_NAME_BASE
  from sagemaker.experiments import Run
  from tests.unit.sagemaker.experiments.helpers import mock_tc_load_or_create_func, mock_trial_load_or_create_func, TEST_EXP_NAME
label_desc: Use image node_id 3 for calling a global function with example usage: run_obj(sagemaker_session) and returns: run