code: def test_ray_timeline(shutdown_only):
      ray.init(num_cpus=8)
  
      @ray.remote
      def f():
          pass
  
      ray.get(f.remote())
  
      with tempfile.TemporaryDirectory() as tmpdirname:
          filename = os.path.join(tmpdirname, "timeline.json")
          ray.timeline(filename)
  
          with open(filename, "r") as f:
              dumped = json.load(f)
          # TODO(swang): Check actual content. It doesn't seem to match the
          # return value of chrome_tracing_dump in above tests?
          assert len(dumped) > 0
  
imports: import asyncio
  import json
  import os
  import sys
  from pathlib import Path
  import tempfile
  from collections import defaultdict
  from ray._private.test_utils import check_call_subprocess
  import ray
  import requests
  import pytest
  from ray._private.profiling import chrome_tracing_dump
  from ray.util.state import get_actor, list_tasks, list_actors, list_workers, list_nodes
  from ray._private.test_utils import wait_for_condition
label_desc: Use image node_id 7 for calling a global function with example usage: test_ray_timeline(shutdown_only) without return types