code: def experiment_with_artifacts(sagemaker_session):
      sm = sagemaker_session.sagemaker_client
      trials = {}  # for resource cleanup
  
      experiment_name = "experiment-" + str(uuid.uuid4())
      try:
          sm.create_experiment(ExperimentName=experiment_name)
  
          # Search returns 10 results by default. Add 20 trials to verify pagination.
          for i in range(20):
              trial_name = "trial-" + str(uuid.uuid4())
              sm.create_trial(
                  TrialName=trial_name, ExperimentName=experiment_name
              )
  
              trial_component_name = "tc-" + str(uuid.uuid4())
              trials[trial_name] = trial_component_name
  
              sm.create_trial_component(
                  TrialComponentName=trial_component_name,
                  DisplayName="Training",
              )
              sm.update_trial_component(
                  TrialComponentName=trial_component_name,
                  Parameters={"hp1": {"NumberValue": i}},
                  InputArtifacts={
                      "inputArtifacts1": {
                          "MediaType": "text/csv",
                          "Value": "s3:/foo/bar1",
                      }
                  },
                  OutputArtifacts={
                      "outputArtifacts1": {
                          "MediaType": "text/plain",
                          "Value": "s3:/foo/bar2",
                      }
                  },
              )
              sm.associate_trial_component(
                  TrialComponentName=trial_component_name,
                  TrialName=trial_name,
              )
              time.sleep(1)
  
          time.sleep(15)  # wait for search to get updated
  
          # allow search time thrice
          for _ in range(3):
              analytics = ExperimentAnalytics(
                  experiment_name=experiment_name,
                  sagemaker_session=sagemaker_session,
              )
  
              if len(analytics.dataframe().columns) > 0:
                  break
  
              time.sleep(15)
  
          yield experiment_name
      finally:
          _delete_resources(sm, experiment_name, trials)
  
file_path: sagemaker-python-sdk/tests/integ/test_experiments_analytics.py
imports: from __future__ import absolute_import
  import time
  import uuid
  from contextlib import contextmanager
  import pytest
  from sagemaker.analytics import ExperimentAnalytics
label_desc: Use image node_id 2 for calling a global function with example usage: experiment_with_artifacts(sagemaker_session) without return types