code: def test_kmeans_efs(
      efs_fsx_setup, sagemaker_session, cpu_instance_type
  ):
      with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
          role = efs_fsx_setup["role_name"]
          subnets = [efs_fsx_setup["subnet_id"]]
          security_group_ids = efs_fsx_setup["security_group_ids"]
  
          kmeans = KMeans(
              role=role,
              instance_count=INSTANCE_COUNT,
              instance_type=cpu_instance_type,
              k=K,
              sagemaker_session=sagemaker_session,
              subnets=subnets,
              security_group_ids=security_group_ids,
          )
  
          file_system_efs_id = efs_fsx_setup["file_system_efs_id"]
          records = FileSystemRecordSet(
              file_system_id=file_system_efs_id,
              file_system_type="EFS",
              directory_path=EFS_DIR_PATH,
              num_records=NUM_RECORDS,
              feature_dim=FEATURE_DIM,
          )
  
          job_name = unique_name_from_base("kmeans-efs")
          kmeans.fit(records, job_name=job_name)
          model_path, _ = kmeans.model_data.rsplit("/", 1)
          assert_s3_files_exist(
              sagemaker_session, model_path, ["model.tar.gz"]
          )
  
file_path: sagemaker-python-sdk/tests/integ/test_kmeans_efs_fsx.py
imports: from __future__ import absolute_import
  import pytest
  from sagemaker import KMeans
  from sagemaker.amazon.amazon_estimator import FileSystemRecordSet
  from sagemaker.parameter import IntegerParameter, CategoricalParameter
  from sagemaker.tuner import HyperparameterTuner
  from sagemaker.utils import unique_name_from_base
  import tests
  from tests.integ import TRAINING_DEFAULT_TIMEOUT_MINUTES, TUNING_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.file_system_input_utils import set_up_efs_fsx, tear_down
  from tests.integ.s3_utils import assert_s3_files_exist
  from tests.integ.timeout import timeout
label_desc: Use image node_id 2 for calling a global function with example usage: test_kmeans_efs(efs_fsx_setup, sagemaker_session, cpu_instance_type) without return types