docstr: Test Nsight profile on multiple ray tasks/actors
docstr_tok: ["Test","Nsight","profile","on","multiple","ray","tasks\/actors"]
code: def test_nsight_multiple_tasks(
      self,
      shutdown_only,
  ):
      """Test Nsight profile on multiple ray tasks/actors"""
      ray.init()
      session_dir = ray.worker._global_node.get_session_dir_path()
      profilers_dir = Path(session_dir) / "logs" / "nsight"
  
      # test ray task
      @ray.remote(
          runtime_env={
              "nsight": {"o": "ray_task_%p"},
          }
      )
      def test_generate_report():
          return 0
  
      # test ray actor
      @ray.remote(runtime_env={"nsight": {"o": "ray_actor"}})
      class NsightActor:
          def run(self):
              return 0
  
      ray_actor = NsightActor.remote()
      ray.get(
          [
              test_generate_report.remote(),
              test_generate_report.remote(),
              ray_actor.run.remote(),
              ray_actor.run.remote(),
          ]
      )
      ray.kill(ray_actor)
  
      wait_for_condition(
          wait_for_report, profilers_dir=profilers_dir, num_reports=3
      )
      nsys_reports = glob.glob(
          os.path.join(f"{profilers_dir}/*.nsys-rep")
      )
      assert (
          len(nsys_reports) == 3
      )  # ray actor used only one worker process
      for report in nsys_reports:
          assert "ray_task" in report or "ray_actor" in report
          os.remove(report)
  
file_path: ray/python/ray/tests/test_runtime_env_profiler.py
imports: import os
  import glob
  import sys
  from pathlib import Path
  import pytest
  import subprocess
  import ray
  from ray._private.runtime_env.nsight import parse_nsight_config
  from ray._private.test_utils import wait_for_condition
  from ray.exceptions import RuntimeEnvSetupError
label_desc: Use image node_id 3 for calling the TestNsightProfiler obj's underlying member method code with example usage: obj.test_nsight_multiple_tasks(shutdown_only) and returns: int, int