code: def test_memory_profile_dashboard_and_agent(
      monkeypatch, shutdown_only
  ):
      with monkeypatch.context() as m:
          m.setenv(
              services.RAY_MEMRAY_PROFILE_COMPONENT_ENV,
              "dashboard,dashboard_agent",
          )
          m.setenv(services.RAY_MEMRAY_PROFILE_OPTIONS_ENV, "-q")
          addr = ray.init()
  
          def verify():
              session_dir = Path(addr["session_dir"])
              profile_dir = session_dir / "profile"
              assert profile_dir.exists()
              files = []
              for f in profile_dir.iterdir():
                  files.append(f.name)
              assert len(files) == 2
              assert f"{session_dir.name}_memory_dashboard.bin" in files
              assert (
                  f"{session_dir.name}_memory_dashboard_agent.bin"
                  in files
              )
              return True
  
          wait_for_condition(verify)
  
file_path: ray/python/ray/tests/test_debug_tools.py
imports: import os
  import subprocess
  import sys
  import pytest
  from pathlib import Path
  import ray
  import ray._private.services
  import ray._private.ray_constants
  from ray._private.test_utils import wait_for_condition
label_desc: Use image node_id 4 for calling a global function with example usage: test_memory_profile_dashboard_and_agent(monkeypatch, shutdown_only) and returns: True