code: def collect_trial_profiles(
      record_property: Callable[[str, object], None]
  ) -> Callable[[int], None]:
      """
      Returns a method that allows profiling of test run for certain system metrics
      and records to JUnit report.
  
      Currently retrieves metrics by trial (assumes one trial per experiment) using
      profiler API.
      """
  
      return profile_test(record_property=record_property)
  
imports: import json
  import subprocess
  import time
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterator, Optional, cast
  import boto3
  import pytest
  from _pytest.config.argparsing import Parser
  from _pytest.fixtures import SubRequest
  from botocore import exceptions
  from determined.experimental import client
  from tests import config
  from tests.experiment import profile_test
  from tests.nightly.compute_stats import compare_stats
  from .cluster.test_users import logged_in_user
  from .cluster_log_manager import ClusterLogManager
label_desc: Use image node_id 9 for calling a global function with example usage: collect_trial_profiles(record_property) and returns: profile_test