code: def test_executor_submit_with_run_inside(
      sagemaker_session,
      dummy_container_without_error,
      cpu_instance_type,
  ):
      def square(x):
          with load_run() as run:
              result = x * x
              run.log_metric("x", result)
          return result
  
      def cube(x):
          with load_run() as run:
              result = x * x * x
              run.log_metric("x", result)
          return result
  
      exp_name = unique_name_from_base("my-test-exp")
      run_name = "my-test-run"
      tc_name = Run._generate_trial_component_name(
          experiment_name=exp_name, run_name=run_name
      )
  
      timestamp = int(time.time())
      job_prefix = f"test-submit-run-inside-{timestamp}"
      with cleanup_exp_resources(
          exp_names=[exp_name], sagemaker_session=sagemaker_session
      ):
          with RemoteExecutor(
              max_parallel_jobs=1,
              role=ROLE,
              image_uri=dummy_container_without_error,
              instance_type=cpu_instance_type,
              sagemaker_session=sagemaker_session,
              keep_alive_period_in_seconds=30,
              job_name_prefix=job_prefix,
          ) as e:
              with Run(
                  experiment_name=exp_name,
                  run_name=run_name,
                  sagemaker_session=sagemaker_session,
              ):
                  future_1 = e.submit(square, 10)
                  future_2 = e.submit(cube, 10)
  
          assert future_1.result() == 100
          assert future_2.result() == 1000
  
          assert (
              get_future(
                  future_1._job.job_name, sagemaker_session
              ).result()
              == 100
          )
          assert (
              get_future(
                  future_2._job.job_name, sagemaker_session
              ).result()
              == 1000
          )
  
          assert next(
              list_futures(
                  job_name_prefix=job_prefix,
                  sagemaker_session=sagemaker_session,
              )
          )._job.job_name.startswith(job_prefix)
  
          tc = _TrialComponent.load(
              trial_component_name=tc_name,
              sagemaker_session=sagemaker_session,
          )
          assert len(tc.metrics) > 0
          for metric_summary in tc.metrics:
              if metric_summary.metric_name != "x":
                  continue
              assert metric_summary.max == 1000
              assert metric_summary.min == 100
              assert metric_summary.avg == 550
  
file_path: sagemaker-python-sdk/tests/integ/sagemaker/remote_function/test_executor.py
imports: from __future__ import absolute_import
  import time
  import pytest
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.remote_function import RemoteExecutor
  from sagemaker.remote_function.client import get_future, list_futures
  from sagemaker.experiments.run import Run, load_run
  from sagemaker.remote_function.core.serialization import CloudpickleSerializer
  from sagemaker.remote_function.errors import DeserializationError
  from sagemaker.s3 import S3Uploader
  from sagemaker.s3_utils import s3_path_join
  from tests.integ.sagemaker.experiments.helpers import cleanup_exp_resources
  from sagemaker.utils import unique_name_from_base
label_desc: Use image node_id 3 for calling a global function with example usage: test_executor_submit_with_run_inside(sagemaker_session, dummy_container_without_error, cpu_instance_type) and returns: result, result