code: def test_auto_fetch_created_run_obj_from_context(
      run_obj, sagemaker_session
  ):
      assert not run_obj._inside_init_context
      assert not run_obj._inside_load_context
      assert not run_obj._in_load
      assert not _RunContext.get_current_run()
  
      def train():
          with load_run(
              sagemaker_session=sagemaker_session
          ) as run_load:
              assert run_load == run_obj
              assert _RunContext.get_current_run() == run_obj
              assert run_obj._inside_init_context
              assert run_obj._inside_load_context
              assert run_obj._in_load
  
              run_load.log_parameter("foo", "bar")
              run_load.log_parameter("whizz", 1)
  
      with run_obj:
          assert run_obj._inside_init_context
          assert not run_obj._inside_load_context
          assert not run_obj._in_load
          assert _RunContext.get_current_run() == run_obj
  
          train()
  
          assert run_obj._inside_init_context
          assert not run_obj._inside_load_context
          assert not run_obj._in_load
          assert _RunContext.get_current_run() == run_obj
  
          run_obj.log_parameters({"a": "b", "c": 2})
  
          assert run_obj._trial_component.parameters["foo"] == "bar"
          assert run_obj._trial_component.parameters["whizz"] == 1
          assert run_obj._trial_component.parameters["a"] == "b"
          assert run_obj._trial_component.parameters["c"] == 2
  
          # Verify separating load_run and with statement in different lines still work
          run_load2 = load_run(sagemaker_session=sagemaker_session)
          with run_load2:
              assert run_load2 == run_obj
              assert run_obj._inside_init_context
              assert run_obj._inside_load_context
              assert run_obj._in_load
  
          assert run_obj._inside_init_context
          assert not run_obj._inside_load_context
          assert not run_obj._in_load
          assert _RunContext.get_current_run() == run_obj
  
      assert not run_obj._inside_init_context
      assert not run_obj._inside_load_context
      assert not run_obj._in_load
      assert not _RunContext.get_current_run()
  
imports: from __future__ import absolute_import
  from unittest.mock import patch, MagicMock
  import pytest
  from sagemaker import Processor
  from sagemaker.estimator import Estimator, _TrainingJob
  from sagemaker.experiments.experiment import Experiment
  from sagemaker.experiments.run import _RunContext
  from sagemaker.experiments import load_run, Run
  from sagemaker.experiments.trial import _Trial
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.processing import ProcessingJob
  from sagemaker.transformer import _TransformJob, Transformer
  from tests.unit.sagemaker.experiments.helpers import TEST_EXP_NAME, mock_trial_load_or_create_func, mock_tc_load_or_create_func
label_desc: Use image node_id 6 for calling a global function with example usage: test_auto_fetch_created_run_obj_from_context(run_obj, sagemaker_session) without return types